nouveau: treat DRM_FORMAT_INVALID as implicit modifier

Failing to allocate resources when DRM_FORMAT_INVALID
is passed as a modifier breaks tegra. Change this behaviour
so that this modifier is instead interpreted as a don't care,
allowing for the driver to choose an appropriate modifier internally.

v2: change nouveau instead of tegra (Thierry Rieding)

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6693
Fixes: 129d83cac2 ("nouveau: Use format modifiers in buffer allocation")
Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18649>
(cherry picked from commit 941c70a28a)
This commit is contained in:
Diogo Ivo
2022-09-23 14:40:34 +01:00
committed by Dylan Baker
parent 87f92ebdd5
commit beb3819d66
2 changed files with 7 additions and 4 deletions

View File

@@ -922,7 +922,7 @@
"description": "nouveau: treat DRM_FORMAT_INVALID as implicit modifier",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "129d83cac2accc4a66eae50c19ac245b864dc98c"
},

View File

@@ -423,9 +423,12 @@ nvc0_miptree_select_best_modifier(struct pipe_screen *pscreen,
for (i = 0u; i < count; i++) {
for (p = 0; p < ARRAY_SIZE(prio_supported_mods); p++) {
if (prio_supported_mods[p] == modifiers[i]) {
if (top_mod_slot > p) top_mod_slot = p;
break;
if (prio_supported_mods[p] != DRM_FORMAT_MOD_INVALID) {
if (modifiers[i] == DRM_FORMAT_MOD_INVALID ||
prio_supported_mods[p] == modifiers[i]) {
if (top_mod_slot > p) top_mod_slot = p;
break;
}
}
}
}