diff options
author | Marek Olšák <[email protected]> | 2014-08-11 15:06:23 +0200 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2014-08-14 20:45:03 +0200 |
commit | 87a8ed9389bbc49828e711515e0cafc7b9424a30 (patch) | |
tree | 9d9b88bc62cf513950514f9b426115557724eb76 /src/gallium/drivers | |
parent | 79f28cdb983b7faf9d3008fae541a30e34ccce5a (diff) |
radeonsi: fix buffer invalidation of unbound texture buffer objects
This maintains a list of all TBOs in a pipe_context.
Reviewed-by: Alex Deucher <[email protected]>
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_descriptors.c | 13 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_pipe.h | 1 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state.c | 10 |
3 files changed, 17 insertions, 7 deletions
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c index c877797b83c..0e95f485e52 100644 --- a/src/gallium/drivers/radeonsi/si_descriptors.c +++ b/src/gallium/drivers/radeonsi/si_descriptors.c @@ -914,6 +914,7 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource uint64_t old_va = rbuffer->gpu_address; unsigned num_elems = sctx->vertex_elements ? sctx->vertex_elements->count : 0; + struct si_pipe_sampler_view *view; /* Reallocate the buffer in the same pipe_resource. */ r600_init_resource(&sctx->screen->b, rbuffer, rbuffer->b.b.width0, @@ -1000,7 +1001,13 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource } } - /* Texture buffers. */ + /* Texture buffers - update virtual addresses in sampler view descriptors. */ + LIST_FOR_EACH_ENTRY(view, &sctx->b.texture_buffers, list) { + if (view->base.texture == buf) { + si_desc_reset_buffer_offset(ctx, view->state, old_va, buf); + } + } + /* Texture buffers - update bindings. */ for (shader = 0; shader < SI_NUM_SHADERS; shader++) { struct si_sampler_views *views = &sctx->samplers[shader].views; bool found = false; @@ -1009,10 +1016,6 @@ static void si_invalidate_buffer(struct pipe_context *ctx, struct pipe_resource while (mask) { unsigned i = u_bit_scan(&mask); if (views->views[i]->texture == buf) { - /* This updates the sampler view directly. */ - si_desc_reset_buffer_offset(ctx, views->desc_data[i], - old_va, buf); - r600_context_bo_reloc(&sctx->b, &sctx->b.rings.gfx, rbuffer, RADEON_USAGE_READ, RADEON_PRIO_SHADER_BUFFER_RO); diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h index 7b6c8600718..10f7e23c360 100644 --- a/src/gallium/drivers/radeonsi/si_pipe.h +++ b/src/gallium/drivers/radeonsi/si_pipe.h @@ -47,6 +47,7 @@ struct si_screen { struct si_pipe_sampler_view { struct pipe_sampler_view base; + struct list_head list; struct r600_resource *resource; uint32_t state[8]; uint32_t fmask_state[8]; diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c index 6e9a60a62c6..d22c112f9f4 100644 --- a/src/gallium/drivers/radeonsi/si_state.c +++ b/src/gallium/drivers/radeonsi/si_state.c @@ -2358,6 +2358,7 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx struct pipe_resource *texture, const struct pipe_sampler_view *state) { + struct si_context *sctx = (struct si_context*)ctx; struct si_pipe_sampler_view *view = CALLOC_STRUCT(si_pipe_sampler_view); struct r600_texture *tmp = (struct r600_texture*)texture; const struct util_format_description *desc; @@ -2402,6 +2403,8 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx S_008F0C_DST_SEL_W(si_map_swizzle(desc->swizzle[3])) | S_008F0C_NUM_FORMAT(num_format) | S_008F0C_DATA_FORMAT(format); + + LIST_ADDTAIL(&view->list, &sctx->b.texture_buffers); return &view->base; } @@ -2606,10 +2609,13 @@ static struct pipe_sampler_view *si_create_sampler_view(struct pipe_context *ctx static void si_sampler_view_destroy(struct pipe_context *ctx, struct pipe_sampler_view *state) { - struct r600_pipe_sampler_view *resource = (struct r600_pipe_sampler_view *)state; + struct si_pipe_sampler_view *view = (struct si_pipe_sampler_view *)state; + + if (view->resource->b.b.target == PIPE_BUFFER) + LIST_DELINIT(&view->list); pipe_resource_reference(&state->texture, NULL); - FREE(resource); + FREE(view); } static bool wrap_mode_uses_border_color(unsigned wrap, bool linear_filter) |