panfrost: Add preliminary support for Mali G72

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6885>
diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c
index fd90107..f9dbb3d 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -326,6 +326,8 @@
                                 brts[i].constant = blend[i].equation.constant;
 
                                 brts[i].format = panfrost_format_to_bifrost_blend(format_desc);
+                                if (dev->quirks & HAS_SWIZZLES)
+                                        brts[i].swizzle = panfrost_get_default_swizzle(4);
 
                                 /* 0x19 disables blending and forces REPLACE
                                  * mode (equivalent to rgb_mode = alpha_mode =
diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index 9218187..07c54d4 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1021,6 +1021,7 @@
                 so->bo = panfrost_bo_create(device, size, 0);
 
                 panfrost_new_texture_bifrost(
+                                device,
                                 &so->bifrost_descriptor,
                                 texture->width0, texture->height0,
                                 depth, array_size,
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index bd71b23..e8092af 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -714,6 +714,7 @@
         case 0x820: /* T820 */
         case 0x860: /* T860 */
                 break;
+        case 0x6221: /* G72 */
         case 0x7093: /* G31 */
         case 0x7212: /* G52 */
                 if (dev->debug & PAN_DBG_BIFROST)
diff --git a/src/panfrost/include/panfrost-quirks.h b/src/panfrost/include/panfrost-quirks.h
index 22a79c9..e3aae4f 100644
--- a/src/panfrost/include/panfrost-quirks.h
+++ b/src/panfrost/include/panfrost-quirks.h
@@ -105,6 +105,7 @@
                 return MIDGARD_QUIRKS;
 
         case 0x6000: /* G71 */
+        case 0x6221: /* G72 */
                 return BIFROST_QUIRKS | HAS_SWIZZLES;
 
         case 0x7093: /* G31 */
diff --git a/src/panfrost/lib/pan_props.c b/src/panfrost/lib/pan_props.c
index 7176f9b..831b203 100644
--- a/src/panfrost/lib/pan_props.c
+++ b/src/panfrost/lib/pan_props.c
@@ -146,6 +146,7 @@
         case 0x750: return "Mali T760 (Panfrost)";
         case 0x860: return "Mali T860 (Panfrost)";
         case 0x880: return "Mali T880 (Panfrost)";
+        case 0x6221: return "Mali G72 (Panfrost)";
         case 0x7093: return "Mali G31 (Panfrost)";
         case 0x7212: return "Mali G52 (Panfrost)";
         default:
diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c
index 5a54fd5..4ea05e0 100644
--- a/src/panfrost/lib/pan_texture.c
+++ b/src/panfrost/lib/pan_texture.c
@@ -28,6 +28,7 @@
 #include "util/macros.h"
 #include "util/u_math.h"
 #include "pan_texture.h"
+#include "panfrost-quirks.h"
 
 /* Generates a texture descriptor. Ideally, descriptors are immutable after the
  * texture is created, so we can keep these hanging around in GPU memory in a
@@ -352,6 +353,7 @@
 
 void
 panfrost_new_texture_bifrost(
+        const struct panfrost_device *dev,
         struct mali_bifrost_texture_packed *out,
         uint16_t width, uint16_t height,
         uint16_t depth, uint16_t array_size,
@@ -393,6 +395,9 @@
         pan_pack(out, BIFROST_TEXTURE, cfg) {
                 cfg.dimension = dim;
                 cfg.format = (mali_format << 12) | (srgb << 20);
+                if (dev->quirks & HAS_SWIZZLES)
+	                cfg.format |= panfrost_get_default_swizzle(desc->nr_channels);
+
                 cfg.width = u_minify(width, first_level);
                 cfg.height = u_minify(height, first_level);
                 cfg.swizzle = swizzle;
diff --git a/src/panfrost/lib/pan_texture.h b/src/panfrost/lib/pan_texture.h
index 852c103..fe25f96 100644
--- a/src/panfrost/lib/pan_texture.h
+++ b/src/panfrost/lib/pan_texture.h
@@ -113,6 +113,7 @@
 
 void
 panfrost_new_texture_bifrost(
+        const struct panfrost_device *dev,
         struct mali_bifrost_texture_packed *out,
         uint16_t width, uint16_t height,
         uint16_t depth, uint16_t array_size,