Mesa (master): radeonsi: add sampler view BOs to the BO list last
Marek Olšák
mareko at kemper.freedesktop.org
Tue Sep 13 18:44:35 UTC 2016
Module: Mesa
Branch: master
Commit: fd69fa65a8fc2d3cd2a99ee7519a7e8eb18228c7
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fd69fa65a8fc2d3cd2a99ee7519a7e8eb18228c7
Author: Marek Olšák <marek.olsak at amd.com>
Date: Mon Sep 12 12:49:34 2016 +0200
radeonsi: add sampler view BOs to the BO list last
If si_sampler_view_add_buffer ends up flushing, then the code
in begin_new_cs would previously have added the buffer(s) for
whatever was previously bound to that slot. Now it would add only
the new buffer.
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
src/gallium/drivers/radeonsi/si_descriptors.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index b9fae79..b1a8594 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -410,10 +410,6 @@ static void si_set_sampler_view(struct si_context *sctx,
struct r600_texture *rtex = (struct r600_texture *)view->texture;
uint32_t *desc = descs->list + slot * 16;
- si_sampler_view_add_buffer(sctx, view->texture,
- RADEON_USAGE_READ,
- rview->is_stencil_sampler, true);
-
pipe_sampler_view_reference(&views->views[slot], view);
memcpy(desc, rview->state, 8*4);
@@ -446,6 +442,12 @@ static void si_set_sampler_view(struct si_context *sctx,
}
views->enabled_mask |= 1u << slot;
+
+ /* Since this can flush, it must be done after enabled_mask is
+ * updated. */
+ si_sampler_view_add_buffer(sctx, view->texture,
+ RADEON_USAGE_READ,
+ rview->is_stencil_sampler, true);
} else {
pipe_sampler_view_reference(&views->views[slot], NULL);
memcpy(descs->list + slot*16, null_texture_descriptor, 8*4);
@@ -627,9 +629,6 @@ static void si_set_shader_image(struct si_context *ctx,
if (&images->views[slot] != view)
util_copy_image_view(&images->views[slot], view);
- si_sampler_view_add_buffer(ctx, &res->b.b,
- RADEON_USAGE_READWRITE, false, true);
-
if (res->b.b.target == PIPE_BUFFER) {
if (view->access & PIPE_IMAGE_ACCESS_WRITE)
si_mark_image_range_valid(view);
@@ -702,6 +701,10 @@ static void si_set_shader_image(struct si_context *ctx,
images->enabled_mask |= 1u << slot;
descs->dirty_mask |= 1u << slot;
ctx->descriptors_dirty |= 1u << si_image_descriptors_idx(shader);
+
+ /* Since this can flush, it must be done after enabled_mask is updated. */
+ si_sampler_view_add_buffer(ctx, &res->b.b,
+ RADEON_USAGE_READWRITE, false, true);
}
static void
More information about the mesa-commit
mailing list