diff options
author | Marek Olšák <[email protected]> | 2018-04-01 17:02:01 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-04-05 15:34:58 -0400 |
commit | 2a62e5eec92bc98c8c20e0b72cab4e14d112b2a4 (patch) | |
tree | 03f3689e60318ed4745701ccbf18c6df102efb49 /src/gallium | |
parent | 605ba1b9ae8012338f9ae6b9f0d0062a4a00c546 (diff) |
radeonsi: pass sctx to si_rebind_buffer and clean up
Acked-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/drivers/radeon/r600_buffer_common.c | 5 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_descriptors.c | 16 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.h | 2 |
3 files changed, 10 insertions, 13 deletions
diff --git a/src/gallium/drivers/radeon/r600_buffer_common.c b/src/gallium/drivers/radeon/r600_buffer_common.c index 5a0e157eb1e..e54670aafb9 100644 --- a/src/gallium/drivers/radeon/r600_buffer_common.c +++ b/src/gallium/drivers/radeon/r600_buffer_common.c @@ -286,7 +286,7 @@ si_invalidate_buffer(struct si_context *sctx, /* Reallocate the buffer in the same pipe_resource. */ si_alloc_resource(sctx->screen, rbuffer); - si_rebind_buffer(&sctx->b.b, &rbuffer->b.b, old_va); + si_rebind_buffer(sctx, &rbuffer->b.b, old_va); } else { util_range_set_empty(&rbuffer->valid_buffer_range); } @@ -299,6 +299,7 @@ void si_replace_buffer_storage(struct pipe_context *ctx, struct pipe_resource *dst, struct pipe_resource *src) { + struct si_context *sctx = (struct si_context*)ctx; struct r600_resource *rdst = r600_resource(dst); struct r600_resource *rsrc = r600_resource(src); uint64_t old_gpu_address = rdst->gpu_address; @@ -316,7 +317,7 @@ void si_replace_buffer_storage(struct pipe_context *ctx, assert(rdst->bo_alignment == rsrc->bo_alignment); assert(rdst->domains == rsrc->domains); - si_rebind_buffer(ctx, dst, old_gpu_address); + si_rebind_buffer(sctx, dst, old_gpu_address); } static void si_invalidate_resource(struct pipe_context *ctx, diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index 869d7dcfcdf..5a5e2d38a81 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -1488,8 +1488,7 @@ void si_set_ring_buffer(struct pipe_context *ctx, uint slot, sctx->descriptors_dirty |= 1u << SI_DESCS_RW_BUFFERS; } -static void si_desc_reset_buffer_offset(struct pipe_context *ctx, - uint32_t *desc, uint64_t old_buf_va, +static void si_desc_reset_buffer_offset(uint32_t *desc, uint64_t old_buf_va, struct pipe_resource *new_buf) { /* Retrieve the buffer offset from the descriptor. */ @@ -1597,8 +1596,7 @@ static void si_reset_buffer_resources(struct si_context *sctx, while (mask) { unsigned i = u_bit_scan(&mask); if (buffers->buffers[i] == buf) { - si_desc_reset_buffer_offset(&sctx->b.b, - descs->list + i*4, + si_desc_reset_buffer_offset(descs->list + i*4, old_va, buf); sctx->descriptors_dirty |= 1u << descriptors_idx; @@ -1612,10 +1610,9 @@ static void si_reset_buffer_resources(struct si_context *sctx, /* Update all resource bindings where the buffer is bound, including * all resource descriptors. This is invalidate_buffer without * the invalidation. */ -void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf, +void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf, uint64_t old_va) { - struct si_context *sctx = (struct si_context*)ctx; struct r600_resource *rbuffer = r600_resource(buf); unsigned i, shader; unsigned num_elems = sctx->vertex_elements ? @@ -1654,7 +1651,7 @@ void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf, if (buffers->buffers[i] != buf) continue; - si_desc_reset_buffer_offset(ctx, descs->list + i*4, + si_desc_reset_buffer_offset(descs->list + i*4, old_va, buf); sctx->descriptors_dirty |= 1u << SI_DESCS_RW_BUFFERS; @@ -1706,8 +1703,7 @@ void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf, if (samplers->views[i]->texture == buf) { unsigned desc_slot = si_get_sampler_slot(i); - si_desc_reset_buffer_offset(ctx, - descs->list + + si_desc_reset_buffer_offset(descs->list + desc_slot * 16 + 4, old_va, buf); sctx->descriptors_dirty |= @@ -1740,7 +1736,7 @@ void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf, si_mark_image_range_valid(&images->views[i]); si_desc_reset_buffer_offset( - ctx, descs->list + desc_slot * 8 + 4, + descs->list + desc_slot * 8 + 4, old_va, buf); sctx->descriptors_dirty |= 1u << si_sampler_and_image_descriptors_idx(shader); diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h index c58e3efad37..e399b6b76af 100644 --- a/src/gallium/drivers/radeonsi/si_state.h +++ b/src/gallium/drivers/radeonsi/si_state.h @@ -370,7 +370,7 @@ struct pb_slab *si_bindless_descriptor_slab_alloc(void *priv, unsigned heap, unsigned entry_size, unsigned group_index); void si_bindless_descriptor_slab_free(void *priv, struct pb_slab *pslab); -void si_rebind_buffer(struct pipe_context *ctx, struct pipe_resource *buf, +void si_rebind_buffer(struct si_context *sctx, struct pipe_resource *buf, uint64_t old_va); /* si_state.c */ struct si_shader_selector; |