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:
129d83cac2a ("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>
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;
+ }
}
}
}