From: Nicolai Hähnle <nicolai.haeh...@amd.com>

The callee can derive the current enable state itself.
---
 src/gallium/drivers/r600/r600_state_common.c  | 4 +++-
 src/gallium/drivers/radeon/r600_pipe_common.h | 4 +++-
 src/gallium/drivers/radeon/r600_query.c       | 3 ++-
 src/gallium/drivers/radeonsi/si_state.c       | 4 +++-
 4 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c 
b/src/gallium/drivers/r600/r600_state_common.c
index c1bce8304b2..d9b47299b6e 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2903,21 +2903,23 @@ static void r600_set_active_query_state(struct 
pipe_context *ctx, boolean enable
                rctx->b.flags |= R600_CONTEXT_STOP_PIPELINE_STATS;
        }
 
        /* Occlusion queries. */
        if (rctx->db_misc_state.occlusion_queries_disabled != !enable) {
                rctx->db_misc_state.occlusion_queries_disabled = !enable;
                r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom);
        }
 }
 
-static void r600_set_occlusion_query_state(struct pipe_context *ctx, bool 
enable)
+static void r600_set_occlusion_query_state(struct pipe_context *ctx,
+                                          bool old_enable,
+                                          bool old_perfect_enable)
 {
        struct r600_context *rctx = (struct r600_context*)ctx;
 
        r600_mark_atom_dirty(rctx, &rctx->db_misc_state.atom);
 }
 
 static void r600_need_gfx_cs_space(struct pipe_context *ctx, unsigned num_dw,
                                    bool include_draw_vbo)
 {
        r600_need_cs_space((struct r600_context*)ctx, num_dw, include_draw_vbo);
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h 
b/src/gallium/drivers/radeon/r600_pipe_common.h
index 42480ec84b0..ed93d99669f 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -697,21 +697,23 @@ struct r600_common_context {
         * the buffer is bound, including all resource descriptors. */
        void (*invalidate_buffer)(struct pipe_context *ctx, struct 
pipe_resource *buf);
 
        /* Update all resource bindings where the buffer is bound, including
         * all resource descriptors. This is invalidate_buffer without
         * the invalidation. */
        void (*rebind_buffer)(struct pipe_context *ctx, struct pipe_resource 
*buf,
                              uint64_t old_gpu_address);
 
        /* Enable or disable occlusion queries. */
-       void (*set_occlusion_query_state)(struct pipe_context *ctx, bool 
enable);
+       void (*set_occlusion_query_state)(struct pipe_context *ctx,
+                                         bool old_enable,
+                                         bool old_perfect_enable);
 
        void (*save_qbo_state)(struct pipe_context *ctx, struct r600_qbo_state 
*st);
 
        /* This ensures there is enough space in the command stream. */
        void (*need_gfx_cs_space)(struct pipe_context *ctx, unsigned num_dw,
                                  bool include_draw_vbo);
 
        void (*set_atom_dirty)(struct r600_common_context *ctx,
                               struct r600_atom *atom, bool dirty);
 
diff --git a/src/gallium/drivers/radeon/r600_query.c 
b/src/gallium/drivers/radeon/r600_query.c
index 03ff1018a71..8c2efda356f 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -703,21 +703,22 @@ static void r600_update_occlusion_query_state(struct 
r600_common_context *rctx,
 
                if (type == PIPE_QUERY_OCCLUSION_COUNTER) {
                        rctx->num_perfect_occlusion_queries += diff;
                        assert(rctx->num_perfect_occlusion_queries >= 0);
                }
 
                enable = rctx->num_occlusion_queries != 0;
                perfect_enable = rctx->num_perfect_occlusion_queries != 0;
 
                if (enable != old_enable || perfect_enable != 
old_perfect_enable) {
-                       rctx->set_occlusion_query_state(&rctx->b, enable);
+                       rctx->set_occlusion_query_state(&rctx->b, old_enable,
+                                                       old_perfect_enable);
                }
        }
 }
 
 static unsigned event_type_for_stream(unsigned stream)
 {
        switch (stream) {
        default:
        case 0: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS;
        case 1: return EVENT_TYPE_SAMPLE_STREAMOUTSTATS1;
diff --git a/src/gallium/drivers/radeonsi/si_state.c 
b/src/gallium/drivers/radeonsi/si_state.c
index ee070107fd5..6978c6ca9a2 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -1184,21 +1184,23 @@ static void si_set_active_query_state(struct 
pipe_context *ctx, boolean enable)
                sctx->b.flags |= R600_CONTEXT_STOP_PIPELINE_STATS;
        }
 
        /* Occlusion queries. */
        if (sctx->occlusion_queries_disabled != !enable) {
                sctx->occlusion_queries_disabled = !enable;
                si_mark_atom_dirty(sctx, &sctx->db_render_state);
        }
 }
 
-static void si_set_occlusion_query_state(struct pipe_context *ctx, bool enable)
+static void si_set_occlusion_query_state(struct pipe_context *ctx,
+                                        bool old_enable,
+                                        bool old_perfect_enable)
 {
        struct si_context *sctx = (struct si_context*)ctx;
 
        si_mark_atom_dirty(sctx, &sctx->db_render_state);
 }
 
 static void si_save_qbo_state(struct pipe_context *ctx, struct r600_qbo_state 
*st)
 {
        struct si_context *sctx = (struct si_context*)ctx;
 
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to