Mesa (master): freedreno/a3xx: format fixes

Rob Clark robclark at kemper.freedesktop.org
Fri Sep 12 20:26:54 UTC 2014


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

Author: Rob Clark <robclark at freedesktop.org>
Date:   Wed Sep 10 18:51:35 2014 -0400

freedreno/a3xx: format fixes

Signed-off-by: Rob Clark <robclark at freedesktop.org>

---

 src/gallium/drivers/freedreno/a3xx/fd3_emit.c  |    5 ++++-
 src/gallium/drivers/freedreno/a3xx/fd3_util.c  |    8 ++++----
 src/gallium/drivers/freedreno/freedreno_util.h |   12 ++++++++++++
 3 files changed, 20 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
index f5bdea2..62e02bc 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c
@@ -242,6 +242,9 @@ emit_textures(struct fd_ringbuffer *ring,
 /* emit texture state for mem->gmem restore operation.. eventually it would
  * be good to get rid of this and use normal CSO/etc state for more of these
  * special cases, but for now the compiler is not sufficient..
+ *
+ * Also, for using normal state, not quite sure how to handle the special
+ * case format (fd3_gmem_restore_format()) stuff for restoring depth/stencil.
  */
 void
 fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring, struct pipe_surface *psurf)
@@ -272,7 +275,7 @@ fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring, struct pipe_surface *psurf
 			CP_LOAD_STATE_0_NUM_UNIT(1));
 	OUT_RING(ring, CP_LOAD_STATE_1_STATE_TYPE(ST_CONSTANTS) |
 			CP_LOAD_STATE_1_EXT_SRC_ADDR(0));
-	OUT_RING(ring, A3XX_TEX_CONST_0_FMT(fd3_pipe2tex(psurf->format)) |
+	OUT_RING(ring, A3XX_TEX_CONST_0_FMT(fd3_pipe2tex(format)) |
 			A3XX_TEX_CONST_0_TYPE(A3XX_TEX_2D) |
 			fd3_tex_swiz(format,  PIPE_SWIZZLE_RED, PIPE_SWIZZLE_GREEN,
 					PIPE_SWIZZLE_BLUE, PIPE_SWIZZLE_ALPHA));
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_util.c b/src/gallium/drivers/freedreno/a3xx/fd3_util.c
index 8b7328a..c921bc2 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_util.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_util.c
@@ -257,13 +257,11 @@ fd3_pipe2tex(enum pipe_format format)
 		return TFMT_NORM_UINT_8_8_8_8;
 
 	case PIPE_FORMAT_Z24X8_UNORM:
-		return TFMT_NORM_UINT_X8Z24;
-
 	case PIPE_FORMAT_Z24_UNORM_S8_UINT:
-		return TFMT_NORM_UINT_8_8_8_8;
+		return TFMT_NORM_UINT_X8Z24;
 
 	case PIPE_FORMAT_Z16_UNORM:
-		return TFMT_NORM_UINT_8_8;
+		return TFMT_NORM_USHORT_Z16;
 
 	case PIPE_FORMAT_R16G16B16A16_FLOAT:
 	case PIPE_FORMAT_R16G16B16X16_FLOAT:
@@ -331,6 +329,8 @@ fd3_pipe2color(enum pipe_format format)
 
 	case PIPE_FORMAT_R8_UNORM:
 	case PIPE_FORMAT_L8_UNORM:
+		return RB_R8_UNORM;
+
 	case PIPE_FORMAT_A8_UNORM:
 		return RB_A8_UNORM;
 
diff --git a/src/gallium/drivers/freedreno/freedreno_util.h b/src/gallium/drivers/freedreno/freedreno_util.h
index 8a084ec..c519e23 100644
--- a/src/gallium/drivers/freedreno/freedreno_util.h
+++ b/src/gallium/drivers/freedreno/freedreno_util.h
@@ -238,4 +238,16 @@ emit_marker(struct fd_ringbuffer *ring, int scratch_idx)
 	OUT_RING(ring, ++marker_cnt);
 }
 
+/* helper to get numeric value from environment variable..  mostly
+ * just leaving this here because it is helpful to brute-force figure
+ * out unknown formats, etc, which blob driver does not support:
+ */
+static inline uint32_t env2u(const char *envvar)
+{
+	char *str = getenv(envvar);
+	if (str)
+		return strtol(str, NULL, 0);
+	return 0;
+}
+
 #endif /* FREEDRENO_UTIL_H_ */




More information about the mesa-commit mailing list