Mesa (master): panfrost: Handle PIPE_FORMAT_X24S8_UINT

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 9 17:05:43 UTC 2020


Module: Mesa
Branch: master
Commit: 4c891488342fcfdcb80c88be14732e6190996047
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4c891488342fcfdcb80c88be14732e6190996047

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Fri Jul  3 13:01:16 2020 -0400

panfrost: Handle PIPE_FORMAT_X24S8_UINT

We can treat it as RGBA32UI and swizzle away everything but R, like the
blob does. Maybe not the most efficient thing in the world.

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

---

 src/panfrost/encoder/pan_format.c  |  1 +
 src/panfrost/encoder/pan_texture.c | 10 +++++++++-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/encoder/pan_format.c b/src/panfrost/encoder/pan_format.c
index 30423fa4e48..d7b0b207bab 100644
--- a/src/panfrost/encoder/pan_format.c
+++ b/src/panfrost/encoder/pan_format.c
@@ -140,6 +140,7 @@ struct panfrost_format panfrost_pipe_format_table[PIPE_FORMAT_COUNT] = {
         [PIPE_FORMAT_Z24X8_UNORM]		= { MALI_Z24X8_UNORM, _TZ },
         [PIPE_FORMAT_Z32_FLOAT]		        = { MALI_R32F, _TZ },
         [PIPE_FORMAT_Z32_FLOAT_S8X24_UINT]	= { MALI_R32F, _TZ },
+        [PIPE_FORMAT_X24S8_UINT]		= { MALI_RGBA8UI, _TZ },
 
         [PIPE_FORMAT_R32_FIXED] 		= { MALI_R32_FIXED, _V },
         [PIPE_FORMAT_R32G32_FIXED] 		= { MALI_RG32_FIXED, _V },
diff --git a/src/panfrost/encoder/pan_texture.c b/src/panfrost/encoder/pan_texture.c
index a333dadc079..18f7455442e 100644
--- a/src/panfrost/encoder/pan_texture.c
+++ b/src/panfrost/encoder/pan_texture.c
@@ -241,6 +241,12 @@ panfrost_emit_texture_payload(
         }
 }
 
+#define MALI_SWIZZLE_A001 \
+        (MALI_CHANNEL_ALPHA << 0) | \
+        (MALI_CHANNEL_ZERO << 3) | \
+        (MALI_CHANNEL_ZERO << 6) | \
+        (MALI_CHANNEL_ONE << 9)
+
 void
 panfrost_new_texture(
         void *out,
@@ -275,7 +281,9 @@ panfrost_new_texture(
                 .depth = MALI_POSITIVE(u_minify(depth, first_level)),
                 .array_size = MALI_POSITIVE(array_size),
                 .format = {
-                        .swizzle = panfrost_translate_swizzle_4(desc->swizzle),
+                        .swizzle = (format == PIPE_FORMAT_X24S8_UINT) ?
+                                MALI_SWIZZLE_A001 :
+                                panfrost_translate_swizzle_4(desc->swizzle),
                         .format = mali_format,
                         .srgb = (desc->colorspace == UTIL_FORMAT_COLORSPACE_SRGB),
                         .type = type,



More information about the mesa-commit mailing list