[Mesa-dev] [PATCH 03/10] radeonsi: set the smallest possible CB_TARGET_MASK

Marek Olšák maraeo at gmail.com
Mon Nov 28 11:16:56 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

better safe than sorry; set_framebuffer_state always makes this dirty
---
 src/gallium/drivers/radeonsi/si_state.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index b4683c5..3e8e0c8 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -87,27 +87,27 @@ static unsigned si_pack_float_12p4(float x)
 /*
  * Inferred framebuffer and blender state.
  *
  * CB_TARGET_MASK is emitted here to avoid a hang with dual source blending
  * if there is not enough PS outputs.
  */
 static void si_emit_cb_render_state(struct si_context *sctx, struct r600_atom *atom)
 {
 	struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
 	struct si_state_blend *blend = sctx->queued.named.blend;
-	uint32_t cb_target_mask, i;
+	/* CB_COLORn_INFO.FORMAT=INVALID should disable unbound colorbuffers,
+	 * but you never know. */
+	uint32_t cb_target_mask = sctx->framebuffer.colorbuf_enabled_4bit;
+	unsigned i;
 
-	/* CB_COLORn_INFO.FORMAT=INVALID disables empty colorbuffer slots. */
 	if (blend)
-		cb_target_mask = blend->cb_target_mask;
-	else
-		cb_target_mask = 0xffffffff;
+		cb_target_mask &= blend->cb_target_mask;
 
 	/* Avoid a hang that happens when dual source blending is enabled
 	 * but there is not enough color outputs. This is undefined behavior,
 	 * so disable color writes completely.
 	 *
 	 * Reproducible with Unigine Heaven 4.0 and drirc missing.
 	 */
 	if (blend && blend->dual_src_blend &&
 	    sctx->ps_shader.cso &&
 	    (sctx->ps_shader.cso->info.colors_written & 0x3) != 0x3)
-- 
2.7.4



More information about the mesa-dev mailing list