gbm: check for dmabuf import on device creation

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30472>
This commit is contained in:
Mike Blumenkrantz 2024-07-29 13:23:59 -04:00 committed by Marge Bot
parent 9907166c42
commit d26d2603cc
3 changed files with 11 additions and 1 deletions

View file

@ -50,6 +50,8 @@
#include "util/u_debug.h"
#include "util/macros.h"
#include "dri_util.h"
#include "pipe/p_screen.h"
#include "dri_screen.h"
/* For importing wl_buffer */
#if HAVE_WAYLAND_PLATFORM
@ -1236,6 +1238,13 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
if (ret)
goto err_dri;
struct dri_screen *screen = dri_screen(dri->screen);
struct pipe_screen *pscreen = screen->base.screen;
#ifdef HAVE_DRI3
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_IMPORT)
dri->has_dmabuf_import = true;
#endif
return &dri->base;
err_dri:

View file

@ -52,6 +52,7 @@ struct gbm_dri_device {
char *driver_name; /* Name of the DRI module, without the _dri suffix */
bool software; /* A software driver was loaded */
bool swrast; /* this is swrast */
bool has_dmabuf_import;
__DRIscreen *screen;
__DRIcontext *context;

View file

@ -16,7 +16,7 @@ args_gbm = [
]
deps_gbm = []
incs_gbm = [
include_directories('main'), inc_include, inc_src, inc_loader, inc_gallium, inc_st_dri
include_directories('main'), inc_include, inc_src, inc_loader, inc_gallium, inc_st_dri, inc_gallium_aux
]
# TODO: fix includes to delete this