Mesa (main): panfrost: Add LINEAR debug option

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Aug 11 18:14:05 UTC 2021


Module: Mesa
Branch: main
Commit: 3ec5e2b6a7082a277035e8a9dc58f03b23fe9280
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=3ec5e2b6a7082a277035e8a9dc58f03b23fe9280

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Wed Aug 11 10:50:44 2021 -0400

panfrost: Add LINEAR debug option

Useful to cross off CPU texture tiling as the source of bugs.

Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12328>

---

 src/gallium/drivers/panfrost/pan_resource.c | 4 ++++
 src/gallium/drivers/panfrost/pan_screen.c   | 1 +
 src/panfrost/lib/pan_util.h                 | 1 +
 3 files changed, 6 insertions(+)

diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index 59140578097..6d8af181773 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -407,6 +407,10 @@ panfrost_best_modifier(struct panfrost_device *dev,
                        const struct panfrost_resource *pres,
                        enum pipe_format fmt)
 {
+        /* Force linear textures when debugging tiling/compression */
+        if (unlikely(dev->debug & PAN_DBG_LINEAR))
+                return DRM_FORMAT_MOD_LINEAR;
+
         if (panfrost_should_afbc(dev, pres, fmt)) {
                 uint64_t afbc =
                         AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index a7289440e5f..850d83af8be 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -69,6 +69,7 @@ static const struct debug_named_value panfrost_debug_options[] = {
         {"nocrc",     PAN_DBG_NO_CRC,   "Disable transaction elimination"},
         {"msaa16",    PAN_DBG_MSAA16,   "Enable MSAA 8x and 16x support"},
         {"noindirect", PAN_DBG_NOINDIRECT, "Emulate indirect draws on the CPU"},
+        {"linear",    PAN_DBG_LINEAR,   "Force linear textures"},
         DEBUG_NAMED_VALUE_END
 };
 
diff --git a/src/panfrost/lib/pan_util.h b/src/panfrost/lib/pan_util.h
index 64129846074..7a84633d303 100644
--- a/src/panfrost/lib/pan_util.h
+++ b/src/panfrost/lib/pan_util.h
@@ -40,6 +40,7 @@
 #define PAN_DBG_NO_AFBC         0x0200
 #define PAN_DBG_MSAA16          0x0400
 #define PAN_DBG_NOINDIRECT      0x0800
+#define PAN_DBG_LINEAR          0x1000
 
 unsigned
 panfrost_translate_swizzle_4(const unsigned char swizzle[4]);



More information about the mesa-commit mailing list