r600g: set DISABLE in CB_COLOR_CONTROL if colormask is 0
authorMarek Olšák <maraeo@gmail.com>
Sat, 7 Jul 2012 15:11:32 +0000 (17:11 +0200)
committerMarek Olšák <maraeo@gmail.com>
Thu, 12 Jul 2012 00:08:30 +0000 (02:08 +0200)
this will be useful for in-place DB decompression, otherwise should be harmless

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/evergreend.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600d.h

index bc8f412..404df02 100644 (file)
@@ -680,7 +680,7 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx,
        struct r600_context *rctx = (struct r600_context *)ctx;
        struct r600_pipe_blend *blend = CALLOC_STRUCT(r600_pipe_blend);
        struct r600_pipe_state *rstate;
-       uint32_t color_control, target_mask;
+       uint32_t color_control = 0, target_mask;
        /* XXX there is more then 8 framebuffer */
        unsigned blend_cntl[8];
 
@@ -693,7 +693,6 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx,
        rstate->id = R600_PIPE_STATE_BLEND;
 
        target_mask = 0;
-       color_control = S_028808_MODE(1);
        if (state->logicop_enable) {
                color_control |= (state->logicop_func << 16) | (state->logicop_func << 20);
        } else {
@@ -710,7 +709,12 @@ static void *evergreen_create_blend_state(struct pipe_context *ctx,
                }
        }
        blend->cb_target_mask = target_mask;
-       
+
+       if (target_mask)
+               color_control |= S_028808_MODE(V_028808_CB_NORMAL);
+       else
+               color_control |= S_028808_MODE(V_028808_CB_DISABLE);
+
        r600_pipe_state_add_reg(rstate, R_028808_CB_COLOR_CONTROL,
                                color_control);
        /* only have dual source on MRT0 */
index a067ad2..6c4873c 100644 (file)
 #define   S_028808_MODE(x)                             (((x) & 0x7) << 4)
 #define   G_028808_MODE(x)                             (((x) >> 4) & 0x7)
 #define   C_028808_MODE                                0xFFFFFF8F
+#define     V_028808_CB_DISABLE                                0
+#define     V_028808_CB_NORMAL                         1
 #define   S_028808_ROP3(x)                             (((x) & 0xFF) << 16)
 #define   G_028808_ROP3(x)                             (((x) >> 16) & 0xFF)
 #define   C_028808_ROP3                                0xFF00FFFF
index 9bbb63f..c261797 100644 (file)
@@ -718,6 +718,12 @@ static void *r600_create_blend_state(struct pipe_context *ctx,
                        target_mask |= (state->rt[0].colormask << (4 * i));
                }
        }
+
+       if (target_mask)
+               color_control |= S_028808_SPECIAL_OP(V_028808_NORMAL);
+       else
+               color_control |= S_028808_SPECIAL_OP(V_028808_DISABLE);
+
        blend->cb_target_mask = target_mask;
        blend->cb_color_control = color_control;
        /* only MRT0 has dual src blend */
index ab36d73..c9f8422 100644 (file)
 #define   G_028808_DEGAMMA_ENABLE(x)                   (((x) >> 3) & 0x1)
 #define   C_028808_DEGAMMA_ENABLE                      0xFFFFFFF7
 #define   S_028808_SPECIAL_OP(x)                       (((x) & 0x7) << 4)
+#define                V_028808_NORMAL                         0
+#define                V_028808_DISABLE                        1
 #define   G_028808_SPECIAL_OP(x)                       (((x) >> 4) & 0x7)
 #define   C_028808_SPECIAL_OP                          0xFFFFFF8F
 #define   S_028808_PER_MRT_BLEND(x)                    (((x) & 0x1) << 7)