Mesa (master): r600g: consolidate the same piece of cut-n-paste code into a function.
Dave Airlie
airlied at kemper.freedesktop.org
Sun Apr 17 07:16:04 UTC 2011
Module: Mesa
Branch: master
Commit: 70de2705b495c6f61437d24c6e5b9c411ebbacbf
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=70de2705b495c6f61437d24c6e5b9c411ebbacbf
Author: Dave Airlie <airlied at redhat.com>
Date: Sun Apr 17 17:11:36 2011 +1000
r600g: consolidate the same piece of cut-n-paste code into a function.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/gallium/winsys/r600/drm/evergreen_hw_context.c | 23 +++------------
src/gallium/winsys/r600/drm/r600_hw_context.c | 30 ++++----------------
src/gallium/winsys/r600/drm/r600_priv.h | 10 ++++++
3 files changed, 21 insertions(+), 42 deletions(-)
diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c
index 66398af..28d071b 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 7f8da12..3ecf4eb 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 a958c95..0e9dba7 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;
More information about the mesa-commit
mailing list