[Mesa-dev] [PATCH 11/13] radeonsi: Use CE for vertex buffers.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Thu Apr 14 01:35:01 UTC 2016


Signed-off-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
---
 src/gallium/drivers/radeonsi/si_descriptors.c | 28 ++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c b/src/gallium/drivers/radeonsi/si_descriptors.c
index 46d00b4..5e26760 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -641,14 +641,18 @@ static bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
 	 * directly through a staging buffer and don't go through
 	 * the fine-grained upload path.
 	 */
-	u_upload_alloc(sctx->b.uploader, 0, count * 16, 256, &desc->buffer_offset,
-		       (struct pipe_resource**)&desc->buffer, (void**)&ptr);
-	if (!desc->buffer)
-		return false;
 
-	radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx,
-			      desc->buffer, RADEON_USAGE_READ,
-			      RADEON_PRIO_DESCRIPTORS);
+	if (sctx->ce_ib) {
+		radeon_emit(sctx->ce_ib, PKT3(PKT3_WRITE_CONST_RAM, 4 * count, 0));
+		radeon_emit(sctx->ce_ib, desc->ce_offset);
+		ptr = sctx->ce_ib->buf + sctx->ce_ib->cdw;
+		sctx->ce_ib->cdw += count * 4;
+	} else {
+		u_upload_alloc(sctx->b.uploader, 0, count * 16, 256, &desc->buffer_offset,
+			(struct pipe_resource**)&desc->buffer, (void**)&ptr);
+		if (!desc->buffer)
+			return false;
+	}
 
 	assert(count <= SI_NUM_VERTEX_BUFFERS);
 
@@ -697,6 +701,16 @@ static bool si_upload_vertex_buffer_descriptors(struct si_context *sctx)
 		}
 	}
 
+	if (sctx->ce_ib) {
+		if (!si_ce_upload(sctx, desc->ce_offset, count * 16,
+		                  &desc->buffer_offset, &desc->buffer))
+			return false;
+	}
+
+	radeon_add_to_buffer_list(&sctx->b, &sctx->b.gfx,
+			      desc->buffer, RADEON_USAGE_READ,
+			      RADEON_PRIO_DESCRIPTORS);
+
 	/* Don't flush the const cache. It would have a very negative effect
 	 * on performance (confirmed by testing). New descriptors are always
 	 * uploaded to a fresh new buffer, so I don't think flushing the const
-- 
2.8.0



More information about the mesa-dev mailing list