gallium/radeon: formalize that r600_query_hw_add_result doesn't need a context
authorMarek Olšák <marek.olsak@amd.com>
Sun, 12 Mar 2017 20:26:22 +0000 (21:26 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 30 Mar 2017 14:09:36 +0000 (16:09 +0200)
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
Tested-by: Edmondo Tommasina <edmondo.tommasina@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/gallium/drivers/radeon/r600_perfcounter.c
src/gallium/drivers/radeon/r600_query.c
src/gallium/drivers/radeon/r600_query.h

index bf24aabba0b7ef6aa496ef9f9266aa2da0c7cfa1..48f609bcb41c6998d80a107d173ca9381e9d6523 100644 (file)
@@ -196,7 +196,7 @@ static void r600_pc_query_clear_result(struct r600_query_hw *hwquery,
        memset(result, 0, sizeof(result->batch[0]) * query->num_counters);
 }
 
-static void r600_pc_query_add_result(struct r600_common_context *ctx,
+static void r600_pc_query_add_result(struct r600_common_screen *rscreen,
                                     struct r600_query_hw *hwquery,
                                     void *buffer,
                                     union pipe_query_result *result)
index dcd217b155b8d258562c8e6527752db0751829d6..cb90850a5054f298ac25659f33794e12c91c92da 100644 (file)
@@ -515,7 +515,7 @@ static void r600_query_hw_do_emit_stop(struct r600_common_context *ctx,
                                       struct r600_query_hw *query,
                                       struct r600_resource *buffer,
                                       uint64_t va);
-static void r600_query_hw_add_result(struct r600_common_context *ctx,
+static void r600_query_hw_add_result(struct r600_common_screen *rscreen,
                                     struct r600_query_hw *, void *buffer,
                                     union pipe_query_result *result);
 static void r600_query_hw_clear_result(struct r600_query_hw *,
@@ -1046,12 +1046,12 @@ static unsigned r600_query_read_result(void *map, unsigned start_index, unsigned
        return 0;
 }
 
-static void r600_query_hw_add_result(struct r600_common_context *ctx,
+static void r600_query_hw_add_result(struct r600_common_screen *rscreen,
                                     struct r600_query_hw *query,
                                     void *buffer,
                                     union pipe_query_result *result)
 {
-       unsigned max_rbs = ctx->screen->info.num_render_backends;
+       unsigned max_rbs = rscreen->info.num_render_backends;
 
        switch (query->b.type) {
        case PIPE_QUERY_OCCLUSION_COUNTER: {
@@ -1101,7 +1101,7 @@ static void r600_query_hw_add_result(struct r600_common_context *ctx,
                        r600_query_read_result(buffer, 0, 4, true);
                break;
        case PIPE_QUERY_PIPELINE_STATISTICS:
-               if (ctx->chip_class >= EVERGREEN) {
+               if (rscreen->chip_class >= EVERGREEN) {
                        result->pipeline_statistics.ps_invocations +=
                                r600_query_read_result(buffer, 0, 22, false);
                        result->pipeline_statistics.c_primitives +=
@@ -1199,6 +1199,7 @@ bool r600_query_hw_get_result(struct r600_common_context *rctx,
                              struct r600_query *rquery,
                              bool wait, union pipe_query_result *result)
 {
+       struct r600_common_screen *rscreen = rctx->screen;
        struct r600_query_hw *query = (struct r600_query_hw *)rquery;
        struct r600_query_buffer *qbuf;
 
@@ -1215,7 +1216,7 @@ bool r600_query_hw_get_result(struct r600_common_context *rctx,
                        return false;
 
                while (results_base != qbuf->results_end) {
-                       query->ops->add_result(rctx, query, map + results_base,
+                       query->ops->add_result(rscreen, query, map + results_base,
                                               result);
                        results_base += query->result_size;
                }
@@ -1224,7 +1225,7 @@ bool r600_query_hw_get_result(struct r600_common_context *rctx,
        /* Convert the time to expected units. */
        if (rquery->type == PIPE_QUERY_TIME_ELAPSED ||
            rquery->type == PIPE_QUERY_TIMESTAMP) {
-               result->u64 = (1000000 * result->u64) / rctx->screen->info.clock_crystal_freq;
+               result->u64 = (1000000 * result->u64) / rscreen->info.clock_crystal_freq;
        }
        return true;
 }
index d39663a392b3e372b7b6e2c031afed7124dfe562..b9ab44ca3f757ea814fd39ef75466a70b5a9f043 100644 (file)
@@ -152,7 +152,7 @@ struct r600_query_hw_ops {
                          struct r600_query_hw *,
                          struct r600_resource *buffer, uint64_t va);
        void (*clear_result)(struct r600_query_hw *, union pipe_query_result *);
-       void (*add_result)(struct r600_common_context *ctx,
+       void (*add_result)(struct r600_common_screen *screen,
                           struct r600_query_hw *, void *buffer,
                           union pipe_query_result *result);
 };