From 72842d15acf7a71e4ccc7db6cd3d911aa5ca2a94 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Sun, 1 Apr 2018 13:51:09 -0400 Subject: [PATCH] radeonsi: remove unused query code The get_size perf counter callback is also inlined and removed. Acked-by: Timothy Arceri --- src/gallium/drivers/radeon/r600_perfcounter.c | 9 +----- src/gallium/drivers/radeon/r600_query.c | 29 ----------------- src/gallium/drivers/radeon/r600_query.h | 9 +----- src/gallium/drivers/radeonsi/si_perfcounter.c | 32 ------------------- 4 files changed, 2 insertions(+), 77 deletions(-) diff --git a/src/gallium/drivers/radeon/r600_perfcounter.c b/src/gallium/drivers/radeon/r600_perfcounter.c index 711baef9817..689f4a38edc 100644 --- a/src/gallium/drivers/radeon/r600_perfcounter.c +++ b/src/gallium/drivers/radeon/r600_perfcounter.c @@ -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 */ diff --git a/src/gallium/drivers/radeon/r600_query.c b/src/gallium/drivers/radeon/r600_query.c index bf76ae88dde..89fb3dffff6 100644 --- a/src/gallium/drivers/radeon/r600_query.c +++ b/src/gallium/drivers/radeon/r600_query.c @@ -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); diff --git a/src/gallium/drivers/radeon/r600_query.h b/src/gallium/drivers/radeon/r600_query.h index db86dc14e5a..3a51231b76c 100644 --- a/src/gallium/drivers/radeon/r600_query.h +++ b/src/gallium/drivers/radeon/r600_query.h @@ -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); diff --git a/src/gallium/drivers/radeonsi/si_perfcounter.c b/src/gallium/drivers/radeonsi/si_perfcounter.c index 1cf004dff83..1029ebd96d3 100644 --- a/src/gallium/drivers/radeonsi/si_perfcounter.c +++ b/src/gallium/drivers/radeonsi/si_perfcounter.c @@ -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; -- 2.30.2