#define CTX_BLOCK_ID(offset) (((offset - RANGE_OFFSET_START) >> 2) & ((1 << HASH_SHIFT) - 1))
struct r600_pipe_reg {
- u32 offset;
- u32 mask;
u32 value;
- struct r600_bo *bo;
+ u32 mask;
+ struct r600_block *block;
+ struct r600_bo *bo;
+ u32 id;
};
struct r600_pipe_state {
void _r600_pipe_state_add_reg(struct r600_context *ctx,
struct r600_pipe_state *state,
u32 offset, u32 value, u32 mask,
+ u32 range_id, u32 block_id,
struct r600_bo *bo);
-#define r600_pipe_state_add_reg(state, offset, value, mask, bo) _r600_pipe_state_add_reg(&rctx->ctx, state, offset, value, mask, bo)
-
+#define r600_pipe_state_add_reg(state, offset, value, mask, bo) _r600_pipe_state_add_reg(&rctx->ctx, state, offset, value, mask, CTX_RANGE_ID(offset), CTX_BLOCK_ID(offset), bo)
#endif
void _r600_pipe_state_add_reg(struct r600_context *ctx,
struct r600_pipe_state *state,
u32 offset, u32 value, u32 mask,
+ u32 range_id, u32 block_id,
struct r600_bo *bo)
{
- state->regs[state->nregs].offset = offset;
+ struct r600_range *range;
+ struct r600_block *block;
+
+ range = &ctx->range[range_id];
+ block = range->blocks[block_id];
+
state->regs[state->nregs].value = value;
state->regs[state->nregs].mask = mask;
state->regs[state->nregs].bo = bo;
+ state->regs[state->nregs].block = block;
+ state->regs[state->nregs].id = (offset - block->start_offset) >> 2;
state->nregs++;
assert(state->nregs < R600_BLOCK_MAX_REG);
}
void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_state *state)
{
- struct r600_range *range;
struct r600_block *block;
unsigned new_val;
int dirty;
unsigned id, reloc_id;
struct r600_pipe_reg *reg = &state->regs[i];
- range = &ctx->range[CTX_RANGE_ID(reg->offset)];
- block = range->blocks[CTX_BLOCK_ID(reg->offset)];
- id = (reg->offset - block->start_offset) >> 2;
+ block = reg->block;
+ id = reg->id;
dirty = block->status & R600_BLOCK_STATUS_DIRTY;