dri: Fix hardware cursor for cards without modifier support

After the breaking commit, gbm_bo_create_with_modifiers({LINEAR}) returns
a BO with gbm_bo_get_modifier() = INVALID. This restores the functionality
and fixes most notably, hardware cursors for cards without modifiers.

Fixes #12039.

Fixes: 361f362258 ("dri: Unify createImage and createImageWithModifiers")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31725>
This commit is contained in:
Scott Moreau
2024-10-17 13:37:38 -06:00
committed by Marge Bot
parent c1442030ec
commit 7d1a32fafd

View File

@@ -1077,22 +1077,15 @@ dri_create_image(struct dri_screen *screen,
if (!pscreen->resource_create_with_modifiers && count > 0) {
bool invalid_ok = false;
bool linear_ok = false;
for (unsigned i = 0; i < _count; i++) {
if (modifiers[i] == DRM_FORMAT_MOD_LINEAR)
linear_ok = true;
else if (modifiers[i] == DRM_FORMAT_MOD_INVALID)
if (modifiers[i] == DRM_FORMAT_MOD_INVALID)
invalid_ok = true;
}
if (invalid_ok) {
count = 0;
modifiers = NULL;
} else if (linear_ok) {
count = 0;
modifiers = NULL;
use |= __DRI_IMAGE_USE_LINEAR;
} else {
return NULL;
}