r600g: revert commit 68cc6bc5d8b6986acc7f5780d705f4ae9be2a446
authorChristian König <deathsimple@vodafone.de>
Tue, 26 Apr 2011 17:09:10 +0000 (19:09 +0200)
committerChristian König <deathsimple@vodafone.de>
Tue, 26 Apr 2011 17:09:45 +0000 (19:09 +0200)
Revert commit "remove the unneeded bo from COLOR[0-9]_INFO
Also implement a working alternative.

src/gallium/winsys/r600/drm/r600_hw_context.c

index 6be05bd90f8866beabd8b84e734da3649e4f1c61..935ac07802eabf2d7a4e0691fcd9138e7009cdd2 100644 (file)
@@ -199,7 +199,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028040_CB_COLOR0_BASE, REG_FLAG_NEED_BO, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A0_CB_COLOR0_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028060_CB_COLOR0_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028080_CB_COLOR0_VIEW, 0, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
@@ -210,7 +210,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028044_CB_COLOR1_BASE, REG_FLAG_NEED_BO, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A4_CB_COLOR1_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028064_CB_COLOR1_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028084_CB_COLOR1_VIEW, 0, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
@@ -221,7 +221,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028048_CB_COLOR2_BASE, REG_FLAG_NEED_BO, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280A8_CB_COLOR2_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028068_CB_COLOR2_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028088_CB_COLOR2_VIEW, 0, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
@@ -232,7 +232,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02804C_CB_COLOR3_BASE, REG_FLAG_NEED_BO, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280AC_CB_COLOR3_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02806C_CB_COLOR3_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02808C_CB_COLOR3_VIEW, 0, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
@@ -243,7 +243,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028050_CB_COLOR4_BASE, REG_FLAG_NEED_BO, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B0_CB_COLOR4_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028070_CB_COLOR4_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028090_CB_COLOR4_VIEW, 0, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
@@ -254,7 +254,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028054_CB_COLOR5_BASE, REG_FLAG_NEED_BO, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B4_CB_COLOR5_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028074_CB_COLOR5_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028094_CB_COLOR5_VIEW, 0, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
@@ -263,7 +263,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280D4_CB_COLOR5_TILE, REG_FLAG_NEED_BO, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028114_CB_COLOR5_MASK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028058_CB_COLOR6_BASE, REG_FLAG_NEED_BO, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280B8_CB_COLOR6_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028078_CB_COLOR6_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_028098_CB_COLOR6_VIEW, 0, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
@@ -274,7 +274,7 @@ static const struct r600_reg r600_context_reg_list[] = {
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02805C_CB_COLOR7_BASE, REG_FLAG_NEED_BO, 0, 0},
        {0, 0, GROUP_FORCE_NEW_BLOCK, 0, 0, 0},
-       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, 0, 0, 0xFFFFFFFF},
+       {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280BC_CB_COLOR7_INFO, REG_FLAG_NEED_BO, 0, 0xFFFFFFFF},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02807C_CB_COLOR7_SIZE, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_02809C_CB_COLOR7_VIEW, 0, 0, 0},
        {PKT3_SET_CONTEXT_REG, R600_CONTEXT_REG_OFFSET, R_0280FC_CB_COLOR7_FRAG, REG_FLAG_NEED_BO, 0, 0},
@@ -902,7 +902,7 @@ void r600_context_pipe_state_set(struct r600_context *ctx, struct r600_pipe_stat
                }
                if (block->flags & REG_FLAG_DIRTY_ALWAYS)
                        dirty |= R600_BLOCK_STATUS_DIRTY;
-               if (block->pm4_bo_index[id]) {
+               if (block->pm4_bo_index[id] && state->regs[i].bo) {
                        /* find relocation */
                        reloc_id = block->pm4_bo_index[id];
                        r600_bo_reference(ctx->radeon, &block->reloc[reloc_id].bo, state->regs[i].bo);
@@ -1124,13 +1124,15 @@ void r600_context_block_emit_dirty(struct r600_context *ctx, struct r600_block *
                if (block->pm4_bo_index[j]) {
                        /* find relocation */
                        id = block->pm4_bo_index[j];
-                       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);
+                       if (block->reloc[id].bo) {
+                               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);
+                       }
                }
        }
        memcpy(&ctx->pm4[ctx->pm4_cdwords], block->pm4, block->pm4_ndwords * 4);