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: 44217be921 ("panfrost: Adjust the format for AFBC textures on Bifrost v7")
Cc: mesa-stable
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10233>
(cherry picked from commit 660b4d6e25)
This commit is contained in:
Boris Brezillon 2021-04-14 11:08:03 +02:00 committed by Dylan Baker
parent 93169249b7
commit 2aeb7c0cc4
2 changed files with 9 additions and 1 deletions

View file

@ -1192,7 +1192,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"
},

View file

@ -529,6 +529,14 @@ panfrost_walk_dmabuf_modifiers(struct pipe_screen *screen,
struct panfrost_device *dev = pan_device(screen);
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) {