summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-04-17 17:19:28 +1000
committerDave Airlie <airlied@redhat.com>2011-04-17 17:19:28 +1000
commit93d42571a631cb273df15fc1930e5b27f2970d9b (patch)
tree22ca59a785034bc7832689f5f608fed6aad5dc99
parent70de2705b495c6f61437d24c6e5b9c411ebbacbf (diff)
r600g: use some loops.
unrolling loops is for Gentoo users, and I really want to put something else inside these loops later. Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--src/gallium/winsys/r600/drm/evergreen_hw_context.c26
-rw-r--r--src/gallium/winsys/r600/drm/r600_hw_context.c27
2 files changed, 24 insertions, 29 deletions
diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c
index 28d071b6bc..d914836676 100644
--- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c
+++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c
@@ -637,6 +637,7 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context
{
struct r600_range *range;
struct r600_block *block;
+ int i;
range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
@@ -647,14 +648,9 @@ static inline void evergreen_context_pipe_state_set_resource(struct r600_context
LIST_DELINIT(&block->list);
return;
}
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
- block->reg[3] = state->regs[3].value;
- block->reg[4] = state->regs[4].value;
- block->reg[5] = state->regs[5].value;
- block->reg[6] = state->regs[6].value;
- block->reg[7] = state->regs[7].value;
+ for (i = 0; i < 8; i++)
+ block->reg[i] = state->regs[i].value;
+
r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
if (state->regs[0].bo) {
@@ -696,6 +692,7 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context
{
struct r600_range *range;
struct r600_block *block;
+ int i;
range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
@@ -704,9 +701,8 @@ static inline void evergreen_context_pipe_state_set_sampler(struct r600_context
LIST_DELINIT(&block->list);
return;
}
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
+ for (i = 0; i < 3; i++)
+ block->reg[i] = state->regs[i].value;
r600_context_dirty_block(ctx, block);
}
@@ -716,6 +712,7 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c
unsigned fake_offset = (offset - R_00A400_TD_PS_SAMPLER0_BORDER_INDEX) * 0x100 + 0x40000 + id * 0x1C;
struct r600_range *range;
struct r600_block *block;
+ int i;
range = &ctx->range[CTX_RANGE_ID(ctx, fake_offset)];
block = range->blocks[CTX_BLOCK_ID(ctx, fake_offset)];
@@ -728,10 +725,9 @@ static inline void evergreen_context_pipe_state_set_sampler_border(struct r600_c
return;
}
block->reg[0] = id;
- block->reg[1] = state->regs[3].value;
- block->reg[2] = state->regs[4].value;
- block->reg[3] = state->regs[5].value;
- block->reg[4] = state->regs[6].value;
+
+ for (i = 1; i < 5; i++)
+ block->reg[i] = state->regs[i + 2].value;
r600_context_dirty_block(ctx, block);
}
diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c
index 3ecf4eb2fc..dd032ad944 100644
--- a/src/gallium/winsys/r600/drm/r600_hw_context.c
+++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -859,6 +859,7 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx
{
struct r600_range *range;
struct r600_block *block;
+ int i;
range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
@@ -869,13 +870,10 @@ static inline void r600_context_pipe_state_set_resource(struct r600_context *ctx
LIST_DELINIT(&block->list);
return;
}
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
- block->reg[3] = state->regs[3].value;
- block->reg[4] = state->regs[4].value;
- block->reg[5] = state->regs[5].value;
- block->reg[6] = state->regs[6].value;
+
+ for (i = 0; i < 7; i++)
+ block->reg[i] = state->regs[i].value;
+
r600_bo_reference(ctx->radeon, &block->reloc[1].bo, NULL);
r600_bo_reference(ctx->radeon , &block->reloc[2].bo, NULL);
if (state->regs[0].bo) {
@@ -920,6 +918,7 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx,
{
struct r600_range *range;
struct r600_block *block;
+ int i;
range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
@@ -928,9 +927,9 @@ static inline void r600_context_pipe_state_set_sampler(struct r600_context *ctx,
LIST_DELINIT(&block->list);
return;
}
- block->reg[0] = state->regs[0].value;
- block->reg[1] = state->regs[1].value;
- block->reg[2] = state->regs[2].value;
+
+ for (i = 0; i < 3; i++)
+ block->reg[i] = state->regs[i].value;
r600_context_dirty_block(ctx, block);
}
@@ -939,6 +938,7 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex
{
struct r600_range *range;
struct r600_block *block;
+ int i;
range = &ctx->range[CTX_RANGE_ID(ctx, offset)];
block = range->blocks[CTX_BLOCK_ID(ctx, offset)];
@@ -950,10 +950,9 @@ static inline void r600_context_pipe_state_set_sampler_border(struct r600_contex
if (state->nregs <= 3) {
return;
}
- block->reg[0] = state->regs[3].value;
- block->reg[1] = state->regs[4].value;
- block->reg[2] = state->regs[5].value;
- block->reg[3] = state->regs[6].value;
+
+ for (i = 0; i < 4; i++)
+ block->reg[i] = state->regs[i + 3].value;
r600_context_dirty_block(ctx, block);
}