diff options
author | Rob Clark <robclark@freedesktop.org> | 2014-10-15 17:15:06 -0400 |
---|---|---|
committer | Rob Clark <robclark@freedesktop.org> | 2014-10-20 21:42:44 -0400 |
commit | 74069e324e559a9361ebe631d1b819ff6e675c8f (patch) | |
tree | 73d1efe04efecccf827e071d307d5970e49c9f85 | |
parent | aafbd89c5e6c643e9c80edabda1fac2437bea927 (diff) |
freedreno/a3xx: more layer/level fixes
Signed-off-by: Rob Clark <robclark@freedesktop.org>
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_emit.c | 9 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/a3xx/fd3_gmem.c | 7 | ||||
-rw-r--r-- | src/gallium/drivers/freedreno/freedreno_resource.c | 6 |
3 files changed, 14 insertions, 8 deletions
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c index 050530e2267..0439dc7b1d1 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_emit.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_emit.c @@ -282,8 +282,13 @@ void fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring, struct pipe_surface *psurf) { struct fd_resource *rsc = fd_resource(psurf->texture); + unsigned lvl = psurf->u.tex.level; + struct fd_resource_slice *slice = &rsc->slices[lvl]; + uint32_t layer_offset = slice->size0 * psurf->u.tex.first_layer; enum pipe_format format = fd3_gmem_restore_format(psurf->format); + debug_assert(psurf->u.tex.first_layer == psurf->u.tex.last_layer); + /* output sampler state: */ OUT_PKT3(ring, CP_LOAD_STATE, 4); OUT_RING(ring, CP_LOAD_STATE_0_DST_OFF(FRAG_TEX_OFF) | @@ -314,7 +319,7 @@ fd3_emit_gmem_restore_tex(struct fd_ringbuffer *ring, struct pipe_surface *psurf OUT_RING(ring, A3XX_TEX_CONST_1_FETCHSIZE(TFETCH_DISABLE) | A3XX_TEX_CONST_1_WIDTH(psurf->width) | A3XX_TEX_CONST_1_HEIGHT(psurf->height)); - OUT_RING(ring, A3XX_TEX_CONST_2_PITCH(rsc->slices[0].pitch * rsc->cpp) | + OUT_RING(ring, A3XX_TEX_CONST_2_PITCH(slice->pitch * rsc->cpp) | A3XX_TEX_CONST_2_INDX(0)); OUT_RING(ring, 0x00000000); @@ -326,7 +331,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_RELOC(ring, rsc->bo, 0, 0, 0); + OUT_RELOC(ring, rsc->bo, layer_offset, 0, 0); } void diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c index 219c9e06a2d..2eefa9119dc 100644 --- a/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c +++ b/src/gallium/drivers/freedreno/a3xx/fd3_gmem.c @@ -609,8 +609,11 @@ fd3_emit_sysmem_prep(struct fd_context *ctx) struct fd_ringbuffer *ring = ctx->ring; uint32_t pitch = 0; - if (pfb->cbufs[0]) - pitch = fd_resource(pfb->cbufs[0]->texture)->slices[0].pitch; + if (pfb->cbufs[0]) { + struct pipe_surface *psurf = pfb->cbufs[0]; + unsigned lvl = psurf->u.tex.level; + pitch = fd_resource(psurf->texture)->slices[lvl].pitch; + } fd3_emit_restore(ctx); diff --git a/src/gallium/drivers/freedreno/freedreno_resource.c b/src/gallium/drivers/freedreno/freedreno_resource.c index b6b39f00db0..49ae5171507 100644 --- a/src/gallium/drivers/freedreno/freedreno_resource.c +++ b/src/gallium/drivers/freedreno/freedreno_resource.c @@ -199,9 +199,8 @@ setup_slices(struct fd_resource *rsc) for (level = 0; level <= prsc->last_level; level++) { struct fd_resource_slice *slice = fd_resource_slice(rsc, level); - uint32_t aligned_width = align(width, 32); - slice->pitch = aligned_width; + slice->pitch = align(width, 32); slice->offset = size; slice->size0 = slice->pitch * height * rsc->cpp; @@ -229,9 +228,8 @@ setup_slices_array(struct fd_resource *rsc) for (level = 0; level <= prsc->last_level; level++) { struct fd_resource_slice *slice = fd_resource_slice(rsc, level); - uint32_t aligned_width = align(width, 32); - slice->pitch = aligned_width; + slice->pitch = align(width, 32); slice->offset = size; slice->size0 = align(slice->pitch * height * rsc->cpp, 4096); |