radeonsi: remove unused query code
authorMarek Olšák <marek.olsak@amd.com>
Sun, 1 Apr 2018 17:51:09 +0000 (13:51 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 5 Apr 2018 19:34:58 +0000 (15:34 -0400)
The get_size perf counter callback is also inlined and removed.

Acked-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
src/gallium/drivers/radeonsi/si_perfcounter.c

index 711baef98175b77a0ed52b81a88e2a0ddc52da43..689f4a38edcd0af77d54575a49c148a15ba5d5d6 100644 (file)
@@ -348,10 +348,7 @@ struct pipe_query *si_create_batch_query(struct pipe_context *ctx,
        }
 
        /* Compute result bases and CS size per group */
-       query->b.num_cs_dw_begin = pc->num_start_cs_dwords;
        query->b.num_cs_dw_end = pc->num_stop_cs_dwords;
-
-       query->b.num_cs_dw_begin += pc->num_instance_cs_dwords; /* conservative */
        query->b.num_cs_dw_end += pc->num_instance_cs_dwords;
 
        i = 0;
@@ -369,18 +366,14 @@ struct pipe_query *si_create_batch_query(struct pipe_context *ctx,
                query->b.result_size += sizeof(uint64_t) * instances * group->num_counters;
                i += instances * group->num_counters;
 
-               pc->get_size(block, group->num_counters, group->selectors,
-                            &select_dw, &read_dw);
-               query->b.num_cs_dw_begin += select_dw;
+               read_dw = 6 * group->num_counters;
                query->b.num_cs_dw_end += instances * read_dw;
-               query->b.num_cs_dw_begin += pc->num_instance_cs_dwords; /* conservative */
                query->b.num_cs_dw_end += instances * pc->num_instance_cs_dwords;
        }
 
        if (query->shaders) {
                if (query->shaders == R600_PC_SHADERS_WINDOWING)
                        query->shaders = 0xffffffff;
-               query->b.num_cs_dw_begin += pc->num_shaders_cs_dwords;
        }
 
        /* Map user-supplied query array to result indices */
index bf76ae88dde88551338d94f55181ab96365b5418..89fb3dffff6e74a43c5a9f8848805ea71574f4dd 100644 (file)
@@ -645,12 +645,10 @@ static struct pipe_query *r600_query_hw_create(struct si_screen *sscreen,
        case PIPE_QUERY_OCCLUSION_PREDICATE_CONSERVATIVE:
                query->result_size = 16 * sscreen->info.num_render_backends;
                query->result_size += 16; /* for the fence + alignment */
-               query->num_cs_dw_begin = 6;
                query->num_cs_dw_end = 6 + si_gfx_write_fence_dwords(sscreen);
                break;
        case PIPE_QUERY_TIME_ELAPSED:
                query->result_size = 24;
-               query->num_cs_dw_begin = 8;
                query->num_cs_dw_end = 8 + si_gfx_write_fence_dwords(sscreen);
                break;
        case PIPE_QUERY_TIMESTAMP:
@@ -664,21 +662,18 @@ static struct pipe_query *r600_query_hw_create(struct si_screen *sscreen,
        case PIPE_QUERY_SO_OVERFLOW_PREDICATE:
                /* NumPrimitivesWritten, PrimitiveStorageNeeded. */
                query->result_size = 32;
-               query->num_cs_dw_begin = 6;
                query->num_cs_dw_end = 6;
                query->stream = index;
                break;
        case PIPE_QUERY_SO_OVERFLOW_ANY_PREDICATE:
                /* NumPrimitivesWritten, PrimitiveStorageNeeded. */
                query->result_size = 32 * R600_MAX_STREAMS;
-               query->num_cs_dw_begin = 6 * R600_MAX_STREAMS;
                query->num_cs_dw_end = 6 * R600_MAX_STREAMS;
                break;
        case PIPE_QUERY_PIPELINE_STATISTICS:
                /* 11 values on GCN. */
                query->result_size = 11 * 16;
                query->result_size += 8; /* for the fence + alignment */
-               query->num_cs_dw_begin = 6;
                query->num_cs_dw_end = 6 + si_gfx_write_fence_dwords(sscreen);
                break;
        default:
@@ -1843,33 +1838,9 @@ void si_suspend_queries(struct r600_common_context *ctx)
        assert(ctx->num_cs_dw_queries_suspend == 0);
 }
 
-static unsigned r600_queries_num_cs_dw_for_resuming(struct r600_common_context *ctx,
-                                                   struct list_head *query_list)
-{
-       struct r600_query_hw *query;
-       unsigned num_dw = 0;
-
-       LIST_FOR_EACH_ENTRY(query, query_list, list) {
-               /* begin + end */
-               num_dw += query->num_cs_dw_begin + query->num_cs_dw_end;
-
-               /* Workaround for the fact that
-                * num_cs_dw_nontimer_queries_suspend is incremented for every
-                * resumed query, which raises the bar in need_cs_space for
-                * queries about to be resumed.
-                */
-               num_dw += query->num_cs_dw_end;
-       }
-       /* guess for ZPASS enable or PERFECT_ZPASS_COUNT enable updates */
-       num_dw += 13;
-
-       return num_dw;
-}
-
 void si_resume_queries(struct r600_common_context *ctx)
 {
        struct r600_query_hw *query;
-       unsigned num_cs_dw = r600_queries_num_cs_dw_for_resuming(ctx, &ctx->active_queries);
 
        assert(ctx->num_cs_dw_queries_suspend == 0);
 
index db86dc14e5aa1c488bbfb4ab9800d5fcdbbb3a0d..3a51231b76cb027183e8522a972c0c349288f2dd 100644 (file)
@@ -184,8 +184,7 @@ struct r600_query_hw {
        /* Size of the result in memory for both begin_query and end_query,
         * this can be one or two numbers, or it could even be a size of a structure. */
        unsigned result_size;
-       /* The number of dwords for begin_query or end_query. */
-       unsigned num_cs_dw_begin;
+       /* The number of dwords for end_query. */
        unsigned num_cs_dw_end;
        /* Linked list of queries */
        struct list_head list;
@@ -260,19 +259,13 @@ struct r600_perfcounters {
        unsigned num_blocks;
        struct r600_perfcounter_block *blocks;
 
-       unsigned num_start_cs_dwords;
        unsigned num_stop_cs_dwords;
        unsigned num_instance_cs_dwords;
-       unsigned num_shaders_cs_dwords;
 
        unsigned num_shader_types;
        const char * const *shader_type_suffixes;
        const unsigned *shader_type_bits;
 
-       void (*get_size)(struct r600_perfcounter_block *,
-                        unsigned count, unsigned *selectors,
-                        unsigned *num_select_dw, unsigned *num_read_dw);
-
        void (*emit_instance)(struct r600_common_context *,
                              int se, int instance);
        void (*emit_shaders)(struct r600_common_context *, unsigned shaders);
index 1cf004dff83b8827c8d52d2d41998585a072dfb6..1029ebd96d3fec6432f077d3a080773a7f106829 100644 (file)
@@ -423,35 +423,6 @@ static struct si_pc_block groups_gfx9[] = {
        { &cik_CPC, 35 },
 };
 
-static void si_pc_get_size(struct r600_perfcounter_block *group,
-                       unsigned count, unsigned *selectors,
-                       unsigned *num_select_dw, unsigned *num_read_dw)
-{
-       struct si_pc_block *sigroup = (struct si_pc_block *)group->data;
-       struct si_pc_block_base *regs = sigroup->b;
-       unsigned layout_multi = regs->layout & SI_PC_MULTI_MASK;
-
-       if (regs->layout & SI_PC_FAKE) {
-               *num_select_dw = 0;
-       } else if (layout_multi == SI_PC_MULTI_BLOCK) {
-               if (count < regs->num_multi)
-                       *num_select_dw = 2 * (count + 2) + regs->num_prelude;
-               else
-                       *num_select_dw = 2 + count + regs->num_multi + regs->num_prelude;
-       } else if (layout_multi == SI_PC_MULTI_TAIL) {
-               *num_select_dw = 4 + count + MIN2(count, regs->num_multi) + regs->num_prelude;
-       } else if (layout_multi == SI_PC_MULTI_CUSTOM) {
-               assert(regs->num_prelude == 0);
-               *num_select_dw = 3 * (count + MIN2(count, regs->num_multi));
-       } else {
-               assert(layout_multi == SI_PC_MULTI_ALTERNATE);
-
-               *num_select_dw = 2 + count + MIN2(count, regs->num_multi) + regs->num_prelude;
-       }
-
-       *num_read_dw = 6 * count;
-}
-
 static void si_pc_emit_instance(struct r600_common_context *ctx,
                                int se, int instance)
 {
@@ -712,16 +683,13 @@ void si_init_perfcounters(struct si_screen *screen)
        if (!pc)
                return;
 
-       pc->num_start_cs_dwords = 14;
        pc->num_stop_cs_dwords = 14 + si_gfx_write_fence_dwords(screen);
        pc->num_instance_cs_dwords = 3;
-       pc->num_shaders_cs_dwords = 4;
 
        pc->num_shader_types = ARRAY_SIZE(si_pc_shader_type_bits);
        pc->shader_type_suffixes = si_pc_shader_type_suffixes;
        pc->shader_type_bits = si_pc_shader_type_bits;
 
-       pc->get_size = si_pc_get_size;
        pc->emit_instance = si_pc_emit_instance;
        pc->emit_shaders = si_pc_emit_shaders;
        pc->emit_select = si_pc_emit_select;