summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-09-10 18:51:35 -0400
committerRob Clark <[email protected]>2014-09-12 16:23:52 -0400
commit480fe244dd41a034111963440a9f51999cfc9035 (patch)
treee3b69fd4810c9acf57c5cd5a67403f65d2e478dd /src/gallium/drivers
parent1fba4905690b9798c4d1e45e9679ea2f3c43ecf8 (diff)
freedreno/a3xx: format fixes
Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_emit.c5
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_util.c8
-rw-r--r--src/gallium/drivers/freedreno/freedreno_util.h12
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 f5bdea2d00b..62e02bc6b2d 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 8b7328a8e74..c921bc2da9e 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 8a084ecd19a..c519e23092e 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_ */