panfrost: Add a debug flag to disable AFBC

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7076>
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index e8092af..704d129 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -65,6 +65,7 @@
         {"nofp16",     PAN_DBG_NOFP16,     "Disable 16-bit support"},
         {"bifrost",   PAN_DBG_BIFROST, "Enable experimental Mali G31 and G52 support"},
         {"gl3",       PAN_DBG_GL3,      "Enable experimental GL 3.x implementation, up to 3.3"},
+        {"noafbc",    PAN_DBG_NO_AFBC,  "Disable AFBC support"},
         DEBUG_NAMED_VALUE_END
 };
 
@@ -695,6 +696,9 @@
 
         dev->debug = debug_get_flags_option("PAN_MESA_DEBUG", debug_options, 0);
 
+        if (dev->debug & PAN_DBG_NO_AFBC)
+                dev->quirks |= MIDGARD_NO_AFBC;
+
         if (ro) {
                 dev->ro = renderonly_dup(ro);
                 if (!dev->ro) {
diff --git a/src/panfrost/lib/pan_util.h b/src/panfrost/lib/pan_util.h
index 5f40fc9..740cc26 100644
--- a/src/panfrost/lib/pan_util.h
+++ b/src/panfrost/lib/pan_util.h
@@ -37,5 +37,6 @@
 #define PAN_DBG_NOFP16          0x0040
 #define PAN_DBG_BIFROST         0x0080
 #define PAN_DBG_GL3             0x0100
+#define PAN_DBG_NO_AFBC         0x0200
 
 #endif /* PAN_UTIL_H */