[Mesa-dev] [PATCH 2/2] r600: cleanup set_occlusion_query_state

Nicolai Hähnle nhaehnle at gmail.com
Thu Sep 28 19:55:28 UTC 2017


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

This fixes a warning caused by the fork (note the change in the function
signature):

../../../../../mesa-src/src/gallium/drivers/r600/r600_state_common.c: In function ‘r600_init_common_state_functions’:
../../../../../mesa-src/src/gallium/drivers/r600/r600_state_common.c:2974:36: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
  rctx->b.set_occlusion_query_state = r600_set_occlusion_query_state;
---
 src/gallium/drivers/r600/r600_pipe_common.h  |  3 ---
 src/gallium/drivers/r600/r600_query.c        |  4 +++-
 src/gallium/drivers/r600/r600_state_common.c | 10 ----------
 3 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_pipe_common.h b/src/gallium/drivers/r600/r600_pipe_common.h
index 39dd45aaceb..719efb9bbab 100644
--- a/src/gallium/drivers/r600/r600_pipe_common.h
+++ b/src/gallium/drivers/r600/r600_pipe_common.h
@@ -696,23 +696,20 @@ struct r600_common_context {
 	/* Reallocate the buffer and update all resource bindings where
 	 * 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 (*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);
 
 	void (*check_vm_faults)(struct r600_common_context *ctx,
diff --git a/src/gallium/drivers/r600/r600_query.c b/src/gallium/drivers/r600/r600_query.c
index 03ff1018a71..4c6311c79e0 100644
--- a/src/gallium/drivers/r600/r600_query.c
+++ b/src/gallium/drivers/r600/r600_query.c
@@ -16,20 +16,21 @@
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  * USE OR OTHER DEALINGS IN THE SOFTWARE.
  */
 
 #include "r600_query.h"
+#include "r600_pipe.h"
 #include "r600_cs.h"
 #include "util/u_memory.h"
 #include "util/u_upload_mgr.h"
 #include "os/os_time.h"
 #include "tgsi/tgsi_text.h"
 
 #define R600_MAX_STREAMS 4
 
 struct r600_hw_query_params {
 	unsigned start_offset;
@@ -703,21 +704,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);
+			struct r600_context *ctx = (struct r600_context*)rctx;
+			r600_mark_atom_dirty(ctx, &ctx->db_misc_state.atom);
 		}
 	}
 }
 
 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/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 38f4ca0fc46..7e2b34bf798 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -2907,29 +2907,20 @@ 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 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);
 }
 
 /* keep this at the end of this file, please */
 void r600_init_common_state_functions(struct r600_context *rctx)
 {
 	rctx->b.b.create_fs_state = r600_create_ps_state;
@@ -2964,13 +2955,12 @@ void r600_init_common_state_functions(struct r600_context *rctx)
 	rctx->b.b.set_sample_mask = r600_set_sample_mask;
 	rctx->b.b.set_stencil_ref = r600_set_pipe_stencil_ref;
 	rctx->b.b.set_vertex_buffers = r600_set_vertex_buffers;
 	rctx->b.b.set_sampler_views = r600_set_sampler_views;
 	rctx->b.b.sampler_view_destroy = r600_sampler_view_destroy;
 	rctx->b.b.texture_barrier = r600_texture_barrier;
 	rctx->b.b.set_stream_output_targets = r600_set_streamout_targets;
 	rctx->b.b.set_active_query_state = r600_set_active_query_state;
 	rctx->b.b.draw_vbo = r600_draw_vbo;
 	rctx->b.invalidate_buffer = r600_invalidate_buffer;
-	rctx->b.set_occlusion_query_state = r600_set_occlusion_query_state;
 	rctx->b.need_gfx_cs_space = r600_need_gfx_cs_space;
 }
-- 
2.11.0



More information about the mesa-dev mailing list