From 4b064d16e575ff7155cdcc63f0496ad6b5bc20c7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Wed, 1 Mar 2017 19:24:42 +0100 Subject: [PATCH] gallium/radeon: formalize that create_batch_query doesn't need pipe_context Reviewed-by: Timothy Arceri --- src/gallium/drivers/radeon/r600_perfcounter.c | 12 ++++++------ src/gallium/drivers/radeon/r600_query.c | 9 ++++----- src/gallium/drivers/radeon/r600_query.h | 4 ++-- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c b/src/gallium/drivers/radeon/r600_perfcounter.c index 0c2c6e9bf5e..bf24aabba0b 100644 --- a/src/gallium/drivers/radeon/r600_perfcounter.c +++ b/src/gallium/drivers/radeon/r600_perfcounter.c @@ -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; } diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index d83426116c7..e269c39f296 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -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, diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h index 052034af385..d39663a392b 100644 --- a/src/gallium/drivers/radeon/r600_query.h +++ b/src/gallium/drivers/radeon/r600_query.h @@ -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); -- 2.30.2