r600g: fix computation of how many dwords is needed for a flush at the end of CS
authorMarek Olšák <maraeo@gmail.com>
Mon, 30 Jan 2012 08:11:01 +0000 (09:11 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 31 Jan 2012 22:12:30 +0000 (23:12 +0100)
src/gallium/drivers/r600/r600.h
src/gallium/drivers/r600/r600_hw_context.c

index d0f0b399b414a5bafb42e5de21ec93f17fcb96e9..229fa7068b269c3a1d7b7f3d6c8baf78318d4ec1 100644 (file)
@@ -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;
index b7ba0681845b27a908f4b6ffed7afd259bbc093f..7fd0152e4560529e1b145e756a133f054c205292 100644 (file)
@@ -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);
@@ -1477,8 +1472,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;
        }
 }