Mesa (staging/19.1): freedreno/a6xx: un-swap X24S8_UINT

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jun 20 08:57:10 UTC 2019


Module: Mesa
Branch: staging/19.1
Commit: 4de4c188419d9589e0b681fb3e398b84b6b23ca3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=4de4c188419d9589e0b681fb3e398b84b6b23ca3

Author: Rob Clark <robdclark at chromium.org>
Date:   Thu Jun 13 11:58:30 2019 -0700

freedreno/a6xx: un-swap X24S8_UINT

The stencil is actually in the .w component, but we used to use SWAP to
remap the channels.  This doesn't work when tiled/ubwc.

Fixes:
  dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_2d_array
  dEQP-GLES31.functional.stencil_texturing.format.depth24_stencil8_cube
  dEQP-GLES31.functional.stencil_texturing.format.stencil_index8_2d_array
  dEQP-GLES31.functional.stencil_texturing.format.stencil_index8_cube
  dEQP-GLES31.functional.stencil_texturing.misc.base_level
  dEQP-GLES31.functional.texture.border_clamp.formats.stencil_index8.nearest_size_pot
  dEQP-GLES31.functional.texture.border_clamp.formats.stencil_index8.nearest_size_npot
  dEQP-GLES31.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_pot
  dEQP-GLES31.functional.texture.border_clamp.formats.depth24_stencil8_sample_stencil.nearest_size_npot
  dEQP-GLES31.functional.texture.border_clamp.sampler.uint_stencil

Signed-off-by: Rob Clark <robdclark at chromium.org>
(cherry picked from commit 4e72abcd9764cb791a6a6a7dcb903c9e23ebbedf)

---

 src/gallium/drivers/freedreno/a6xx/fd6_emit.c   | 7 ++++---
 src/gallium/drivers/freedreno/a6xx/fd6_format.c | 4 ++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
index c5dc72da5c9..f70963ef9bd 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_emit.c
@@ -227,15 +227,16 @@ setup_border_colors(struct fd_texture_stateobj *tex, struct bcolor_entry *entrie
 			/*
 			 * HACK: for PIPE_FORMAT_X24S8_UINT we end up w/ the
 			 * stencil border color value in bc->ui[0] but according
-			 * to desc->swizzle and desc->channel, the .x component
+			 * to desc->swizzle and desc->channel, the .x/.w component
 			 * is NONE and the stencil value is in the y component.
-			 * Meanwhile the hardware wants this in the .x componetn.
+			 * Meanwhile the hardware wants this in the .w component
+			 * for x24s8 and the .x component for x32_s8x24.
 			 */
 			if ((format == PIPE_FORMAT_X24S8_UINT) ||
 					(format == PIPE_FORMAT_X32_S8X24_UINT)) {
 				if (j == 0) {
 					c = 1;
-					cd = 0;
+					cd = (format == PIPE_FORMAT_X32_S8X24_UINT) ? 0 : 3;
 				} else {
 					continue;
 				}
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_format.c b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
index 9448ff18e54..fb480266b0c 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_format.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_format.c
@@ -216,7 +216,7 @@ static struct fd6_format formats[PIPE_FORMAT_COUNT] = {
 	_T(R9G9B9E5_FLOAT,  9_9_9_E5_FLOAT, NONE,            WZYX),
 
 	_T(Z24X8_UNORM,       X8Z24_UNORM,  X8Z24_UNORM,   WZYX),
-	_T(X24S8_UINT,        8_8_8_8_UINT, X8Z24_UNORM,   XYZW),  // XXX
+	_T(X24S8_UINT,        8_8_8_8_UINT, X8Z24_UNORM,   WZYX),
 	_T(Z24_UNORM_S8_UINT, X8Z24_UNORM,  X8Z24_UNORM,   WZYX),
 	_T(Z32_FLOAT,         32_FLOAT,     R32_FLOAT,     WZYX),
 	_T(Z32_FLOAT_S8X24_UINT, 32_FLOAT,  R32_FLOAT,     WZYX),
@@ -450,7 +450,7 @@ fd6_tex_swiz(enum pipe_format format, unsigned char *swiz,
 	 */
 	if (format == PIPE_FORMAT_X24S8_UINT) {
 		const unsigned char stencil_swiz[4] = {
-			PIPE_SWIZZLE_X, PIPE_SWIZZLE_X, PIPE_SWIZZLE_X, PIPE_SWIZZLE_X
+			PIPE_SWIZZLE_W, PIPE_SWIZZLE_W, PIPE_SWIZZLE_W, PIPE_SWIZZLE_W
 		};
 		util_format_compose_swizzles(stencil_swiz, uswiz, swiz);
 	} else if (fd6_pipe2swap(format) != WZYX) {




More information about the mesa-commit mailing list