summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2014-09-10 13:44:14 -0400
committerRob Clark <[email protected]>2014-09-12 16:23:52 -0400
commit2ed7640eeccfbfdff0862fd92b05b3f0175d3c64 (patch)
treefb39a125ff082911a2d07d6567b239333a35ac2a
parent0d73ac6b02cac46d4a8f3cd1ffa591e071577fa7 (diff)
freedreno/a3xx: handle rendering to layer != 0
Signed-off-by: Rob Clark <[email protected]>
-rw-r--r--src/gallium/drivers/freedreno/a3xx/fd3_gmem.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
index 6828d0e1fb4..ec5f28e5664 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c
@@ -69,6 +69,7 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
struct fd_resource_slice *slice = NULL;
uint32_t stride = 0;
uint32_t base = 0;
+ uint32_t layer_offset = 0;
if ((i < nr_bufs) && bufs[i]) {
struct pipe_surface *psurf = bufs[i];
@@ -78,6 +79,10 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
format = fd3_pipe2color(psurf->format);
swap = fd3_pipe2swap(psurf->format);
+ debug_assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
+
+ layer_offset = slice->size0 * psurf->u.tex.first_layer;
+
if (bin_w) {
stride = bin_w * rsc->cpp;
@@ -97,7 +102,8 @@ emit_mrt(struct fd_ringbuffer *ring, unsigned nr_bufs,
if (bin_w || (i >= nr_bufs)) {
OUT_RING(ring, A3XX_RB_MRT_BUF_BASE_COLOR_BUF_BASE(base));
} else {
- OUT_RELOCW(ring, rsc->bo, slice->offset, 0, -1);
+ OUT_RELOCW(ring, rsc->bo,
+ slice->offset + layer_offset, 0, -1);
}
OUT_PKT0(ring, REG_A3XX_SP_FS_IMAGE_OUTPUT_REG(i), 1);
@@ -303,12 +309,16 @@ emit_gmem2mem_surf(struct fd_context *ctx,
struct fd_ringbuffer *ring = ctx->ring;
struct fd_resource *rsc = fd_resource(psurf->texture);
struct fd_resource_slice *slice = &rsc->slices[psurf->u.tex.level];
+ uint32_t layer_offset = slice->size0 * psurf->u.tex.first_layer;
+
+ debug_assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer);
OUT_PKT0(ring, REG_A3XX_RB_COPY_CONTROL, 4);
OUT_RING(ring, A3XX_RB_COPY_CONTROL_MSAA_RESOLVE(MSAA_ONE) |
A3XX_RB_COPY_CONTROL_MODE(mode) |
A3XX_RB_COPY_CONTROL_GMEM_BASE(base));
- OUT_RELOCW(ring, rsc->bo, slice->offset, 0, -1); /* RB_COPY_DEST_BASE */
+
+ OUT_RELOCW(ring, rsc->bo, slice->offset + layer_offset, 0, -1); /* RB_COPY_DEST_BASE */
OUT_RING(ring, A3XX_RB_COPY_DEST_PITCH_PITCH(slice->pitch * rsc->cpp));
OUT_RING(ring, A3XX_RB_COPY_DEST_INFO_TILE(LINEAR) |
A3XX_RB_COPY_DEST_INFO_FORMAT(fd3_pipe2color(psurf->format)) |