2 * Copyright 2015 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * Nicolai Hähnle <nicolai.haehnle@amd.com>
28 #include "radeon/r600_cs.h"
29 #include "radeon/r600_query.h"
30 #include "util/u_memory.h"
35 enum si_pc_reg_layout
{
36 /* All secondary selector dwords follow as one block after the primary
37 * selector dwords for the counters that have secondary selectors.
39 SI_PC_MULTI_BLOCK
= 0,
41 /* Each secondary selector dword follows immediately afters the
42 * corresponding primary.
44 SI_PC_MULTI_ALTERNATE
= 1,
46 /* All secondary selector dwords follow as one block after all primary
51 /* Free-form arrangement of selector registers. */
52 SI_PC_MULTI_CUSTOM
= 3,
56 /* Registers are laid out in decreasing rather than increasing order. */
57 SI_PC_REG_REVERSE
= 4,
62 struct si_pc_block_base
{
64 unsigned num_counters
;
78 struct si_pc_block_base
*b
;
83 /* The order is chosen to be compatible with GPUPerfStudio's hardcoding of
84 * performance counter group IDs.
86 static const char * const si_pc_shader_type_suffixes
[] = {
87 "", "_ES", "_GS", "_VS", "_PS", "_LS", "_HS", "_CS"
90 static const unsigned si_pc_shader_type_bits
[] = {
101 static struct si_pc_block_base cik_CB
= {
104 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
,
106 .select0
= R_037000_CB_PERFCOUNTER_FILTER
,
107 .counter0_lo
= R_035018_CB_PERFCOUNTER0_LO
,
110 .layout
= SI_PC_MULTI_ALTERNATE
,
113 static unsigned cik_CPC_select
[] = {
114 R_036024_CPC_PERFCOUNTER0_SELECT
,
115 R_036010_CPC_PERFCOUNTER0_SELECT1
,
116 R_03600C_CPC_PERFCOUNTER1_SELECT
,
118 static struct si_pc_block_base cik_CPC
= {
122 .select
= cik_CPC_select
,
123 .counter0_lo
= R_034018_CPC_PERFCOUNTER0_LO
,
125 .layout
= SI_PC_MULTI_CUSTOM
| SI_PC_REG_REVERSE
,
128 static struct si_pc_block_base cik_CPF
= {
132 .select0
= R_03601C_CPF_PERFCOUNTER0_SELECT
,
133 .counter0_lo
= R_034028_CPF_PERFCOUNTER0_LO
,
135 .layout
= SI_PC_MULTI_ALTERNATE
| SI_PC_REG_REVERSE
,
138 static struct si_pc_block_base cik_CPG
= {
142 .select0
= R_036008_CPG_PERFCOUNTER0_SELECT
,
143 .counter0_lo
= R_034008_CPG_PERFCOUNTER0_LO
,
145 .layout
= SI_PC_MULTI_ALTERNATE
| SI_PC_REG_REVERSE
,
148 static struct si_pc_block_base cik_DB
= {
151 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
,
153 .select0
= R_037100_DB_PERFCOUNTER0_SELECT
,
154 .counter0_lo
= R_035100_DB_PERFCOUNTER0_LO
,
155 .num_multi
= 3, // really only 2, but there's a gap between registers
156 .layout
= SI_PC_MULTI_ALTERNATE
,
159 static struct si_pc_block_base cik_GDS
= {
163 .select0
= R_036A00_GDS_PERFCOUNTER0_SELECT
,
164 .counter0_lo
= R_034A00_GDS_PERFCOUNTER0_LO
,
166 .layout
= SI_PC_MULTI_TAIL
,
169 static unsigned cik_GRBM_counters
[] = {
170 R_034100_GRBM_PERFCOUNTER0_LO
,
171 R_03410C_GRBM_PERFCOUNTER1_LO
,
173 static struct si_pc_block_base cik_GRBM
= {
177 .select0
= R_036100_GRBM_PERFCOUNTER0_SELECT
,
178 .counters
= cik_GRBM_counters
,
181 static struct si_pc_block_base cik_GRBMSE
= {
185 .select0
= R_036108_GRBM_SE0_PERFCOUNTER_SELECT
,
186 .counter0_lo
= R_034114_GRBM_SE0_PERFCOUNTER_LO
,
189 static struct si_pc_block_base cik_IA
= {
193 .select0
= R_036210_IA_PERFCOUNTER0_SELECT
,
194 .counter0_lo
= R_034220_IA_PERFCOUNTER0_LO
,
196 .layout
= SI_PC_MULTI_TAIL
,
199 static struct si_pc_block_base cik_PA_SC
= {
202 .flags
= R600_PC_BLOCK_SE
,
204 .select0
= R_036500_PA_SC_PERFCOUNTER0_SELECT
,
205 .counter0_lo
= R_034500_PA_SC_PERFCOUNTER0_LO
,
207 .layout
= SI_PC_MULTI_ALTERNATE
,
210 /* According to docs, PA_SU counters are only 48 bits wide. */
211 static struct si_pc_block_base cik_PA_SU
= {
214 .flags
= R600_PC_BLOCK_SE
,
216 .select0
= R_036400_PA_SU_PERFCOUNTER0_SELECT
,
217 .counter0_lo
= R_034400_PA_SU_PERFCOUNTER0_LO
,
219 .layout
= SI_PC_MULTI_ALTERNATE
,
222 static struct si_pc_block_base cik_SPI
= {
225 .flags
= R600_PC_BLOCK_SE
,
227 .select0
= R_036600_SPI_PERFCOUNTER0_SELECT
,
228 .counter0_lo
= R_034604_SPI_PERFCOUNTER0_LO
,
230 .layout
= SI_PC_MULTI_BLOCK
,
233 static struct si_pc_block_base cik_SQ
= {
236 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_SHADER
,
238 .select0
= R_036700_SQ_PERFCOUNTER0_SELECT
,
239 .select_or
= S_036700_SQC_BANK_MASK(15) |
240 S_036700_SQC_CLIENT_MASK(15) |
241 S_036700_SIMD_MASK(15),
242 .counter0_lo
= R_034700_SQ_PERFCOUNTER0_LO
,
245 static struct si_pc_block_base cik_SX
= {
248 .flags
= R600_PC_BLOCK_SE
,
250 .select0
= R_036900_SX_PERFCOUNTER0_SELECT
,
251 .counter0_lo
= R_034900_SX_PERFCOUNTER0_LO
,
253 .layout
= SI_PC_MULTI_TAIL
,
256 static struct si_pc_block_base cik_TA
= {
259 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
261 .select0
= R_036B00_TA_PERFCOUNTER0_SELECT
,
262 .counter0_lo
= R_034B00_TA_PERFCOUNTER0_LO
,
264 .layout
= SI_PC_MULTI_ALTERNATE
,
267 static struct si_pc_block_base cik_TD
= {
270 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
272 .select0
= R_036C00_TD_PERFCOUNTER0_SELECT
,
273 .counter0_lo
= R_034C00_TD_PERFCOUNTER0_LO
,
275 .layout
= SI_PC_MULTI_ALTERNATE
,
278 static struct si_pc_block_base cik_TCA
= {
281 .flags
= R600_PC_BLOCK_INSTANCE_GROUPS
,
283 .select0
= R_036E40_TCA_PERFCOUNTER0_SELECT
,
284 .counter0_lo
= R_034E40_TCA_PERFCOUNTER0_LO
,
286 .layout
= SI_PC_MULTI_ALTERNATE
,
289 static struct si_pc_block_base cik_TCC
= {
292 .flags
= R600_PC_BLOCK_INSTANCE_GROUPS
,
294 .select0
= R_036E00_TCC_PERFCOUNTER0_SELECT
,
295 .counter0_lo
= R_034E00_TCC_PERFCOUNTER0_LO
,
297 .layout
= SI_PC_MULTI_ALTERNATE
,
300 static struct si_pc_block_base cik_TCP
= {
303 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
305 .select0
= R_036D00_TCP_PERFCOUNTER0_SELECT
,
306 .counter0_lo
= R_034D00_TCP_PERFCOUNTER0_LO
,
308 .layout
= SI_PC_MULTI_ALTERNATE
,
311 static struct si_pc_block_base cik_VGT
= {
314 .flags
= R600_PC_BLOCK_SE
,
316 .select0
= R_036230_VGT_PERFCOUNTER0_SELECT
,
317 .counter0_lo
= R_034240_VGT_PERFCOUNTER0_LO
,
319 .layout
= SI_PC_MULTI_TAIL
,
322 static struct si_pc_block_base cik_WD
= {
326 .select0
= R_036200_WD_PERFCOUNTER0_SELECT
,
327 .counter0_lo
= R_034200_WD_PERFCOUNTER0_LO
,
330 static struct si_pc_block_base cik_MC
= {
334 .layout
= SI_PC_FAKE
,
337 static struct si_pc_block_base cik_SRBM
= {
341 .layout
= SI_PC_FAKE
,
344 /* Both the number of instances and selectors varies between chips of the same
345 * class. We only differentiate by class here and simply expose the maximum
346 * number over all chips in a class.
348 * Unfortunately, GPUPerfStudio uses the order of performance counter groups
349 * blindly once it believes it has identified the hardware, so the order of
350 * blocks here matters.
352 static struct si_pc_block groups_CIK
[] = {
363 { &cik_TA
, 111, 11 },
365 { &cik_TCC
, 160, 16 },
367 { &cik_TCP
, 154, 11 },
379 static struct si_pc_block groups_VI
[] = {
390 { &cik_TA
, 119, 16 },
392 { &cik_TCC
, 192, 16 },
394 { &cik_TCP
, 180, 16 },
406 static struct si_pc_block groups_gfx9
[] = {
417 { &cik_TA
, 119, 16 },
419 { &cik_TCC
, 256, 16 },
421 { &cik_TCP
, 85, 16 },
430 static void si_pc_get_size(struct r600_perfcounter_block
*group
,
431 unsigned count
, unsigned *selectors
,
432 unsigned *num_select_dw
, unsigned *num_read_dw
)
434 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
435 struct si_pc_block_base
*regs
= sigroup
->b
;
436 unsigned layout_multi
= regs
->layout
& SI_PC_MULTI_MASK
;
438 if (regs
->layout
& SI_PC_FAKE
) {
440 } else if (layout_multi
== SI_PC_MULTI_BLOCK
) {
441 if (count
< regs
->num_multi
)
442 *num_select_dw
= 2 * (count
+ 2) + regs
->num_prelude
;
444 *num_select_dw
= 2 + count
+ regs
->num_multi
+ regs
->num_prelude
;
445 } else if (layout_multi
== SI_PC_MULTI_TAIL
) {
446 *num_select_dw
= 4 + count
+ MIN2(count
, regs
->num_multi
) + regs
->num_prelude
;
447 } else if (layout_multi
== SI_PC_MULTI_CUSTOM
) {
448 assert(regs
->num_prelude
== 0);
449 *num_select_dw
= 3 * (count
+ MIN2(count
, regs
->num_multi
));
451 assert(layout_multi
== SI_PC_MULTI_ALTERNATE
);
453 *num_select_dw
= 2 + count
+ MIN2(count
, regs
->num_multi
) + regs
->num_prelude
;
456 *num_read_dw
= 6 * count
;
459 static void si_pc_emit_instance(struct r600_common_context
*ctx
,
460 int se
, int instance
)
462 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
463 unsigned value
= S_030800_SH_BROADCAST_WRITES(1);
466 value
|= S_030800_SE_INDEX(se
);
468 value
|= S_030800_SE_BROADCAST_WRITES(1);
472 value
|= S_030800_INSTANCE_INDEX(instance
);
474 value
|= S_030800_INSTANCE_BROADCAST_WRITES(1);
477 radeon_set_uconfig_reg(cs
, R_030800_GRBM_GFX_INDEX
, value
);
480 static void si_pc_emit_shaders(struct r600_common_context
*ctx
,
483 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
485 radeon_set_uconfig_reg_seq(cs
, R_036780_SQ_PERFCOUNTER_CTRL
, 2);
486 radeon_emit(cs
, shaders
& 0x7f);
487 radeon_emit(cs
, 0xffffffff);
490 static void si_pc_emit_select(struct r600_common_context
*ctx
,
491 struct r600_perfcounter_block
*group
,
492 unsigned count
, unsigned *selectors
)
494 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
495 struct si_pc_block_base
*regs
= sigroup
->b
;
496 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
498 unsigned layout_multi
= regs
->layout
& SI_PC_MULTI_MASK
;
501 assert(count
<= regs
->num_counters
);
503 if (regs
->layout
& SI_PC_FAKE
)
506 if (layout_multi
== SI_PC_MULTI_BLOCK
) {
507 assert(!(regs
->layout
& SI_PC_REG_REVERSE
));
509 dw
= count
+ regs
->num_prelude
;
510 if (count
>= regs
->num_multi
)
511 dw
+= regs
->num_multi
;
512 radeon_set_uconfig_reg_seq(cs
, regs
->select0
, dw
);
513 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
515 for (idx
= 0; idx
< MIN2(count
, regs
->num_multi
); ++idx
)
516 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
518 if (count
< regs
->num_multi
) {
520 regs
->select0
+ 4 * regs
->num_multi
;
521 radeon_set_uconfig_reg_seq(cs
, select1
, count
);
524 for (idx
= 0; idx
< MIN2(count
, regs
->num_multi
); ++idx
)
527 if (count
> regs
->num_multi
) {
528 for (idx
= regs
->num_multi
; idx
< count
; ++idx
)
529 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
531 } else if (layout_multi
== SI_PC_MULTI_TAIL
) {
532 unsigned select1
, select1_count
;
534 assert(!(regs
->layout
& SI_PC_REG_REVERSE
));
536 radeon_set_uconfig_reg_seq(cs
, regs
->select0
, count
+ regs
->num_prelude
);
537 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
539 for (idx
= 0; idx
< count
; ++idx
)
540 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
542 select1
= regs
->select0
+ 4 * regs
->num_counters
;
543 select1_count
= MIN2(count
, regs
->num_multi
);
544 radeon_set_uconfig_reg_seq(cs
, select1
, select1_count
);
545 for (idx
= 0; idx
< select1_count
; ++idx
)
547 } else if (layout_multi
== SI_PC_MULTI_CUSTOM
) {
548 unsigned *reg
= regs
->select
;
549 for (idx
= 0; idx
< count
; ++idx
) {
550 radeon_set_uconfig_reg(cs
, *reg
++, selectors
[idx
] | regs
->select_or
);
551 if (idx
< regs
->num_multi
)
552 radeon_set_uconfig_reg(cs
, *reg
++, 0);
555 assert(layout_multi
== SI_PC_MULTI_ALTERNATE
);
557 unsigned reg_base
= regs
->select0
;
558 unsigned reg_count
= count
+ MIN2(count
, regs
->num_multi
);
559 reg_count
+= regs
->num_prelude
;
561 if (!(regs
->layout
& SI_PC_REG_REVERSE
)) {
562 radeon_set_uconfig_reg_seq(cs
, reg_base
, reg_count
);
564 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
566 for (idx
= 0; idx
< count
; ++idx
) {
567 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
568 if (idx
< regs
->num_multi
)
572 reg_base
-= (reg_count
- 1) * 4;
573 radeon_set_uconfig_reg_seq(cs
, reg_base
, reg_count
);
575 for (idx
= count
; idx
> 0; --idx
) {
576 if (idx
<= regs
->num_multi
)
578 radeon_emit(cs
, selectors
[idx
- 1] | regs
->select_or
);
580 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
586 static void si_pc_emit_start(struct r600_common_context
*ctx
,
587 struct r600_resource
*buffer
, uint64_t va
)
589 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
591 radeon_add_to_buffer_list(ctx
, &ctx
->gfx
, buffer
,
592 RADEON_USAGE_WRITE
, RADEON_PRIO_QUERY
);
594 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
595 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_IMM
) |
596 COPY_DATA_DST_SEL(COPY_DATA_MEM
));
597 radeon_emit(cs
, 1); /* immediate */
598 radeon_emit(cs
, 0); /* unused */
600 radeon_emit(cs
, va
>> 32);
602 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
603 S_036020_PERFMON_STATE(V_036020_DISABLE_AND_RESET
));
604 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
605 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_START
) | EVENT_INDEX(0));
606 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
607 S_036020_PERFMON_STATE(V_036020_START_COUNTING
));
610 /* Note: The buffer was already added in si_pc_emit_start, so we don't have to
611 * do it again in here. */
612 static void si_pc_emit_stop(struct r600_common_context
*ctx
,
613 struct r600_resource
*buffer
, uint64_t va
)
615 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
617 r600_gfx_write_event_eop(ctx
, EVENT_TYPE_BOTTOM_OF_PIPE_TS
, 0,
618 EOP_DATA_SEL_VALUE_32BIT
,
619 buffer
, va
, 0, R600_NOT_QUERY
);
620 r600_gfx_wait_fence(ctx
, va
, 0, 0xffffffff);
622 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
623 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_SAMPLE
) | EVENT_INDEX(0));
624 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
625 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_STOP
) | EVENT_INDEX(0));
626 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
627 S_036020_PERFMON_STATE(V_036020_STOP_COUNTING
) |
628 S_036020_PERFMON_SAMPLE_ENABLE(1));
631 static void si_pc_emit_read(struct r600_common_context
*ctx
,
632 struct r600_perfcounter_block
*group
,
633 unsigned count
, unsigned *selectors
,
634 struct r600_resource
*buffer
, uint64_t va
)
636 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
637 struct si_pc_block_base
*regs
= sigroup
->b
;
638 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
640 unsigned reg
= regs
->counter0_lo
;
641 unsigned reg_delta
= 8;
643 if (!(regs
->layout
& SI_PC_FAKE
)) {
644 if (regs
->layout
& SI_PC_REG_REVERSE
)
645 reg_delta
= -reg_delta
;
647 for (idx
= 0; idx
< count
; ++idx
) {
649 reg
= regs
->counters
[idx
];
651 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
652 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_PERF
) |
653 COPY_DATA_DST_SEL(COPY_DATA_MEM
) |
654 COPY_DATA_COUNT_SEL
); /* 64 bits */
655 radeon_emit(cs
, reg
>> 2);
656 radeon_emit(cs
, 0); /* unused */
658 radeon_emit(cs
, va
>> 32);
659 va
+= sizeof(uint64_t);
663 for (idx
= 0; idx
< count
; ++idx
) {
664 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
665 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_IMM
) |
666 COPY_DATA_DST_SEL(COPY_DATA_MEM
) |
667 COPY_DATA_COUNT_SEL
);
668 radeon_emit(cs
, 0); /* immediate */
671 radeon_emit(cs
, va
>> 32);
672 va
+= sizeof(uint64_t);
677 static void si_pc_cleanup(struct r600_common_screen
*rscreen
)
679 r600_perfcounters_do_destroy(rscreen
->perfcounters
);
680 rscreen
->perfcounters
= NULL
;
683 void si_init_perfcounters(struct si_screen
*screen
)
685 struct r600_perfcounters
*pc
;
686 struct si_pc_block
*blocks
;
690 switch (screen
->b
.chip_class
) {
693 num_blocks
= ARRAY_SIZE(groups_CIK
);
697 num_blocks
= ARRAY_SIZE(groups_VI
);
700 blocks
= groups_gfx9
;
701 num_blocks
= ARRAY_SIZE(groups_gfx9
);
705 return; /* not implemented */
708 if (screen
->b
.info
.max_sh_per_se
!= 1) {
709 /* This should not happen on non-SI chips. */
710 fprintf(stderr
, "si_init_perfcounters: max_sh_per_se = %d not "
711 "supported (inaccurate performance counters)\n",
712 screen
->b
.info
.max_sh_per_se
);
715 pc
= CALLOC_STRUCT(r600_perfcounters
);
719 pc
->num_start_cs_dwords
= 14;
720 pc
->num_stop_cs_dwords
= 14 + r600_gfx_write_fence_dwords(&screen
->b
);
721 pc
->num_instance_cs_dwords
= 3;
722 pc
->num_shaders_cs_dwords
= 4;
724 pc
->num_shader_types
= ARRAY_SIZE(si_pc_shader_type_bits
);
725 pc
->shader_type_suffixes
= si_pc_shader_type_suffixes
;
726 pc
->shader_type_bits
= si_pc_shader_type_bits
;
728 pc
->get_size
= si_pc_get_size
;
729 pc
->emit_instance
= si_pc_emit_instance
;
730 pc
->emit_shaders
= si_pc_emit_shaders
;
731 pc
->emit_select
= si_pc_emit_select
;
732 pc
->emit_start
= si_pc_emit_start
;
733 pc
->emit_stop
= si_pc_emit_stop
;
734 pc
->emit_read
= si_pc_emit_read
;
735 pc
->cleanup
= si_pc_cleanup
;
737 if (!r600_perfcounters_init(pc
, num_blocks
))
740 for (i
= 0; i
< num_blocks
; ++i
) {
741 struct si_pc_block
*block
= &blocks
[i
];
742 unsigned instances
= block
->instances
;
744 if (!strcmp(block
->b
->name
, "IA")) {
745 if (screen
->b
.info
.max_se
> 2)
749 r600_perfcounters_add_block(&screen
->b
, pc
,
752 block
->b
->num_counters
,
758 screen
->b
.perfcounters
= pc
;
762 r600_perfcounters_do_destroy(pc
);