[Mesa-dev] [PATCH 2/2] radeonsi: handle pipe_depth_state::disable_occlusion_queries

Marek Olšák maraeo at gmail.com
Thu Apr 7 01:00:41 UTC 2016


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

+ 2 piglits
---
 src/gallium/drivers/radeonsi/si_state.c | 11 ++++++++++-
 src/gallium/drivers/radeonsi/si_state.h |  1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index 297fe78..f26b8c7 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1269,6 +1269,7 @@ static void *si_create_dsa_state(struct pipe_context *ctx,
 		return NULL;
 	}
 
+	dsa->disable_occlusion_queries = state->depth.disable_occlusion_queries;
 	dsa->stencil_ref.valuemask[0] = state->stencil[0].valuemask;
 	dsa->stencil_ref.valuemask[1] = state->stencil[1].valuemask;
 	dsa->stencil_ref.writemask[0] = state->stencil[0].writemask;
@@ -1320,6 +1321,9 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state)
 {
         struct si_context *sctx = (struct si_context *)ctx;
         struct si_state_dsa *dsa = state;
+	struct si_state_dsa *old_dsa = sctx->queued.named.dsa;
+	bool old_disable_occ_queries =
+		old_dsa && old_dsa->disable_occlusion_queries;
 
         if (!state)
                 return;
@@ -1331,6 +1335,9 @@ static void si_bind_dsa_state(struct pipe_context *ctx, void *state)
 		sctx->stencil_ref.dsa_part = dsa->stencil_ref;
 		si_mark_atom_dirty(sctx, &sctx->stencil_ref.atom);
 	}
+
+	if (old_disable_occ_queries != dsa->disable_occlusion_queries)
+		si_mark_atom_dirty(sctx, &sctx->db_render_state);
 }
 
 static void si_delete_dsa_state(struct pipe_context *ctx, void *state)
@@ -1358,6 +1365,7 @@ static void si_set_occlusion_query_state(struct pipe_context *ctx, bool enable)
 static void si_emit_db_render_state(struct si_context *sctx, struct r600_atom *state)
 {
 	struct radeon_winsys_cs *cs = sctx->b.gfx.cs;
+	struct si_state_dsa *dsa = sctx->queued.named.dsa;
 	struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
 	unsigned db_shader_control;
 
@@ -1382,7 +1390,8 @@ static void si_emit_db_render_state(struct si_context *sctx, struct r600_atom *s
 	}
 
 	/* DB_COUNT_CONTROL (occlusion queries) */
-	if (sctx->b.num_occlusion_queries > 0) {
+	if (sctx->b.num_occlusion_queries > 0 &&
+	    (!dsa || !dsa->disable_occlusion_queries)) {
 		bool perfect = sctx->b.num_perfect_occlusion_queries > 0;
 
 		if (sctx->b.chip_class >= CIK) {
diff --git a/src/gallium/drivers/radeonsi/si_state.h b/src/gallium/drivers/radeonsi/si_state.h
index 2a63279..ae15360 100644
--- a/src/gallium/drivers/radeonsi/si_state.h
+++ b/src/gallium/drivers/radeonsi/si_state.h
@@ -79,6 +79,7 @@ struct si_dsa_stencil_ref_part {
 struct si_state_dsa {
 	struct si_pm4_state		pm4;
 	unsigned			alpha_func;
+	bool				disable_occlusion_queries;
 	struct si_dsa_stencil_ref_part	stencil_ref;
 };
 
-- 
2.5.0



More information about the mesa-dev mailing list