Files
Mesa/U_gbm-fix-get_back_bo-failure-with-gbm_surface-and-imp.patch

48 lines
1.7 KiB
Diff

From 5a19323d0e3969de24ea6bd89ba62f2a5c37296e Mon Sep 17 00:00:00 2001
From: Simon Ser <contact@emersion.fr>
Date: Thu, 19 Dec 2024 17:35:46 +0100
Subject: [PATCH] gbm: fix get_back_bo() failure with gbm_surface and implicit
modifiers
Before 361f3622587e ("dri: Unify createImage and
createImageWithModifiers"), gbm_surface_create_with_modifiers() would
fail with ENOSYS on drivers missing explicit modifiers support. After
that commit, it succeeds and fails later when it tries to allocate a
new back buffer.
Restore the previous behavior.
Signed-off-by: Simon Ser <contact@emersion.fr>
Fixes: 105fcb9cfdb4 ("dri: revert INVALID modifier special-casing")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/12283
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32726>
---
src/gbm/backends/dri/gbm_dri.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/gbm/backends/dri/gbm_dri.c b/src/gbm/backends/dri/gbm_dri.c
index 9e2761c33b0..316b251dd74 100644
--- a/src/gbm/backends/dri/gbm_dri.c
+++ b/src/gbm/backends/dri/gbm_dri.c
@@ -1078,11 +1078,17 @@ gbm_dri_surface_create(struct gbm_device *gbm,
uint32_t format, uint32_t flags,
const uint64_t *modifiers, const unsigned count)
{
+ struct gbm_dri_device *dri = gbm_dri_device(gbm);
struct gbm_dri_surface *surf;
if (count)
assert(modifiers);
+ if (count > 0 && !dri->screen->base.screen->resource_create_with_modifiers) {
+ errno = ENOSYS;
+ return NULL;
+ }
+
/* It's acceptable to create an image with INVALID modifier in the list,
* but it cannot be on the only modifier (since it will certainly fail
* later). While we could easily catch this after modifier creation, doing
--
2.43.0