From f159ff530e1fafe2ca40afe7f3b938607341f568 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 13 Dec 2022 20:12:58 -0500 Subject: [PATCH] panfrost: Allow swizzled AFBC on v9+ On v6 and earlier, the hardware supports arbitrary format swizzles for AFBC, so there's no restriction on AFBC. On v8 and newer, the format swizzle gets applied to the *decompressed* interchange format, so we can effectively support BGRA of AFBC images without any special handling. (Confirmed working on v9. Obviously I can't test on v8 but the expression is cleaner if we assume optimistically it's like v9. Without hardware, we get to make that assumption :-p) That just leaves v7 as the only architecture where format swizzles are restricted for compression but there are no plane descriptor. Don't apply the restriction to the newer parts. This gets us AFBC of window surfaces on v9+. As the limiting case, fullscreen glmark2-es2-wayland -btexture (1080p) in sway on Mali-G57 from 1300fps to 2353fps. 45% reduction in frame time is nothing to sneeze at. Achoo. Signed-off-by: Alyssa Rosenzweig Reviewed-by: Boris Brezillon Part-of: --- src/panfrost/lib/pan_afbc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/panfrost/lib/pan_afbc.c b/src/panfrost/lib/pan_afbc.c index 42540a7..83225d9 100644 --- a/src/panfrost/lib/pan_afbc.c +++ b/src/panfrost/lib/pan_afbc.c @@ -139,8 +139,8 @@ panfrost_afbc_format(unsigned arch, enum pipe_format format) */ format = util_format_linear(format); - /* Don't allow swizzled formats on v7+ */ - if (arch >= 7 && format != unswizzled_format(format)) + /* Don't allow swizzled formats on v7 */ + if (arch == 7 && format != unswizzled_format(format)) return PAN_AFBC_MODE_INVALID; /* Otherwise swizzling doesn't affect AFBC */ -- 2.7.4