From e3ef541f9535476fa6a37064129e1774487de50e Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Wed, 14 Apr 2021 11:08:03 +0200 Subject: [PATCH] panfrost: Don't advertise AFBC mods when the format is not supported On Bifrost, AFBC is not supported if the format has a non-identity swizzle. For internal resources we fix the format at runtime, but this fixup is not applicable when we export the resource. Don't advertise AFBC modifiers on such formats. Fixes: 44217be92134 ("panfrost: Adjust the format for AFBC textures on Bifrost v7") Cc: mesa-stable Signed-off-by: Boris Brezillon Acked-by: Daniel Stone Reviewed-by: Alyssa Rosenzweig Part-of: (cherry picked from commit 660b4d6e25011a2479538928419eed981a4cdf2f) --- .pick_status.json | 2 +- src/gallium/drivers/panfrost/pan_screen.c | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.pick_status.json b/.pick_status.json index f50a106538d..55c7780eb69 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -1516,7 +1516,7 @@ "description": "panfrost: Don't advertise AFBC mods when the format is not supported", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "master_sha": null, "because_sha": "44217be92134b03e7426860b42918b1d4602e08e" }, diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c index 0ad365e602e..9ed17ddbfc7 100644 --- a/src/gallium/drivers/panfrost/pan_screen.c +++ b/src/gallium/drivers/panfrost/pan_screen.c @@ -560,6 +560,14 @@ panfrost_walk_dmabuf_modifiers(struct pipe_screen *screen, /* Don't advertise AFBC before T760 */ afbc &= !(dev->quirks & MIDGARD_NO_AFBC); + /* On Bifrost, AFBC is not supported if the format has a non-identity + * swizzle. For internal resources we fix the format at runtime, but + * this fixup is not applicable when we export the resource. Don't + * advertise AFBC modifiers on such formats. + */ + if (panfrost_afbc_format_needs_fixup(dev, format)) + afbc = false; + unsigned count = 0; for (unsigned i = 0; i < PAN_MODIFIER_COUNT; ++i) {