freedreno/a3xx: format fixes

Signed-off-by: Rob Clark <robclark@freedesktop.org>
This commit is contained in:
Rob Clark
2014-09-10 18:51:35 -04:00
parent 1fba490569
commit 480fe244dd
3 changed files with 20 additions and 5 deletions
@@ -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));
@@ -257,13 +257,11 @@ fd3_pipe2tex(enum pipe_format format)
return TFMT_NORM_UINT_8_8_8_8;
case PIPE_FORMAT_Z24X8_UNORM:
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
return TFMT_NORM_UINT_X8Z24;
case PIPE_FORMAT_Z24_UNORM_S8_UINT:
return TFMT_NORM_UINT_8_8_8_8;
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;
@@ -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_ */