gallium/radeon: formalize that create_batch_query doesn't need pipe_context
authorMarek Olšák <marek.olsak@amd.com>
Wed, 1 Mar 2017 18:24:42 +0000 (19:24 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 17 Mar 2017 17:30:21 +0000 (18:30 +0100)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
src/gallium/drivers/radeon/r600_perfcounter.c
src/gallium/drivers/radeon/r600_query.c
src/gallium/drivers/radeon/r600_query.h

index 0c2c6e9bf5ebd2dfc6566718c12cd9715f830d21..bf24aabba0b7ef6aa496ef9f9266aa2da0c7cfa1 100644 (file)
@@ -99,7 +99,7 @@ struct r600_query_pc {
        struct r600_pc_group *groups;
 };
 
-static void r600_pc_query_destroy(struct r600_common_context *ctx,
+static void r600_pc_query_destroy(struct r600_common_screen *rscreen,
                                  struct r600_query *rquery)
 {
        struct r600_query_pc *query = (struct r600_query_pc *)rquery;
@@ -112,7 +112,7 @@ static void r600_pc_query_destroy(struct r600_common_context *ctx,
 
        FREE(query->counters);
 
-       r600_query_hw_destroy(ctx, rquery);
+       r600_query_hw_destroy(rscreen, rquery);
 }
 
 static bool r600_pc_query_prepare_buffer(struct r600_common_screen *screen,
@@ -301,8 +301,8 @@ struct pipe_query *r600_create_batch_query(struct pipe_context *ctx,
                                           unsigned num_queries,
                                           unsigned *query_types)
 {
-       struct r600_common_context *rctx = (struct r600_common_context *)ctx;
-       struct r600_common_screen *screen = rctx->screen;
+       struct r600_common_screen *screen =
+               (struct r600_common_screen *)ctx->screen;
        struct r600_perfcounters *pc = screen->perfcounters;
        struct r600_perfcounter_block *block;
        struct r600_pc_group *group;
@@ -365,7 +365,7 @@ struct pipe_query *r600_create_batch_query(struct pipe_context *ctx,
                unsigned instances = 1;
 
                if ((block->flags & R600_PC_BLOCK_SE) && group->se < 0)
-                       instances = rctx->screen->info.max_se;
+                       instances = screen->info.max_se;
                if (group->instance < 0)
                        instances *= block->num_instances;
 
@@ -423,7 +423,7 @@ struct pipe_query *r600_create_batch_query(struct pipe_context *ctx,
        return (struct pipe_query *)query;
 
 error:
-       r600_pc_query_destroy(rctx, &query->b.b);
+       r600_pc_query_destroy(screen, &query->b.b);
        return NULL;
 }
 
index d83426116c7d4988e525fbfcb2c3c0c3258681ca..e269c39f296dae404b779f4bee3d08666289ad4b 100644 (file)
@@ -51,13 +51,12 @@ struct r600_query_sw {
        struct pipe_fence_handle *fence;
 };
 
-static void r600_query_sw_destroy(struct r600_common_context *rctx,
+static void r600_query_sw_destroy(struct r600_common_screen *rscreen,
                                  struct r600_query *rquery)
 {
-       struct pipe_screen *screen = rctx->b.screen;
        struct r600_query_sw *query = (struct r600_query_sw *)rquery;
 
-       screen->fence_reference(screen, &query->fence, NULL);
+       rscreen->b.fence_reference(&rscreen->b, &query->fence, NULL);
        FREE(query);
 }
 
@@ -414,7 +413,7 @@ static struct pipe_query *r600_query_sw_create(unsigned query_type)
        return (struct pipe_query *)query;
 }
 
-void r600_query_hw_destroy(struct r600_common_context *rctx,
+void r600_query_hw_destroy(struct r600_common_screen *rscreen,
                           struct r600_query *rquery)
 {
        struct r600_query_hw *query = (struct r600_query_hw *)rquery;
@@ -876,7 +875,7 @@ static void r600_destroy_query(struct pipe_context *ctx, struct pipe_query *quer
        struct r600_common_context *rctx = (struct r600_common_context *)ctx;
        struct r600_query *rquery = (struct r600_query *)query;
 
-       rquery->ops->destroy(rctx, rquery);
+       rquery->ops->destroy(rctx->screen, rquery);
 }
 
 static boolean r600_begin_query(struct pipe_context *ctx,
index 052034af3857c42fd8735c4581dad67cd421ae45..d39663a392b3e372b7b6e2c031afed7124dfe562 100644 (file)
@@ -113,7 +113,7 @@ enum {
 };
 
 struct r600_query_ops {
-       void (*destroy)(struct r600_common_context *, struct r600_query *);
+       void (*destroy)(struct r600_common_screen *, struct r600_query *);
        bool (*begin)(struct r600_common_context *, struct r600_query *);
        bool (*end)(struct r600_common_context *, struct r600_query *);
        bool (*get_result)(struct r600_common_context *,
@@ -189,7 +189,7 @@ struct r600_query_hw {
 
 bool r600_query_hw_init(struct r600_common_screen *rscreen,
                        struct r600_query_hw *query);
-void r600_query_hw_destroy(struct r600_common_context *rctx,
+void r600_query_hw_destroy(struct r600_common_screen *rscreen,
                           struct r600_query *rquery);
 bool r600_query_hw_begin(struct r600_common_context *rctx,
                         struct r600_query *rquery);