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