[Mesa-dev] [PATCH 20/25] radeonsi: track constant buffer bind history in si_pipe_set_constant_buffer

Nicolai Hähnle nhaehnle at gmail.com
Thu Dec 6 14:00:41 UTC 2018


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

Other callers of si_set_constant_buffer don't need it.
---
 src/gallium/drivers/radeonsi/si_descriptors.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 111169a8c3d..81f21f2cfc1 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -1230,22 +1230,20 @@ static void si_set_constant_buffer(struct si_context *sctx,
 					       input->buffer_size, &buffer_offset);
 			if (!buffer) {
 				/* Just unbind on failure. */
 				si_set_constant_buffer(sctx, buffers, descriptors_idx, slot, NULL);
 				return;
 			}
 			va = r600_resource(buffer)->gpu_address + buffer_offset;
 		} else {
 			pipe_resource_reference(&buffer, input->buffer);
 			va = r600_resource(buffer)->gpu_address + input->buffer_offset;
-			/* Only track usage for non-user buffers. */
-			r600_resource(buffer)->bind_history |= PIPE_BIND_CONSTANT_BUFFER;
 		}
 
 		/* Set the descriptor. */
 		uint32_t *desc = descs->list + slot*4;
 		desc[0] = va;
 		desc[1] = S_008F04_BASE_ADDRESS_HI(va >> 32) |
 			  S_008F04_STRIDE(0);
 		desc[2] = input->buffer_size;
 		desc[3] = S_008F0C_DST_SEL_X(V_008F0C_SQ_SEL_X) |
 			  S_008F0C_DST_SEL_Y(V_008F0C_SQ_SEL_Y) |
@@ -1277,20 +1275,23 @@ static void si_pipe_set_constant_buffer(struct pipe_context *ctx,
 
 	if (shader >= SI_NUM_SHADERS)
 		return;
 
 	if (slot == 0 && input && input->buffer &&
 	    !(r600_resource(input->buffer)->flags & RADEON_FLAG_32BIT)) {
 		assert(!"constant buffer 0 must have a 32-bit VM address, use const_uploader");
 		return;
 	}
 
+	if (input && input->buffer)
+		r600_resource(input->buffer)->bind_history |= PIPE_BIND_CONSTANT_BUFFER;
+
 	slot = si_get_constbuf_slot(slot);
 	si_set_constant_buffer(sctx, &sctx->const_and_shader_buffers[shader],
 			       si_const_and_shader_buffer_descriptors_idx(shader),
 			       slot, input);
 }
 
 void si_get_pipe_constant_buffer(struct si_context *sctx, uint shader,
 				 uint slot, struct pipe_constant_buffer *cbuf)
 {
 	cbuf->user_buffer = NULL;
-- 
2.19.1



More information about the mesa-dev mailing list