r600g: exit bo per reg scanning loop early.
authorDave Airlie <airlied@redhat.com>
Tue, 7 Jun 2011 02:33:24 +0000 (12:33 +1000)
committerDave Airlie <airlied@redhat.com>
Wed, 8 Jun 2011 01:47:00 +0000 (11:47 +1000)
Exit this loop early to avoid pointless iterations later.

Move the resource bos to the first two regs, it actually
doesn't matter which regs we use for this in resource land.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/gallium/winsys/r600/drm/evergreen_hw_context.c
src/gallium/winsys/r600/drm/r600_hw_context.c

index a95182773a710467ac858059c13c4e09e103427f..11514156cd0686d6378c211fdf6f19f852cbdcb0 100644 (file)
@@ -824,10 +824,10 @@ static const struct r600_reg cayman_context_reg_list[] = {
 static int r600_resource_range_init(struct r600_context *ctx, struct r600_range *range, unsigned offset, unsigned nblocks, unsigned stride)
 {
        struct r600_reg r600_shader_resource[] = {
-               {R_030000_RESOURCE0_WORD0, 0, 0, 0},
-               {R_030004_RESOURCE0_WORD1, 0, 0, 0},
-               {R_030008_RESOURCE0_WORD2, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
-               {R_03000C_RESOURCE0_WORD3, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+               {R_030000_RESOURCE0_WORD0, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+               {R_030004_RESOURCE0_WORD1, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+               {R_030008_RESOURCE0_WORD2, 0, 0, 0},
+               {R_03000C_RESOURCE0_WORD3, 0, 0, 0},
                {R_030010_RESOURCE0_WORD4, 0, 0, 0},
                {R_030014_RESOURCE0_WORD5, 0, 0, 0},
                {R_030018_RESOURCE0_WORD6, 0, 0, 0},
index 8d387c4e8f25368d27d6e7a4a1d489995bfac2f4..7db5a03bce4774ac28f63be2479844b81c3235d6 100644 (file)
@@ -595,10 +595,10 @@ int r600_resource_init(struct r600_context *ctx, struct r600_range *range, unsig
 static int r600_resource_range_init(struct r600_context *ctx, struct r600_range *range, unsigned offset, unsigned nblocks, unsigned stride)
 {
        struct r600_reg r600_shader_resource[] = {
-               {R_038000_RESOURCE0_WORD0, 0, 0, 0},
-               {R_038004_RESOURCE0_WORD1, 0, 0, 0},
-               {R_038008_RESOURCE0_WORD2, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
-               {R_03800C_RESOURCE0_WORD3, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+               {R_038000_RESOURCE0_WORD0, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+               {R_038004_RESOURCE0_WORD1, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+               {R_038008_RESOURCE0_WORD2, 0, 0, 0},
+               {R_03800C_RESOURCE0_WORD3, 0, 0, 0},
                {R_038010_RESOURCE0_WORD4, 0, 0, 0},
                {R_038014_RESOURCE0_WORD5, 0, 0, 0},
                {R_038018_RESOURCE0_WORD6, 0, 0, 0},
@@ -1254,12 +1254,13 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
        int optional = block->nbo == 0 && !(block->flags & REG_FLAG_DIRTY_ALWAYS);
        int cp_dwords = block->pm4_ndwords, start_dword = 0;
        int new_dwords = 0;
+       int nbo = block->nbo;
 
        if (block->nreg_dirty == 0 && optional) {
                goto out;
        }
 
-       if (block->nbo) {
+       if (nbo) {
                ctx->flags |= R600_CONTEXT_CHECK_EVENT_FLUSH;
 
                for (int j = 0; j < block->nreg; j++) {
@@ -1273,6 +1274,9 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
                                                      block->reloc[id].flush_flags,
                                                      block->reloc[id].flush_mask,
                                                      block->reloc[id].bo);
+                               nbo--;
+                               if (nbo == 0)
+                                       break;
                        }
                }
                ctx->flags &= ~R600_CONTEXT_CHECK_EVENT_FLUSH;