From 21dfa8e4864ad00e1d0b6ff671893c4229219a3a Mon Sep 17 00:00:00 2001 From: Jonathan Marek Date: Wed, 4 Sep 2019 15:23:27 -0400 Subject: freedreno/a2xx: fix depth gmem restore Use fd_gmem_restore_format() to avoid trying to use unsupported Z24S8/Z16 render formats for gmem restore. Also apply this change to gmem2mem so it doesn't depend on fd2_pipe2color working with depth formats. gmem2mem/mem2gmem also doesn't need to use the swap/swizzle, since dst/src formats are the same. Signed-off-by: Jonathan Marek Reviewed-by: Rob Clark --- src/gallium/drivers/freedreno/a2xx/fd2_gmem.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) (limited to 'src/gallium/drivers') diff --git a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c index 34595ecbc8f..82dc535a3fc 100644 --- a/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c +++ b/src/gallium/drivers/freedreno/a2xx/fd2_gmem.c @@ -89,11 +89,11 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base, { struct fd_ringbuffer *ring = batch->tile_fini; struct fd_resource *rsc = fd_resource(psurf->texture); - uint32_t swap = fmt2swap(psurf->format); struct fd_resource_slice *slice = fd_resource_slice(rsc, psurf->u.tex.level); uint32_t offset = fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer); + enum pipe_format format = fd_gmem_restore_format(psurf->format); assert((slice->pitch & 31) == 0); assert((offset & 0xfff) == 0); @@ -103,9 +103,8 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base, OUT_PKT3(ring, CP_SET_CONSTANT, 2); OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_INFO)); - OUT_RING(ring, A2XX_RB_COLOR_INFO_SWAP(swap) | - A2XX_RB_COLOR_INFO_BASE(base) | - A2XX_RB_COLOR_INFO_FORMAT(fd2_pipe2color(psurf->format))); + OUT_RING(ring, A2XX_RB_COLOR_INFO_BASE(base) | + A2XX_RB_COLOR_INFO_FORMAT(fd2_pipe2color(format))); OUT_PKT3(ring, CP_SET_CONSTANT, 5); OUT_RING(ring, CP_REG(REG_A2XX_RB_COPY_CONTROL)); @@ -113,9 +112,8 @@ emit_gmem2mem_surf(struct fd_batch *batch, uint32_t base, OUT_RELOCW(ring, rsc->bo, offset, 0, 0); /* RB_COPY_DEST_BASE */ OUT_RING(ring, slice->pitch >> 5); /* RB_COPY_DEST_PITCH */ OUT_RING(ring, /* RB_COPY_DEST_INFO */ - A2XX_RB_COPY_DEST_INFO_FORMAT(fd2_pipe2color(psurf->format)) | + A2XX_RB_COPY_DEST_INFO_FORMAT(fd2_pipe2color(format)) | COND(!rsc->tile_mode, A2XX_RB_COPY_DEST_INFO_LINEAR) | - A2XX_RB_COPY_DEST_INFO_SWAP(swap) | A2XX_RB_COPY_DEST_INFO_WRITE_RED | A2XX_RB_COPY_DEST_INFO_WRITE_GREEN | A2XX_RB_COPY_DEST_INFO_WRITE_BLUE | @@ -236,16 +234,12 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base, fd_resource_slice(rsc, psurf->u.tex.level); uint32_t offset = fd_resource_offset(rsc, psurf->u.tex.level, psurf->u.tex.first_layer); - uint32_t swiz; + enum pipe_format format = fd_gmem_restore_format(psurf->format); OUT_PKT3(ring, CP_SET_CONSTANT, 2); OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_INFO)); - OUT_RING(ring, A2XX_RB_COLOR_INFO_SWAP(fmt2swap(psurf->format)) | - A2XX_RB_COLOR_INFO_BASE(base) | - A2XX_RB_COLOR_INFO_FORMAT(fd2_pipe2color(psurf->format))); - - swiz = fd2_tex_swiz(psurf->format, PIPE_SWIZZLE_X, PIPE_SWIZZLE_Y, - PIPE_SWIZZLE_Z, PIPE_SWIZZLE_W); + OUT_RING(ring, A2XX_RB_COLOR_INFO_BASE(base) | + A2XX_RB_COLOR_INFO_FORMAT(fd2_pipe2color(format))); /* emit fb as a texture: */ OUT_PKT3(ring, CP_SET_CONSTANT, 7); @@ -255,12 +249,15 @@ emit_mem2gmem_surf(struct fd_batch *batch, uint32_t base, A2XX_SQ_TEX_0_CLAMP_Z(SQ_TEX_WRAP) | A2XX_SQ_TEX_0_PITCH(slice->pitch)); OUT_RELOC(ring, rsc->bo, offset, - fd2_pipe2surface(psurf->format) | + fd2_pipe2surface(format) | A2XX_SQ_TEX_1_CLAMP_POLICY(SQ_TEX_CLAMP_POLICY_OGL), 0); OUT_RING(ring, A2XX_SQ_TEX_2_WIDTH(psurf->width - 1) | A2XX_SQ_TEX_2_HEIGHT(psurf->height - 1)); OUT_RING(ring, A2XX_SQ_TEX_3_MIP_FILTER(SQ_TEX_FILTER_BASEMAP) | - swiz | + A2XX_SQ_TEX_3_SWIZ_X(0) | + A2XX_SQ_TEX_3_SWIZ_Y(1) | + A2XX_SQ_TEX_3_SWIZ_Z(2) | + A2XX_SQ_TEX_3_SWIZ_W(3) | A2XX_SQ_TEX_3_XY_MAG_FILTER(SQ_TEX_FILTER_POINT) | A2XX_SQ_TEX_3_XY_MIN_FILTER(SQ_TEX_FILTER_POINT)); OUT_RING(ring, 0x00000000); -- cgit v1.2.3