OSDN Git Service

r600g: don't need to call the packet dirty function if not dirty.
authorDave Airlie <airlied@redhat.com>
Fri, 3 Jun 2011 05:24:55 +0000 (15:24 +1000)
committerDave Airlie <airlied@redhat.com>
Mon, 6 Jun 2011 23:25:50 +0000 (09:25 +1000)
also fix a unneeded dirty check and add a dirty check speedup.

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 cf8ae51..aa789e6 100644 (file)
@@ -1066,8 +1066,8 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context
                        block->reg[i] = state->regs[i].value;
                }
        }
-
-       r600_context_dirty_block(ctx, block, dirty, 2);
+       if (dirty)
+               r600_context_dirty_block(ctx, block, dirty, 2);
 }
 
 static inline void evergreen_context_ps_partial_flush(struct r600_context *ctx)
@@ -1119,7 +1119,8 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c
        if (dirty & R600_BLOCK_STATUS_DIRTY)
                evergreen_context_ps_partial_flush(ctx);
 
-       r600_context_dirty_block(ctx, block, dirty, 4);
+       if (dirty)
+               r600_context_dirty_block(ctx, block, dirty, 4);
 }
 
 void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)
index a3c8945..4c21d60 100644 (file)
@@ -920,13 +920,14 @@ void r600_context_reg(struct r600_context *ctx,
                dirty |= R600_BLOCK_STATUS_DIRTY;
                block->reg[id] = new_val;
        }
-       r600_context_dirty_block(ctx, block, dirty, id);
+       if (dirty)
+               r600_context_dirty_block(ctx, block, dirty, id);
 }
 
 void r600_context_dirty_block(struct r600_context *ctx, struct r600_block *block,
                              int dirty, int index)
 {
-       if (dirty && (index + 1) > block->nreg_dirty)
+       if ((index + 1) > block->nreg_dirty)
                block->nreg_dirty = index + 1;
 
        if ((dirty != (block->status & R600_BLOCK_STATUS_DIRTY)) || !(block->status & R600_BLOCK_STATUS_ENABLED)) {
@@ -970,7 +971,8 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat
                        dirty |= R600_BLOCK_STATUS_DIRTY;
                }
 
-               r600_context_dirty_block(ctx, block, dirty, id);
+               if (dirty)
+                       r600_context_dirty_block(ctx, block, dirty, id);
        }
 }
 
@@ -998,7 +1000,7 @@ void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_
        dirty = block->status & R600_BLOCK_STATUS_DIRTY;
 
        for (i = 0; i < num_regs; i++) {
-               if (block->reg[i] != state->regs[i].value) {
+               if (dirty || (block->reg[i] != state->regs[i].value)) {
                        dirty |= R600_BLOCK_STATUS_DIRTY;
                        block->reg[i] = state->regs[i].value;
                }
@@ -1045,7 +1047,8 @@ void r600_context_pipe_state_set_resource(struct r600_context *ctx, struct r600_
                        state->regs[2].bo->bo->binding |= BO_BOUND_TEXTURE;
                }
        }
-       r600_context_dirty_block(ctx, block, dirty, num_regs - 1);
+       if (dirty)
+               r600_context_dirty_block(ctx, block, dirty, num_regs - 1);
 }
 
 void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid)
@@ -1091,7 +1094,8 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx,
                }
        }
 
-       r600_context_dirty_block(ctx, block, dirty, 2);
+       if (dirty)
+               r600_context_dirty_block(ctx, block, dirty, 2);
 }
 
 static inline void r600_context_ps_partial_flush(struct r600_context *ctx)
@@ -1135,8 +1139,8 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex
         * will end up using the new border color. */
        if (dirty & R600_BLOCK_STATUS_DIRTY)
                r600_context_ps_partial_flush(ctx);
-
-       r600_context_dirty_block(ctx, block, dirty, 3);
+       if (dirty)
+               r600_context_dirty_block(ctx, block, dirty, 3);
 }
 
 void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id)