From: Dave Airlie Date: Sun, 17 Apr 2011 07:11:36 +0000 (+1000) Subject: r600g: consolidate the same piece of cut-n-paste code into a function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=70de2705b495c6f61437d24c6e5b9c411ebbacbf;p=mesa.git r600g: consolidate the same piece of cut-n-paste code into a function. Signed-off-by: Dave Airlie --- diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c index 66398afa698..28d071b6bc5 100644 --- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c +++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c @@ -668,12 +668,7 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context r600_bo_reference(ctx->radeon, &block->reloc[1].bo, state->regs[2].bo); r600_bo_reference(ctx->radeon, &block->reloc[2].bo, state->regs[3].bo); } - if (!(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; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } + r600_context_dirty_block(ctx, block); } void evergreen_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) @@ -712,12 +707,8 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; - if (!(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; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } + + r600_context_dirty_block(ctx, block); } static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset, unsigned id) @@ -741,12 +732,8 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c block->reg[2] = state->regs[4].value; block->reg[3] = state->regs[5].value; block->reg[4] = state->regs[6].value; - if (!(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; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } + + r600_context_dirty_block(ctx, block); } void evergreen_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c index 7f8da12da46..3ecf4eb2fca 100644 --- a/src/gallium/winsys/r600/drm/r600_hw_context.c +++ b/src/gallium/winsys/r600/drm/r600_hw_context.c @@ -851,12 +851,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat r600_bo_reference(ctx->radeon, &block->reloc[id].bo, state->regs[i].bo); state->regs[i].bo->fence = ctx->radeon->fence; } - if (!(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; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } + r600_context_dirty_block(ctx, block); } } @@ -897,12 +892,7 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx state->regs[2].bo->fence = ctx->radeon->fence; state->regs[3].bo->fence = ctx->radeon->fence; } - if (!(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; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } + r600_context_dirty_block(ctx, block); } void r600_context_pipe_state_set_ps_resource(struct r600_context *ctx, struct r600_pipe_state *state, unsigned rid) @@ -941,12 +931,8 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx, block->reg[0] = state->regs[0].value; block->reg[1] = state->regs[1].value; block->reg[2] = state->regs[2].value; - if (!(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; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } + + r600_context_dirty_block(ctx, block); } static inline void r600_context_pipe_state_set_sampler_border(struct r600_context *ctx, struct r600_pipe_state *state, unsigned offset) @@ -968,12 +954,8 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex block->reg[1] = state->regs[4].value; block->reg[2] = state->regs[5].value; block->reg[3] = state->regs[6].value; - if (!(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; - LIST_ADDTAIL(&block->list,&ctx->dirty); - } + + r600_context_dirty_block(ctx, block); } void r600_context_pipe_state_set_ps_sampler(struct r600_context *ctx, struct r600_pipe_state *state, unsigned id) diff --git a/src/gallium/winsys/r600/drm/r600_priv.h b/src/gallium/winsys/r600/drm/r600_priv.h index a958c95ab62..0e9dba70cd6 100644 --- a/src/gallium/winsys/r600/drm/r600_priv.h +++ b/src/gallium/winsys/r600/drm/r600_priv.h @@ -194,6 +194,16 @@ static void inline r600_context_reg(struct r600_context *ctx, } } +static inline void r600_context_dirty_block(struct r600_context *ctx, struct r600_block *block) +{ + if (!(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; + LIST_ADDTAIL(&block->list,&ctx->dirty); + } +} + static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *block) { int id;