summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2011-06-07 12:33:24 +1000
committerDave Airlie <[email protected]>2011-06-08 11:47:00 +1000
commitff8717527dd8b0313905c67712428fa5d4647d9b (patch)
tree9a2d6a54401747899bd8af86ba0d081051c66f37
parent138f660b5890f4ceba649df00239111947735842 (diff)
r600g: exit bo per reg scanning loop early.
Exit this loop early to avoid pointless iterations later. Move the resource bos to the first two regs, it actually doesn't matter which regs we use for this in resource land. Signed-off-by: Dave Airlie <[email protected]>
-rw-r--r--src/gallium/winsys/r600/drm/evergreen_hw_context.c8
-rw-r--r--src/gallium/winsys/r600/drm/r600_hw_context.c14
2 files changed, 13 insertions, 9 deletions
diff --git a/src/gallium/winsys/r600/drm/evergreen_hw_context.c b/src/gallium/winsys/r600/drm/evergreen_hw_context.c
index a95182773a7..11514156cd0 100644
--- a/src/gallium/winsys/r600/drm/evergreen_hw_context.c
+++ b/src/gallium/winsys/r600/drm/evergreen_hw_context.c
@@ -824,10 +824,10 @@ static const struct r600_reg cayman_context_reg_list[] = {
static int r600_resource_range_init(struct r600_context *ctx, struct r600_range *range, unsigned offset, unsigned nblocks, unsigned stride)
{
struct r600_reg r600_shader_resource[] = {
- {R_030000_RESOURCE0_WORD0, 0, 0, 0},
- {R_030004_RESOURCE0_WORD1, 0, 0, 0},
- {R_030008_RESOURCE0_WORD2, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
- {R_03000C_RESOURCE0_WORD3, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {R_030000_RESOURCE0_WORD0, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {R_030004_RESOURCE0_WORD1, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {R_030008_RESOURCE0_WORD2, 0, 0, 0},
+ {R_03000C_RESOURCE0_WORD3, 0, 0, 0},
{R_030010_RESOURCE0_WORD4, 0, 0, 0},
{R_030014_RESOURCE0_WORD5, 0, 0, 0},
{R_030018_RESOURCE0_WORD6, 0, 0, 0},
diff --git a/src/gallium/winsys/r600/drm/r600_hw_context.c b/src/gallium/winsys/r600/drm/r600_hw_context.c
index 8d387c4e8f2..7db5a03bce4 100644
--- a/src/gallium/winsys/r600/drm/r600_hw_context.c
+++ b/src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -595,10 +595,10 @@ int r600_resource_init(struct r600_context *ctx, struct r600_range *range, unsig
static int r600_resource_range_init(struct r600_context *ctx, struct r600_range *range, unsigned offset, unsigned nblocks, unsigned stride)
{
struct r600_reg r600_shader_resource[] = {
- {R_038000_RESOURCE0_WORD0, 0, 0, 0},
- {R_038004_RESOURCE0_WORD1, 0, 0, 0},
- {R_038008_RESOURCE0_WORD2, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
- {R_03800C_RESOURCE0_WORD3, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {R_038000_RESOURCE0_WORD0, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {R_038004_RESOURCE0_WORD1, REG_FLAG_NEED_BO, S_0085F0_TC_ACTION_ENA(1) | S_0085F0_VC_ACTION_ENA(1), 0xFFFFFFFF},
+ {R_038008_RESOURCE0_WORD2, 0, 0, 0},
+ {R_03800C_RESOURCE0_WORD3, 0, 0, 0},
{R_038010_RESOURCE0_WORD4, 0, 0, 0},
{R_038014_RESOURCE0_WORD5, 0, 0, 0},
{R_038018_RESOURCE0_WORD6, 0, 0, 0},
@@ -1254,12 +1254,13 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
int optional = block->nbo == 0 && !(block->flags & REG_FLAG_DIRTY_ALWAYS);
int cp_dwords = block->pm4_ndwords, start_dword = 0;
int new_dwords = 0;
+ int nbo = block->nbo;
if (block->nreg_dirty == 0 && optional) {
goto out;
}
- if (block->nbo) {
+ if (nbo) {
ctx->flags |= R600_CONTEXT_CHECK_EVENT_FLUSH;
for (int j = 0; j < block->nreg; j++) {
@@ -1273,6 +1274,9 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
block->reloc[id].flush_flags,
block->reloc[id].flush_mask,
block->reloc[id].bo);
+ nbo--;
+ if (nbo == 0)
+ break;
}
}
ctx->flags &= ~R600_CONTEXT_CHECK_EVENT_FLUSH;