diff options
author | Rob Clark <Rob Clark [email protected]> | 2013-04-22 13:21:21 -0400 |
---|---|---|
committer | Rob Clark <[email protected]> | 2013-04-24 21:09:46 -0400 |
commit | a64e2d9d9fc111c709d91bbad174b5a29b882245 (patch) | |
tree | bb84395f899c1725bf2af83ecf0d1cb4a5b6d5c2 | |
parent | d9a32b84e38fda935032338a0a4ae9438d48108d (diff) |
freedreno: set SWAP bit based on format
Really this should be set based on buffer format, not on color vs
depth/stencil. Probably there should be more formats that set the bit
as we add support for more render target formats.
Signed-off-by: Rob Clark <[email protected]>
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_gmem.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/gallium/drivers/freedreno/freedreno_gmem.c b/src/gallium/drivers/freedreno/freedreno_gmem.c index 60374cc9849..42eac72f372 100644 --- a/src/gallium/drivers/freedreno/freedreno_gmem.c +++ b/src/gallium/drivers/freedreno/freedreno_gmem.c @@ -69,13 +69,25 @@ * resolve. */ +static uint32_t fmt2swap(enum pipe_format format) +{ + switch (format) { + case PIPE_FORMAT_B8G8R8A8_UNORM: + /* TODO probably some more.. */ + return 1; + default: + return 0; + } +} + /* transfer from gmem to system memory (ie. normal RAM) */ static void -emit_gmem2mem_surf(struct fd_ringbuffer *ring, uint32_t swap, uint32_t base, +emit_gmem2mem_surf(struct fd_ringbuffer *ring, uint32_t base, struct pipe_surface *psurf) { struct fd_resource *rsc = fd_resource(psurf->texture); + uint32_t swap = fmt2swap(psurf->format); OUT_PKT3(ring, CP_SET_CONSTANT, 2); OUT_RING(ring, CP_REG(REG_A2XX_RB_COLOR_INFO)); @@ -168,10 +180,10 @@ emit_gmem2mem(struct fd_context *ctx, struct fd_ringbuffer *ring, A2XX_RB_COPY_DEST_OFFSET_Y(yoff)); if (ctx->resolve & (FD_BUFFER_DEPTH | FD_BUFFER_STENCIL)) - emit_gmem2mem_surf(ring, 0, bin_w * bin_h, pfb->zsbuf); + emit_gmem2mem_surf(ring, bin_w * bin_h, pfb->zsbuf); if (ctx->resolve & FD_BUFFER_COLOR) - emit_gmem2mem_surf(ring, 1, 0, pfb->cbufs[0]); + emit_gmem2mem_surf(ring, 0, pfb->cbufs[0]); OUT_PKT3(ring, CP_SET_CONSTANT, 2); OUT_RING(ring, CP_REG(REG_A2XX_RB_MODECONTROL)); @@ -181,7 +193,7 @@ emit_gmem2mem(struct fd_context *ctx, struct fd_ringbuffer *ring, /* transfer from system memory to gmem */ static void -emit_mem2gmem_surf(struct fd_ringbuffer *ring, uint32_t swap, uint32_t base, +emit_mem2gmem_surf(struct fd_ringbuffer *ring, uint32_t base, struct pipe_surface *psurf) { struct fd_resource *rsc = fd_resource(psurf->texture); @@ -189,7 +201,7 @@ emit_mem2gmem_surf(struct fd_ringbuffer *ring, uint32_t swap, 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) | + OUT_RING(ring, A2XX_RB_COLOR_INFO_SWAP(fmt2swap(psurf->format)) | A2XX_RB_COLOR_INFO_BASE(base) | A2XX_RB_COLOR_INFO_FORMAT(fd_pipe2color(psurf->format))); @@ -320,10 +332,10 @@ emit_mem2gmem(struct fd_context *ctx, struct fd_ringbuffer *ring, OUT_RING(ring, 0x00000000); if (ctx->restore & (FD_BUFFER_DEPTH | FD_BUFFER_STENCIL)) - emit_mem2gmem_surf(ring, 0, bin_w * bin_h, pfb->zsbuf); + emit_mem2gmem_surf(ring, bin_w * bin_h, pfb->zsbuf); if (ctx->restore & FD_BUFFER_COLOR) - emit_mem2gmem_surf(ring, 1, 0, pfb->cbufs[0]); + emit_mem2gmem_surf(ring, 0, pfb->cbufs[0]); /* TODO blob driver seems to toss in a CACHE_FLUSH after each DRAW_INDX.. */ } |