asahi: Force linear for SHARED buffers with no/implicit modifier

Consumers might not pass through the modifier information in this case.

Fixes XWayland/mutter using dma-buf v4 feedback (though the fact they
try to use implicit modifiers is likely a bug on their end, and will
decrease performance).

Signed-off-by: Asahi Lina <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24635>
This commit is contained in:
Asahi Lina
2023-07-29 20:05:35 +09:00
committed by Marge Bot
parent 3e5d2f0c1b
commit eafd35e458
+5 -4
View File
@@ -483,11 +483,12 @@ agx_select_best_modifier(const struct agx_resource *pres)
if (agx_linear_allowed(pres) && pres->base.usage == PIPE_USAGE_STAGING)
return DRM_FORMAT_MOD_LINEAR;
/* For SCANOUT resources with no explicit modifier selection, assume we need
* linear.
/* For SCANOUT or SHARED resources with no explicit modifier selection, force
* linear since we cannot expect consumers to correctly pass through the
* modifier (unless linear is not allowed at all).
*/
if (pres->base.bind & PIPE_BIND_SCANOUT) {
assert(agx_linear_allowed(pres));
if (agx_linear_allowed(pres) &&
pres->base.bind & (PIPE_BIND_SCANOUT | PIPE_BIND_SHARED)) {
return DRM_FORMAT_MOD_LINEAR;
}