radeonsi: pass sctx to si_rebind_buffer and clean up

Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
Marek Olšák 2018-04-01 17:02:01 -04:00
parent 605ba1b9ae
commit 2a62e5eec9
3 changed files with 10 additions and 13 deletions

View file

@ -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,

View file

@ -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);

View file

@ -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;