Mesa (master): radeonsi: deal with high vertex buffer memory usage correctly

Marek Olšák mareko at kemper.freedesktop.org
Sat Aug 6 12:27:34 UTC 2016


Module: Mesa
Branch: master
Commit: d82cfab84c6b202e09180961959306acd50bd786
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d82cfab84c6b202e09180961959306acd50bd786

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Jul 29 17:28:43 2016 +0200

radeonsi: deal with high vertex buffer memory usage correctly

Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/drivers/radeonsi/si_descriptors.c | 5 ++---
 src/gallium/drivers/radeonsi/si_state.h       | 1 +
 src/gallium/drivers/radeonsi/si_state_draw.c  | 7 +++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 92875a2..1cbb86a 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -855,7 +855,7 @@ static void si_vertex_buffers_begin_new_cs(struct si_context *sctx)
 			      RADEON_PRIO_DESCRIPTORS);
 }
 
-static bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
+bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
 {
 	struct si_descriptors *desc = &sctx->vertex_buffers;
 	bool bound[SI_NUM_VERTEX_BUFFERS] = {};
@@ -1801,8 +1801,7 @@ bool si_upload_graphics_shader_descriptors(struct si_context *sctx)
 	}
 
 	sctx->descriptors_dirty &= ~mask;
-
-	return si_upload_vertex_buffer_descriptors(sctx);
+	return true;
 }
 
 bool si_upload_compute_shader_descriptors(struct si_context *sctx)
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index f5cc300..b574c2e 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -287,6 +287,7 @@ void si_set_ring_buffer(struct pipe_context *ctx, uint slot,
 			bool add_tid, bool swizzle,
 			unsigned element_size, unsigned index_stride, uint64_t offset);
 void si_init_all_descriptors(struct si_context *sctx);
+bool si_upload_vertex_buffer_descriptors(struct si_context *sctx);
 bool si_upload_graphics_shader_descriptors(struct si_context *sctx);
 bool si_upload_compute_shader_descriptors(struct si_context *sctx);
 void si_release_all_descriptors(struct si_context *sctx);
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index e4af4c7..d743e22 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -997,6 +997,13 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 
 	si_need_cs_space(sctx);
 
+	/* Since we've called r600_context_add_resource_size for vertex buffers,
+	 * this must be called after si_need_cs_space, because we must let
+	 * need_cs_space flush before we add buffers to the buffer list.
+	 */
+	if (!si_upload_vertex_buffer_descriptors(sctx))
+		return;
+
 	/* Emit states. */
 	mask = sctx->dirty_atoms;
 	while (mask) {




More information about the mesa-commit mailing list