r600g: simplify block relocation
authorJerome Glisse <jglisse@redhat.com>
Tue, 5 Oct 2010 19:23:07 +0000 (15:23 -0400)
committerJerome Glisse <jglisse@redhat.com>
Tue, 5 Oct 2010 19:23:07 +0000 (15:23 -0400)
Since flush rework there could be only one relocation per
register in a block.

Signed-off-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/drivers/r600/r600.h
src/gallium/winsys/r600/drm/r600_hw_context.c
src/gallium/winsys/r600/drm/r600_priv.h

index acacec0c413dc5437f92451bfac65a4a698dacf2..630177d6addbe91ecdce2aed5b34c0f7855161e1 100644 (file)
@@ -152,11 +152,10 @@ static inline void r600_pipe_state_add_reg(struct r600_pipe_state *state,
 #define R600_BLOCK_STATUS_DIRTY                (1 << 1)
 
 struct r600_block_reloc {
-       struct r600_bo  *bo;
-       unsigned                nreloc;
+       struct r600_bo          *bo;
        unsigned                flush_flags;
        unsigned                flush_mask;
-       unsigned                bo_pm4_index[R600_BLOCK_MAX_BO];
+       unsigned                bo_pm4_index;
 };
 
 struct r600_block {
index 5019c26df05cdf0fec1bb479b35ab072fcc1463f..b379499f0603bf5329196af2eb7ddb4c7044cdf4 100644 (file)
@@ -96,7 +96,7 @@ int r600_context_add_block(struct r600_context *ctx, const struct r600_reg *reg,
                                block->pm4[block->pm4_ndwords++] = 0x00000000;
                                block->reloc[block->nbo].flush_flags = reg[i+j].flush_flags;
                                block->reloc[block->nbo].flush_mask = reg[i+j].flush_mask;
-                               block->reloc[block->nbo].bo_pm4_index[block->reloc[block->nbo].nreloc++] = block->pm4_ndwords - 1;
+                               block->reloc[block->nbo].bo_pm4_index = block->pm4_ndwords - 1;
                        }
                }
                for (j = 0; j < n; j++) {
index 9a38cc51f700c462c6727978e8804ba1cce32f7f..ea2cf34778549341db2c9d524fef931e5a193242 100644 (file)
@@ -149,15 +149,13 @@ static inline void r600_context_block_emit_dirty(struct r600_context *ctx, struc
                if (block->pm4_bo_index[j]) {
                        /* find relocation */
                        id = block->pm4_bo_index[j];
-                       for (int k = 0; k < block->reloc[id].nreloc; k++) {
-                               r600_context_bo_reloc(ctx,
-                                       &block->pm4[block->reloc[id].bo_pm4_index[k]],
+                       r600_context_bo_reloc(ctx,
+                                       &block->pm4[block->reloc[id].bo_pm4_index],
+                                       block->reloc[id].bo);
+                       r600_context_bo_flush(ctx,
+                                       block->reloc[id].flush_flags,
+                                       block->reloc[id].flush_mask,
                                        block->reloc[id].bo);
-                               r600_context_bo_flush(ctx,
-                                                       block->reloc[id].flush_flags,
-                                                       block->reloc[id].flush_mask,
-                                                       block->reloc[id].bo);
-                       }
                }
        }
        memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4);