gbm: fix get_back_bo() failure with gbm_surface and implicit modifiers

Before 361f362258 ("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: 105fcb9cfd ("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>
This commit is contained in:
Simon Ser
2024-12-19 17:35:46 +01:00
committed by Marge Bot
parent d926704183
commit 5a19323d0e

View File

@@ -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