[Mesa-dev] [PATCH 13/15] r600g: fix computation of how many dwords is needed for a flush at the end of CS

Marek Olšák maraeo at gmail.com
Mon Jan 30 12:23:16 PST 2012


---
 src/gallium/drivers/r600/r600.h            |    1 -
 src/gallium/drivers/r600/r600_hw_context.c |   14 ++++----------
 2 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/r600/r600.h b/src/gallium/drivers/r600/r600.h
index d0f0b39..229fa70 100644
--- a/src/gallium/drivers/r600/r600.h
+++ b/src/gallium/drivers/r600/r600.h
@@ -144,7 +144,6 @@ struct r600_block {
 	unsigned                flags;
 	unsigned		start_offset;
 	unsigned		pm4_ndwords;
-	unsigned		pm4_flush_ndwords;
 	unsigned		nbo;
 	uint16_t 		nreg;
 	uint16_t                nreg_dirty;
diff --git a/src/gallium/drivers/r600/r600_hw_context.c b/src/gallium/drivers/r600/r600_hw_context.c
index ab9ff2d..bba73e8 100644
--- a/src/gallium/drivers/r600/r600_hw_context.c
+++ b/src/gallium/drivers/r600/r600_hw_context.c
@@ -199,11 +199,6 @@ static void r600_init_block(struct r600_context *ctx,
 			block->pm4[block->pm4_ndwords++] = reg[i+j].flush_flags;
 		}
 	}
-	for (j = 0; j < n; j++) {
-		if (reg[i+j].flush_flags) {
-			block->pm4_flush_ndwords += 7;
-		}
-	}
 	/* check that we stay in limit */
 	assert(block->pm4_ndwords < R600_BLOCK_MAX_REG);
 }
@@ -944,7 +939,7 @@ void r600_need_cs_space(struct r600_context *ctx, unsigned num_dw,
 	}
 
 	/* Count in framebuffer cache flushes at the end of CS. */
-	num_dw += ctx->num_dest_buffers * 7;
+	num_dw += 7; /* one SURFACE_SYNC and CACHE_FLUSH_AND_INV (r6xx-only) */
 
 	/* Save 16 dwords for the fence mechanism. */
 	num_dw += 16;
@@ -964,7 +959,7 @@ void r600_context_dirty_block(struct r600_context *ctx,
 
 	if ((dirty != (block->status & R600_BLOCK_STATUS_DIRTY)) || !(block->status & R600_BLOCK_STATUS_ENABLED)) {
 		block->status |= R600_BLOCK_STATUS_DIRTY;
-		ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+		ctx->pm4_dirty_cdwords += block->pm4_ndwords;
 		if (!(block->status & R600_BLOCK_STATUS_ENABLED)) {
 			block->status |= R600_BLOCK_STATUS_ENABLED;
 			LIST_ADDTAIL(&block->enable_list, &ctx->enable_list);
@@ -1018,7 +1013,7 @@ static void r600_context_dirty_resource_block(struct r600_context *ctx,
 
 	if ((dirty != (block->status & R600_BLOCK_STATUS_RESOURCE_DIRTY)) || !(block->status & R600_BLOCK_STATUS_ENABLED)) {
 		block->status |= R600_BLOCK_STATUS_RESOURCE_DIRTY;
-		ctx->pm4_dirty_cdwords += block->pm4_ndwords + block->pm4_flush_ndwords;
+		ctx->pm4_dirty_cdwords += block->pm4_ndwords;
 		if (!(block->status & R600_BLOCK_STATUS_ENABLED)) {
 			block->status |= R600_BLOCK_STATUS_ENABLED;
 			LIST_ADDTAIL(&block->enable_list, &ctx->enable_list);
@@ -1476,8 +1471,7 @@ void r600_context_flush(struct r600_context *ctx, unsigned flags)
 				enable_block->status |= R600_BLOCK_STATUS_RESOURCE_DIRTY;
 			}
 		}
-		ctx->pm4_dirty_cdwords += enable_block->pm4_ndwords + 
-			enable_block->pm4_flush_ndwords;
+		ctx->pm4_dirty_cdwords += enable_block->pm4_ndwords;
 		enable_block->nreg_dirty = enable_block->nreg;
 	}
 }
-- 
1.7.5.4



More information about the mesa-dev mailing list