[Mesa-dev] [PATCH 16/22] r600g: set DISABLE in CB_COLOR_CONTROL if colormask is 0

Marek Olšák maraeo at gmail.com
Mon Jul 9 12:15:49 PDT 2012


this will be useful for in-place DB decompression, otherwise should be harmless
---
 src/gallium/drivers/r600/evergreen_state.c |   10 +++++++---
 src/gallium/drivers/r600/evergreend.h      |    2 ++
 src/gallium/drivers/r600/r600_state.c      |    6 ++++++
 src/gallium/drivers/r600/r600d.h           |    2 ++
 4 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c
index 2ca6bc7..58a5052 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 a067ad2..6c4873c 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 9bbb63f..c261797 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 ab36d73..c9f8422 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)
-- 
1.7.9.5



More information about the mesa-dev mailing list