From eafd35e458f5dc6d62acd0589e66351d8e173e60 Mon Sep 17 00:00:00 2001 From: Asahi Lina Date: Sat, 29 Jul 2023 20:05:35 +0900 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/asahi/agx_pipe.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 81c0c66..07a4047 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -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; } -- 2.7.4