[Mesa-dev] [PATCH 4/8] radeonsi: only count CS space for state atoms if we're going to draw

Marek Olšák maraeo at gmail.com
Wed May 7 06:53:40 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_hw_context.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index 383157b..aa854d6 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -35,13 +35,13 @@ void si_need_cs_space(struct si_context *ctx, unsigned num_dw,
 	/* The number of dwords we already used in the CS so far. */
 	num_dw += ctx->b.rings.gfx.cs->cdw;
 
-	for (i = 0; i < SI_NUM_ATOMS(ctx); i++) {
-		if (ctx->atoms.array[i]->dirty) {
-			num_dw += ctx->atoms.array[i]->num_dw;
+	if (count_draw_in) {
+		for (i = 0; i < SI_NUM_ATOMS(ctx); i++) {
+			if (ctx->atoms.array[i]->dirty) {
+				num_dw += ctx->atoms.array[i]->num_dw;
+			}
 		}
-	}
 
-	if (count_draw_in) {
 		/* The number of dwords all the dirty states would take. */
 		num_dw += ctx->pm4_dirty_cdwords;
 
-- 
1.9.1



More information about the mesa-dev mailing list