gbm: use driver check for dmabuf export

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:33:36 -04:00
committed by Marge Bot
parent 9ec286b037
commit ab08b79ef7
2 changed files with 4 additions and 1 deletions

View File

@@ -898,7 +898,7 @@ gbm_dri_bo_create(struct gbm_device *gbm,
format = gbm_core.v0.format_canonicalize(format);
if (usage & GBM_BO_USE_WRITE || dri->image == NULL)
if (usage & GBM_BO_USE_WRITE || !dri->has_dmabuf_export)
return create_dumb(gbm, width, height, format, usage);
bo = calloc(1, sizeof *bo);
@@ -1243,6 +1243,8 @@ dri_device_create(int fd, uint32_t gbm_backend_version)
#ifdef HAVE_DRI3
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_IMPORT)
dri->has_dmabuf_import = true;
if (pscreen->get_param(pscreen, PIPE_CAP_DMABUF) & DRM_PRIME_CAP_EXPORT)
dri->has_dmabuf_export = true;
#endif
dri->has_compression_modifiers = pscreen->query_compression_rates &&
pscreen->query_compression_modifiers;

View File

@@ -53,6 +53,7 @@ struct gbm_dri_device {
bool software; /* A software driver was loaded */
bool swrast; /* this is swrast */
bool has_dmabuf_import;
bool has_dmabuf_export;
bool has_compression_modifiers;
__DRIscreen *screen;