freedreno/a3xx: format fixes
authorRob Clark <robclark@freedesktop.org>
Wed, 10 Sep 2014 22:51:35 +0000 (18:51 -0400)
committerRob Clark <robclark@freedesktop.org>
Fri, 12 Sep 2014 20:23:52 +0000 (16:23 -0400)
Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/gallium/drivers/freedreno/a3xx/fd3_emit.c
src/gallium/drivers/freedreno/a3xx/fd3_util.c
src/gallium/drivers/freedreno/freedreno_util.h

index f5bdea2d00b279ce6c735f33273a92d1daf7d0bc..62e02bc6b2dbdf95c64328b82b3dd9f7a95b60b4 100644 (file)
@@ -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));
index 8b7328a8e74052d621f09e0f72845991e152ebd1..c921bc2da9eaa6c3cff224a66942dc1b657326cf 100644 (file)
@@ -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;
 
index 8a084ecd19a8890e29887c198c19a08bee863d2d..c519e23092e025b4a14f8cab1b77706170f498a9 100644 (file)
@@ -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_ */