summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItalo Nicola <italonicola@collabora.com>2023-06-28 22:25:26 +0000
committerMarge Bot <emma+marge@anholt.net>2023-08-07 19:35:13 +0000
commit109a6b8cd72e2cb370fd0988ab5d55d095bd5847 (patch)
tree34cd729e051f7cca7665c01929af370710e172dc
parentbba74a84a96d97290411e93d8a32fd2d5e686d76 (diff)
panfrost: add PAN_MESA_DEBUG=yuv for debugging yuv sampler
Signed-off-by: Italo Nicola <italonicola@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21109>
-rw-r--r--src/gallium/drivers/panfrost/pan_screen.c1
-rw-r--r--src/panfrost/lib/pan_texture.c10
-rw-r--r--src/panfrost/lib/pan_util.h2
3 files changed, 13 insertions, 0 deletions
diff --git a/src/gallium/drivers/panfrost/pan_screen.c b/src/gallium/drivers/panfrost/pan_screen.c
index 18e5737caf9..0286c01e7bb 100644
--- a/src/gallium/drivers/panfrost/pan_screen.c
+++ b/src/gallium/drivers/panfrost/pan_screen.c
@@ -71,6 +71,7 @@ static const struct debug_named_value panfrost_debug_options[] = {
#ifdef PAN_DBG_OVERFLOW
{"overflow", PAN_DBG_OVERFLOW, "Check for buffer overflows in pool uploads"},
#endif
+ {"yuv", PAN_DBG_YUV, "Tint YUV textures with blue for 1-plane and green for 2-plane"},
DEBUG_NAMED_VALUE_END
};
/* clang-format on */
diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c
index 49d4c0f7473..19d9f97cd95 100644
--- a/src/panfrost/lib/pan_texture.c
+++ b/src/panfrost/lib/pan_texture.c
@@ -670,6 +670,16 @@ GENX(panfrost_new_texture)(const struct panfrost_device *dev,
memcpy(swizzle, iview->swizzle, sizeof(swizzle));
}
+ if ((dev->debug & PAN_DBG_YUV) && PAN_ARCH == 7 &&
+ panfrost_needs_multiplanar_descriptor(desc->layout)) {
+ if (desc->layout == UTIL_FORMAT_LAYOUT_SUBSAMPLED) {
+ swizzle[2] = PIPE_SWIZZLE_1;
+ } else if (desc->layout == UTIL_FORMAT_LAYOUT_PLANAR2) {
+ swizzle[1] = PIPE_SWIZZLE_0;
+ swizzle[2] = PIPE_SWIZZLE_0;
+ }
+ }
+
panfrost_emit_texture_payload(iview, format, payload->cpu);
unsigned array_size = iview->last_layer - iview->first_layer + 1;
diff --git a/src/panfrost/lib/pan_util.h b/src/panfrost/lib/pan_util.h
index d73f17ab666..03ada217c30 100644
--- a/src/panfrost/lib/pan_util.h
+++ b/src/panfrost/lib/pan_util.h
@@ -52,6 +52,8 @@
#define PAN_DBG_OVERFLOW 0x8000
#endif
+#define PAN_DBG_YUV 0x20000
+
struct panfrost_device;
unsigned panfrost_translate_swizzle_4(const unsigned char swizzle[4]);