From: Marek Olšák Date: Sat, 7 Jul 2012 15:11:32 +0000 (+0200) Subject: r600g: set DISABLE in CB_COLOR_CONTROL if colormask is 0 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=43e3f19c766863a655bb9f7c04f7820cbda0c8f5;p=mesa.git r600g: set DISABLE in CB_COLOR_CONTROL if colormask is 0 this will be useful for in-place DB decompression, otherwise should be harmless Reviewed-by: Alex Deucher --- diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index bc8f41298d6..404df026f10 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -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 */ diff --git a/src/gallium/drivers/r600/evergreend.h b/src/gallium/drivers/r600/evergreend.h index a067ad260dc..6c4873cd994 100644 --- a/src/gallium/drivers/r600/evergreend.h +++ b/src/gallium/drivers/r600/evergreend.h @@ -482,6 +482,8 @@ #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 diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 9bbb63fc2ae..c261797225d 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -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 */ diff --git a/src/gallium/drivers/r600/r600d.h b/src/gallium/drivers/r600/r600d.h index ab36d73b14f..c9f842270cc 100644 --- a/src/gallium/drivers/r600/r600d.h +++ b/src/gallium/drivers/r600/r600d.h @@ -418,6 +418,8 @@ #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)