summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@collabora.com>2021-01-13 10:04:02 +0100
committerMarge Bot <eric+marge@anholt.net>2021-01-13 14:01:42 +0000
commit09bf6910b0e7e83e9ad082c0993dcb04a975ccf0 (patch)
treed279ec0f92b2633582d15d6917be4fbd2aca57f2 /src
parent001c1105f1d9f50955731ab1e272fd7f24aa33ad (diff)
panfrost: Fix panfrost_afbc_format_needs_fixup()
This function returns true for PIPE_FORMAT_R8G8B8X8_UNORM, which is wrong. Fixes: 44217be92134 ("panfrost: Adjust the format for AFBC textures on Bifrost v7") Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com> Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8466>
Diffstat (limited to 'src')
-rw-r--r--src/panfrost/lib/pan_afbc.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/panfrost/lib/pan_afbc.c b/src/panfrost/lib/pan_afbc.c
index 50b379daed6..576f67fd970 100644
--- a/src/panfrost/lib/pan_afbc.c
+++ b/src/panfrost/lib/pan_afbc.c
@@ -151,8 +151,16 @@ panfrost_afbc_format_needs_fixup(const struct panfrost_device *dev,
const struct util_format_description *desc =
util_format_description(format);
+ unsigned nr_channels = desc->nr_channels;
+
+ /* rgb1 is a valid component order, don't test channel 3 in that
+ * case.
+ */
+ if (nr_channels == 4 && desc->swizzle[3] == PIPE_SWIZZLE_1)
+ nr_channels = 3;
+
bool identity_swizzle = true;
- for (unsigned c = 0; c < desc->nr_channels; c++) {
+ for (unsigned c = 0; c < nr_channels; c++) {
if (desc->swizzle[c] != c) {
identity_swizzle = false;
break;