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

Author: Boris Brezillon <[email protected]>
Date:   Tue May  4 08:44:35 2021 +0200

panfrost: Fix format definitions to match gallium expectations

Gallium wants the depth or stencil component replicated on all .XYZW.
That's easily done on pre-v7 since we can forge all the swizzles we
want, but Bifrost v7 only supports a few combinations, so we have to
combine the user swizzle with our own 'replicate' swizzle to make it
work. Note that v7 has a trick to make border color work when the GRBA
order is chosen: they apply the red border color to the green component.

Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Alyssa Rosenzweig <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10612>

---

 .../panfrost/ci/deqp-panfrost-g52-fails.txt        | 31 ----------------------
 src/panfrost/lib/pan_format.c                      | 23 ++++++++--------
 src/panfrost/lib/pan_texture.c                     | 20 +++++++++++++-
 3 files changed, 31 insertions(+), 43 deletions(-)

diff --git a/src/gallium/drivers/panfrost/ci/deqp-panfrost-g52-fails.txt 
b/src/gallium/drivers/panfrost/ci/deqp-panfrost-g52-fails.txt
index 8f7cfc34ad2..03801b33ca0 100644
--- a/src/gallium/drivers/panfrost/ci/deqp-panfrost-g52-fails.txt
+++ b/src/gallium/drivers/panfrost/ci/deqp-panfrost-g52-fails.txt
@@ -58,34 +58,3 @@ dEQP-GLES31.functional.separate_shader.random.79,Fail
 dEQP-GLES31.functional.separate_shader.random.80,Fail
 dEQP-GLES31.functional.separate_shader.random.82,Fail
 dEQP-GLES31.functional.separate_shader.random.89,Fail
-dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_2d_array,Fail
-dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_2d,Fail
-dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_cube,Fail
-dEQP-GLES31.functional.stencil_texturing.format.depth32f_stencil8_2d_array,Fail
-dEQP-GLES31.functional.stencil_texturing.format.depth32f_stencil8_2d,Fail
-dEQP-GLES31.functional.stencil_texturing.format.depth32f_stencil8_cube,Fail
-dEQP-GLES31.functional.stencil_texturing.format.stencil_index8_2d_array,Fail
-dEQP-GLES31.functional.stencil_texturing.format.stencil_index8_2d,Fail
-dEQP-GLES31.functional.stencil_texturing.format.stencil_index8_cube,Fail
-dEQP-GLES31.functional.stencil_texturing.misc.base_level,Fail
-dEQP-GLES31.functional.stencil_texturing.misc.compare_mode_effect,Fail
-dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_clear,Fail
-dEQP-GLES31.functional.stencil_texturing.render.depth24_stencil8_draw,Fail
-dEQP-GLES31.functional.stencil_texturing.render.depth32f_stencil8_clear,Fail
-dEQP-GLES31.functional.stencil_texturing.render.depth32f_stencil8_draw,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.depth32f_stencil8_sample_stencil.nearest_size_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.stencil_index8.nearest_size_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.formats.stencil_index8.nearest_size_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_clamp_to_edge_t_clamp_to_border_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_clamp_to_edge_t_clamp_to_border_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_mirrored_repeat_t_clamp_to_border_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_mirrored_repeat_t_clamp_to_border_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_repeat_t_clamp_to_border_npot,Fail
-dEQP-GLES31.functional.texture.border_clamp.per_axis_wrap_mode.texture_2d.uint_stencil.nearest.s_repeat_t_clamp_to_border_pot,Fail
-dEQP-GLES31.functional.texture.border_clamp.sampler.uint_stencil,Fail
-dEQP-GLES31.functional.texture.border_clamp.unused_channels.depth24_stencil8_sample_stencil,Fail
-dEQP-GLES31.functional.texture.border_clamp.unused_channels.depth32f_stencil8_sample_stencil,Fail
-dEQP-GLES31.functional.texture.border_clamp.unused_channels.stencil_index8,Fail
diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c
index d7519edb641..1a612fde5c3 100644
--- a/src/panfrost/lib/pan_format.c
+++ b/src/panfrost/lib/pan_format.c
@@ -109,6 +109,7 @@ const struct pan_blendable_format 
panfrost_blendable_formats[PIPE_FORMAT_COUNT]
 #define V6_000R PAN_V6_SWIZZLE(0, 0, 0, R)
 #define V6_0R00 PAN_V6_SWIZZLE(0, R, 0, 0)
 #define V6_0A00 PAN_V6_SWIZZLE(0, A, 0, 0)
+#define V6_AAAA PAN_V6_SWIZZLE(A, A, A, A)
 #define V6_A001 PAN_V6_SWIZZLE(A, 0, 0, 1)
 #define V6_ABG1 PAN_V6_SWIZZLE(A, B, G, 1)
 #define V6_ABGR PAN_V6_SWIZZLE(A, B, G, R)
@@ -251,14 +252,14 @@ const struct panfrost_format 
panfrost_pipe_format_v6[PIPE_FORMAT_COUNT] = {
         PAN_V6(R32G32B32_SSCALED,       RGB32I,          RGB1, L, V___),
         PAN_V6(R32G32B32A32_SSCALED,    RGBA32I,         RGBA, L, V___),
         PAN_V6(R3G3B2_UNORM,            RGB332_UNORM,    RGB1, L, VT__),
-        PAN_V6(Z16_UNORM,               R16_UNORM,       R000, L, _T_Z),
-        PAN_V6(Z24_UNORM_S8_UINT,       Z24X8_UNORM,     R000, L, _T_Z),
-        PAN_V6(Z24X8_UNORM,             Z24X8_UNORM,     R000, L, _T_Z),
-        PAN_V6(Z32_FLOAT,               R32F,            R000, L, _T_Z),
-        PAN_V6(Z32_FLOAT_S8X24_UINT,    R32F,            R000, L, _T_Z),
-        PAN_V6(X32_S8X24_UINT,          R32UI,           0R00, L, _T__),
-        PAN_V6(X24S8_UINT,              RGBA8UI,         0A00, L, _T_Z),
-        PAN_V6(S8_UINT,                 R8UI,            0R00, L, _T__),
+        PAN_V6(Z16_UNORM,               R16_UNORM,       RRRR, L, _T_Z),
+        PAN_V6(Z24_UNORM_S8_UINT,       Z24X8_UNORM,     RRRR, L, _T_Z),
+        PAN_V6(Z24X8_UNORM,             Z24X8_UNORM,     RRRR, L, _T_Z),
+        PAN_V6(Z32_FLOAT,               R32F,            RRRR, L, _T_Z),
+        PAN_V6(Z32_FLOAT_S8X24_UINT,    R32F,            RRRR, L, _T_Z),
+        PAN_V6(X32_S8X24_UINT,          R32UI,           RRRR, L, _T__),
+        PAN_V6(X24S8_UINT,              RGBA8UI,         AAAA, L, _T_Z),
+        PAN_V6(S8_UINT,                 R8UI,            RRRR, L, _T__),
         PAN_V6(R32_FIXED,               R32_FIXED,       R001, L, V___),
         PAN_V6(R32G32_FIXED,            RG32_FIXED,      RG01, L, V___),
         PAN_V6(R32G32B32_FIXED,         RGB32_FIXED,     RGB1, L, V___),
@@ -508,9 +509,9 @@ const struct panfrost_format 
panfrost_pipe_format_v7[PIPE_FORMAT_COUNT] = {
         PAN_V7(Z24X8_UNORM,             Z24X8_UNORM,     RGBA, L, _T_Z),
         PAN_V7(Z32_FLOAT,               R32F,            RGBA, L, _T_Z),
         PAN_V7(Z32_FLOAT_S8X24_UINT,    R32F,            RGBA, L, _T_Z),
-        PAN_V7(X32_S8X24_UINT,          S8X24,           RGBA, L, _T__),
-        PAN_V7(X24S8_UINT,              TILEBUFFER_NATIVE /* XXX: Deduplicate 
enum */, RGBA, L, _T_Z),
-        PAN_V7(S8_UINT,                 S8,              RGBA, L, _T__),
+        PAN_V7(X32_S8X24_UINT,          S8X24,           GRBA, L, _T__),
+        PAN_V7(X24S8_UINT,              TILEBUFFER_NATIVE /* XXX: Deduplicate 
enum */, GRBA, L, _T_Z),
+        PAN_V7(S8_UINT,                 S8,              GRBA, L, _T__),
         PAN_V7(R32_FIXED,               R32_FIXED,       RGB1, L, V___),
         PAN_V7(R32G32_FIXED,            RG32_FIXED,      RGB1, L, V___),
         PAN_V7(R32G32B32_FIXED,         RGB32_FIXED,     RGB1, L, V___),
diff --git a/src/panfrost/lib/pan_texture.c b/src/panfrost/lib/pan_texture.c
index b42efa68af1..8e00da01446 100644
--- a/src/panfrost/lib/pan_texture.c
+++ b/src/panfrost/lib/pan_texture.c
@@ -415,12 +415,30 @@ panfrost_new_texture(const struct panfrost_device *dev,
                      void *out, const struct panfrost_ptr *payload)
 {
         const struct pan_image_layout *layout = &iview->image->layout;
-        unsigned swizzle = panfrost_translate_swizzle_4(iview->swizzle);
         enum pipe_format format = iview->format;
+        unsigned swizzle;
 
         if (drm_is_afbc(layout->modifier))
                 format = panfrost_afbc_format_fixup(dev, format);
 
+        if (dev->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] = {
+                        PIPE_SWIZZLE_X, PIPE_SWIZZLE_X,
+                        PIPE_SWIZZLE_X, PIPE_SWIZZLE_X,
+                };
+                unsigned char patched_swizzle[4];
+
+                util_format_compose_swizzles(replicate_x,
+                                             iview->swizzle,
+                                             patched_swizzle);
+                swizzle = panfrost_translate_swizzle_4(patched_swizzle);
+        } else {
+                swizzle = panfrost_translate_swizzle_4(iview->swizzle);
+        }
+
         bool manual_stride =
                 panfrost_needs_explicit_stride(dev, iview);
 

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to