From 5fdfd8044d77517e77c768e60d55999a82853b3a Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 12 Jan 2023 17:58:29 -0500 Subject: [PATCH] panfrost: Don't use AFBC of sRGB luminance-alpha This isn't allowed for the same reason that AFBC of regular luminance-alpha isn't allowed (and will raise DATA_INVALID_FAULTs). Reorder the checks to ensure these formats are checked. Fixes Piglit texwrap GL_EXT_texture_sRGB-s3tc. Fixes: 476be5cb273 ("panfrost: Don't use texture format swizzles on v7") Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/lib/pan_afbc.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/panfrost/lib/pan_afbc.c b/src/panfrost/lib/pan_afbc.c index 97ff6dc70e5..fed4c54f8ef 100644 --- a/src/panfrost/lib/pan_afbc.c +++ b/src/panfrost/lib/pan_afbc.c @@ -118,6 +118,13 @@ unswizzled_format(enum pipe_format format) enum pan_afbc_mode panfrost_afbc_format(unsigned arch, enum pipe_format format) { + /* sRGB does not change the pixel format itself, only the + * interpretation. The interpretation is handled by conversion hardware + * independent to the compression hardware, so we can compress sRGB + * formats by using the corresponding linear format. + */ + format = util_format_linear(format); + /* Luminance-alpha not supported for AFBC on v7+ */ switch (format) { case PIPE_FORMAT_A8_UNORM: @@ -132,13 +139,6 @@ panfrost_afbc_format(unsigned arch, enum pipe_format format) break; } - /* sRGB does not change the pixel format itself, only the - * interpretation. The interpretation is handled by conversion hardware - * independent to the compression hardware, so we can compress sRGB - * formats by using the corresponding linear format. - */ - format = util_format_linear(format); - /* We handle swizzling orthogonally to AFBC */ format = unswizzled_format(format);