[Mesa-dev] [PATCH 09/10] radeon: expose r600_query_hw functions for reuse

Nicolai Hähnle nhaehnle at gmail.com
Fri Nov 13 08:10:10 PST 2015


---
 src/gallium/drivers/radeon/r600_query.c | 30 +++++++++++++++++-------------
 src/gallium/drivers/radeon/r600_query.h | 10 ++++++++++
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c
index 59e2a58..4f89634 100644
--- a/src/gallium/drivers/radeon/r600_query.c
+++ b/src/gallium/drivers/radeon/r600_query.c
@@ -282,11 +282,6 @@ static void r600_query_hw_prepare_buffer(struct r600_common_context *ctx,
 	}
 }
 
-static boolean r600_query_hw_begin(struct r600_common_context *, struct r600_query *);
-static void r600_query_hw_end(struct r600_common_context *, struct r600_query *);
-static boolean r600_query_hw_get_result(struct r600_common_context *,
-					struct r600_query *, boolean wait,
-					union pipe_query_result *result);
 static void r600_do_render_condition(struct r600_common_context *,
 				     struct r600_query *, boolean condition,
 				     uint mode);
@@ -321,6 +316,16 @@ static struct r600_query_hw_ops query_hw_default_hw_ops = {
 	.add_result = r600_query_hw_add_result,
 };
 
+boolean r600_query_hw_init(struct r600_common_context *rctx,
+			   struct r600_query_hw *query)
+{
+	query->buffer.buf = r600_new_query_buffer(rctx, query);
+	if (!query->buffer.buf)
+		return FALSE;
+
+	return TRUE;
+}
+
 static struct pipe_query *r600_query_hw_create(struct r600_common_context *rctx,
 					       unsigned query_type,
 					       unsigned index)
@@ -370,8 +375,7 @@ static struct pipe_query *r600_query_hw_create(struct r600_common_context *rctx,
 		return NULL;
 	}
 
-	query->buffer.buf = r600_new_query_buffer(rctx, query);
-	if (!query->buffer.buf) {
+	if (!r600_query_hw_init(rctx, query)) {
 		FREE(query);
 		return NULL;
 	}
@@ -645,8 +649,8 @@ static boolean r600_begin_query(struct pipe_context *ctx,
 	return rquery->ops->begin(rctx, rquery);
 }
 
-static boolean r600_query_hw_begin(struct r600_common_context *rctx,
-				   struct r600_query *rquery)
+boolean r600_query_hw_begin(struct r600_common_context *rctx,
+			    struct r600_query *rquery)
 {
 	struct r600_query_hw *query = (struct r600_query_hw *)rquery;
 	struct r600_query_buffer *prev = query->buffer.previous;
@@ -691,7 +695,7 @@ static void r600_end_query(struct pipe_context *ctx, struct pipe_query *query)
 	rquery->ops->end(rctx, rquery);
 }
 
-static void r600_query_hw_end(struct r600_common_context *rctx,
+void r600_query_hw_end(struct r600_common_context *rctx,
 			      struct r600_query *rquery)
 {
 	struct r600_query_hw *query = (struct r600_query_hw *)rquery;
@@ -858,9 +862,9 @@ static void r600_query_hw_clear_result(struct r600_query_hw *query,
 	util_query_clear_result(result, query->b.type);
 }
 
-static boolean r600_query_hw_get_result(struct r600_common_context *rctx,
-					struct r600_query *rquery,
-					boolean wait, union pipe_query_result *result)
+boolean r600_query_hw_get_result(struct r600_common_context *rctx,
+				 struct r600_query *rquery,
+				 boolean wait, union pipe_query_result *result)
 {
 	struct r600_query_hw *query = (struct r600_query_hw *)rquery;
 	struct r600_query_buffer *qbuf;
diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h
index 17a9da3..4e357f5 100644
--- a/src/gallium/drivers/radeon/r600_query.h
+++ b/src/gallium/drivers/radeon/r600_query.h
@@ -122,7 +122,17 @@ struct r600_query_hw {
 	unsigned stream;
 };
 
+boolean r600_query_hw_init(struct r600_common_context *rctx,
+			   struct r600_query_hw *query);
 void r600_query_hw_destroy(struct r600_common_context *rctx,
 			   struct r600_query *rquery);
+boolean r600_query_hw_begin(struct r600_common_context *rctx,
+			    struct r600_query *rquery);
+void r600_query_hw_end(struct r600_common_context *rctx,
+		       struct r600_query *rquery);
+boolean r600_query_hw_get_result(struct r600_common_context *rctx,
+				 struct r600_query *rquery,
+				 boolean wait,
+				 union pipe_query_result *result);
 
 #endif /* R600_QUERY_H */
-- 
2.5.0



More information about the mesa-dev mailing list