Mesa (main): panfrost: Handle stencil texturing on Valhall

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Apr 7 15:24:27 UTC 2022


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

Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date:   Thu Mar 31 10:21:07 2022 -0400

panfrost: Handle stencil texturing on Valhall

Use a Bifrost compatible path. It's not clear this is optimal but it passes the
tests and is no worse than what we do on Bifrost.

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

---

 src/panfrost/lib/pan_format.c  | 13 ++++++-------
 src/panfrost/lib/pan_texture.c |  4 ++--
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c
index 387e150a455..bcb3ff0d592 100644
--- a/src/panfrost/lib/pan_format.c
+++ b/src/panfrost/lib/pan_format.c
@@ -560,14 +560,13 @@ const struct panfrost_format GENX(panfrost_pipe_format)[PIPE_FORMAT_COUNT] = {
          * determined by the plane descriptor on Valhall.
          *
          * On Valhall, S8 logically acts like "X8S8", so "S8 RGBA" is logically
-         * "0s00" and "S8 GRBA" is logically "s000". For backwards compatibility
-         * we want stencil in the green channel, so we use the RGBA swizzles on
-         * Valhall despite the GRBA swizzles on Bifrost.
+         * "0s00" and "S8 GRBA" is logically "s000". For Bifrost compatibility
+         * we want stencil in the red channel, so we use the GRBA swizzles.
          */
-        FMT(Z32_FLOAT_S8X24_UINT,    R32F,            RGBA, L, _T_Z),
-        FMT(X32_S8X24_UINT,          S8,              RGBA, L, _T__),
-        FMT(X24S8_UINT,              S8,              RGBA, L, _T_Z),
-        FMT(S8_UINT,                 S8,              RGBA, L, _T__),
+        FMT(Z32_FLOAT_S8X24_UINT,    R32F,            GRBA, L, _T_Z),
+        FMT(X32_S8X24_UINT,          S8,              GRBA, L, _T__),
+        FMT(X24S8_UINT,              S8,              GRBA, L, _T_Z),
+        FMT(S8_UINT,                 S8,              GRBA, L, _T__),
 
 #else
         /* Specify real formats on Bifrost */
diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c
index 263bc59cfa2..9a9b5a6d7d5 100644
--- a/src/panfrost/lib/pan_texture.c
+++ b/src/panfrost/lib/pan_texture.c
@@ -858,8 +858,8 @@ GENX(panfrost_new_texture)(const struct panfrost_device *dev,
         enum pipe_format format = iview->format;
         unsigned swizzle;
 
-        if (PAN_ARCH == 7 && util_format_is_depth_or_stencil(format)) {
-                /* v7 doesn't have an _RRRR component order, combine the
+        if (PAN_ARCH >= 7 && util_format_is_depth_or_stencil(format)) {
+                /* v7+ doesn't have an _RRRR component order, combine the
                  * user swizzle with a .XXXX swizzle to emulate that.
                  */
                 static const unsigned char replicate_x[4] = {



More information about the mesa-commit mailing list