drisw: reuse kopper image extension vtable if modifiers/dmabuf is supported

this is handier than copying the same vtable again

Co-authored-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27805>
This commit is contained in:
Lucas Fryzek 2024-02-29 10:34:09 -05:00 committed by Marge Bot
parent d74ea2c117
commit 715b29d032
2 changed files with 11 additions and 1 deletions

View file

@ -119,7 +119,7 @@ libllvmpipe = static_library(
cpp_args : [cpp_msvc_compat_args],
gnu_symbol_visibility : 'hidden',
include_directories : [inc_gallium, inc_gallium_aux, inc_include, inc_src],
dependencies : [ dep_llvm, idep_nir_headers, idep_mesautil ],
dependencies : [ dep_llvm, idep_nir_headers, idep_mesautil, dep_libdrm],
)
# This overwrites the softpipe driver dependency, but itself depends on the

View file

@ -43,6 +43,10 @@
#include "dri_helpers.h"
#include "dri_query_renderer.h"
#ifdef HAVE_LIBDRM
#include <xf86drm.h>
#endif
DEBUG_GET_ONCE_BOOL_OPTION(swrast_no_present, "SWRAST_NO_PRESENT", false);
static inline void
@ -507,6 +511,8 @@ static __DRIimageExtension driSWImageExtension = {
.destroyImage = dri2_destroy_image,
};
extern const __DRIimageExtension driVkImageExtension;
static const __DRIrobustnessExtension dri2Robustness = {
.base = { __DRI2_ROBUSTNESS, 1 }
};
@ -608,6 +614,10 @@ drisw_init_screen(struct dri_screen *screen)
}
else
screen->extensions = drisw_screen_extensions;
#ifdef HAVE_LIBDRM
if (pscreen->resource_create_with_modifiers && (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_EXPORT))
screen->extensions[0] = &driVkImageExtension.base;
#endif
screen->lookup_egl_image = dri2_lookup_egl_image;
const __DRIimageLookupExtension *image = screen->dri2.image;