From: Asahi Lina Date: Wed, 5 Apr 2023 12:42:14 +0000 (+0900) Subject: asahi: Allow explicit non-LINEAR modifiers for scanout X-Git-Tag: upstream/23.3.3~10311 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9fcadd0c8d5265459a094d849db42c18d7cda931;p=platform%2Fupstream%2Fmesa.git asahi: Allow explicit non-LINEAR modifiers for scanout The compositor is responsible for picking the right supported modifiers for scanout. If we get no modifiers, we have to assume linear, but if we do, just roll with it and don't attempt to force things. Signed-off-by: Asahi Lina Part-of: --- diff --git a/src/gallium/drivers/asahi/agx_pipe.c b/src/gallium/drivers/asahi/agx_pipe.c index 08360cb..cc29a79 100644 --- a/src/gallium/drivers/asahi/agx_pipe.c +++ b/src/gallium/drivers/asahi/agx_pipe.c @@ -372,8 +372,7 @@ static bool agx_twiddled_allowed(const struct agx_resource *pres) { /* Certain binds force linear */ - if (pres->base.bind & - (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_SCANOUT | PIPE_BIND_LINEAR)) + if (pres->base.bind & (PIPE_BIND_DISPLAY_TARGET | PIPE_BIND_LINEAR)) return false; /* Buffers must be linear */ @@ -464,6 +463,14 @@ 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. + */ + if (pres->base.bind & PIPE_BIND_SCANOUT) { + assert(agx_linear_allowed(pres)); + return DRM_FORMAT_MOD_LINEAR; + } + if (agx_twiddled_allowed(pres)) { if (agx_compression_allowed(pres)) return DRM_FORMAT_MOD_APPLE_TWIDDLED_COMPRESSED;