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 <lina@asahilina.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22353>
This commit is contained in:
Asahi Lina 2023-04-05 21:42:14 +09:00 committed by Marge Bot
parent 534a04d557
commit 9fcadd0c8d

View file

@ -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;