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 "radeon/r600_pipe_common.h"
31 #include "util/u_memory.h"
36 enum si_pc_reg_layout
{
37 /* All secondary selector dwords follow as one block after the primary
38 * selector dwords for the counters that have secondary selectors.
40 SI_PC_MULTI_BLOCK
= 0,
42 /* Each secondary selector dword follows immediately afters the
43 * corresponding primary.
45 SI_PC_MULTI_ALTERNATE
= 1,
47 /* All secondary selector dwords follow as one block after all primary
52 /* Free-form arrangement of selector registers. */
53 SI_PC_MULTI_CUSTOM
= 3,
57 /* Registers are laid out in decreasing rather than increasing order. */
58 SI_PC_REG_REVERSE
= 4,
61 struct si_pc_block_base
{
63 unsigned num_counters
;
77 struct si_pc_block_base
*b
;
83 static struct si_pc_block_base cik_CB
= {
86 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
,
88 .select0
= R_037000_CB_PERFCOUNTER_FILTER
,
89 .counter0_lo
= R_035018_CB_PERFCOUNTER0_LO
,
92 .layout
= SI_PC_MULTI_ALTERNATE
,
95 static unsigned cik_CPC_select
[] = {
96 R_036024_CPC_PERFCOUNTER0_SELECT
,
97 R_036010_CPC_PERFCOUNTER0_SELECT1
,
98 R_03600C_CPC_PERFCOUNTER1_SELECT
,
100 static struct si_pc_block_base cik_CPC
= {
104 .select
= cik_CPC_select
,
105 .counter0_lo
= R_034018_CPC_PERFCOUNTER0_LO
,
107 .layout
= SI_PC_MULTI_CUSTOM
| SI_PC_REG_REVERSE
,
110 static struct si_pc_block_base cik_CPF
= {
114 .select0
= R_03601C_CPF_PERFCOUNTER0_SELECT
,
115 .counter0_lo
= R_034028_CPF_PERFCOUNTER0_LO
,
117 .layout
= SI_PC_MULTI_ALTERNATE
| SI_PC_REG_REVERSE
,
120 static struct si_pc_block_base cik_CPG
= {
124 .select0
= R_036008_CPG_PERFCOUNTER0_SELECT
,
125 .counter0_lo
= R_034008_CPG_PERFCOUNTER0_LO
,
127 .layout
= SI_PC_MULTI_ALTERNATE
| SI_PC_REG_REVERSE
,
130 static struct si_pc_block_base cik_DB
= {
133 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
,
135 .select0
= R_037100_DB_PERFCOUNTER0_SELECT
,
136 .counter0_lo
= R_035100_DB_PERFCOUNTER0_LO
,
137 .num_multi
= 3, // really only 2, but there's a gap between registers
138 .layout
= SI_PC_MULTI_ALTERNATE
,
141 static struct si_pc_block_base cik_GDS
= {
145 .select0
= R_036A00_GDS_PERFCOUNTER0_SELECT
,
146 .counter0_lo
= R_034A00_GDS_PERFCOUNTER0_LO
,
148 .layout
= SI_PC_MULTI_TAIL
,
151 static unsigned cik_GRBM_counters
[] = {
152 R_034100_GRBM_PERFCOUNTER0_LO
,
153 R_03410C_GRBM_PERFCOUNTER1_LO
,
155 static struct si_pc_block_base cik_GRBM
= {
159 .select0
= R_036100_GRBM_PERFCOUNTER0_SELECT
,
160 .counters
= cik_GRBM_counters
,
163 static struct si_pc_block_base cik_GRBMSE
= {
167 .select0
= R_036108_GRBM_SE0_PERFCOUNTER_SELECT
,
168 .counter0_lo
= R_034114_GRBM_SE0_PERFCOUNTER_LO
,
171 static struct si_pc_block_base cik_IA
= {
175 .select0
= R_036210_IA_PERFCOUNTER0_SELECT
,
176 .counter0_lo
= R_034220_IA_PERFCOUNTER0_LO
,
178 .layout
= SI_PC_MULTI_TAIL
,
181 static struct si_pc_block_base cik_PA_SC
= {
184 .flags
= R600_PC_BLOCK_SE
,
186 .select0
= R_036500_PA_SC_PERFCOUNTER0_SELECT
,
187 .counter0_lo
= R_034500_PA_SC_PERFCOUNTER0_LO
,
189 .layout
= SI_PC_MULTI_ALTERNATE
,
192 static struct si_pc_block_base cik_PA_SU
= {
195 .flags
= R600_PC_BLOCK_SE
,
197 .select0
= R_036400_PA_SU_PERFCOUNTER0_SELECT
,
198 .counter0_lo
= R_034400_PA_SU_PERFCOUNTER0_LO
,
200 .layout
= SI_PC_MULTI_ALTERNATE
,
203 static struct si_pc_block_base cik_SPI
= {
206 .flags
= R600_PC_BLOCK_SE
,
208 .select0
= R_036600_SPI_PERFCOUNTER0_SELECT
,
209 .counter0_lo
= R_034604_SPI_PERFCOUNTER0_LO
,
211 .layout
= SI_PC_MULTI_BLOCK
,
214 static struct si_pc_block_base cik_SQ
= {
217 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_SHADER
,
219 .select0
= R_036700_SQ_PERFCOUNTER0_SELECT
,
220 .select_or
= S_036700_SQC_BANK_MASK(15) |
221 S_036700_SQC_CLIENT_MASK(15) |
222 S_036700_SIMD_MASK(15),
223 .counter0_lo
= R_034700_SQ_PERFCOUNTER0_LO
,
226 static struct si_pc_block_base cik_SX
= {
229 .flags
= R600_PC_BLOCK_SE
,
231 .select0
= R_036900_SX_PERFCOUNTER0_SELECT
,
232 .counter0_lo
= R_034900_SX_PERFCOUNTER0_LO
,
234 .layout
= SI_PC_MULTI_TAIL
,
237 static struct si_pc_block_base cik_TA
= {
240 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
242 .select0
= R_036B00_TA_PERFCOUNTER0_SELECT
,
243 .counter0_lo
= R_034B00_TA_PERFCOUNTER0_LO
,
245 .layout
= SI_PC_MULTI_ALTERNATE
,
248 static struct si_pc_block_base cik_TD
= {
251 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
253 .select0
= R_036C00_TD_PERFCOUNTER0_SELECT
,
254 .counter0_lo
= R_034C00_TD_PERFCOUNTER0_LO
,
256 .layout
= SI_PC_MULTI_ALTERNATE
,
259 static struct si_pc_block_base cik_TCA
= {
262 .flags
= R600_PC_BLOCK_INSTANCE_GROUPS
,
264 .select0
= R_036E40_TCA_PERFCOUNTER0_SELECT
,
265 .counter0_lo
= R_034E40_TCA_PERFCOUNTER0_LO
,
267 .layout
= SI_PC_MULTI_ALTERNATE
,
270 static struct si_pc_block_base cik_TCC
= {
273 .flags
= R600_PC_BLOCK_INSTANCE_GROUPS
,
275 .select0
= R_036E00_TCC_PERFCOUNTER0_SELECT
,
276 .counter0_lo
= R_034E00_TCC_PERFCOUNTER0_LO
,
278 .layout
= SI_PC_MULTI_ALTERNATE
,
281 static struct si_pc_block_base cik_TCP
= {
284 .flags
= R600_PC_BLOCK_SE
| R600_PC_BLOCK_INSTANCE_GROUPS
| R600_PC_BLOCK_SHADER_WINDOWED
,
286 .select0
= R_036D00_TCP_PERFCOUNTER0_SELECT
,
287 .counter0_lo
= R_034D00_TCP_PERFCOUNTER0_LO
,
289 .layout
= SI_PC_MULTI_ALTERNATE
,
292 static struct si_pc_block_base cik_VGT
= {
295 .flags
= R600_PC_BLOCK_SE
,
297 .select0
= R_036230_VGT_PERFCOUNTER0_SELECT
,
298 .counter0_lo
= R_034240_VGT_PERFCOUNTER0_LO
,
300 .layout
= SI_PC_MULTI_TAIL
,
303 static struct si_pc_block_base cik_WD
= {
307 .select0
= R_036200_WD_PERFCOUNTER0_SELECT
,
308 .counter0_lo
= R_034200_WD_PERFCOUNTER0_LO
,
311 /* Both the number of instances and selectors varies between chips of the same
312 * class. We only differentiate by class here and simply expose the maximum
313 * number over all chips in a class.
315 static struct si_pc_block groups_CIK
[] = {
330 { &cik_TA
, 111, 11 },
332 { &cik_TCC
, 160, 16 },
333 { &cik_TCP
, 154, 11 },
339 static struct si_pc_block groups_VI
[] = {
354 { &cik_TA
, 119, 16 },
356 { &cik_TCC
, 192, 16 },
357 { &cik_TCP
, 180, 16 },
363 static void si_pc_get_size(struct r600_perfcounter_block
*group
,
364 unsigned count
, unsigned *selectors
,
365 unsigned *num_select_dw
, unsigned *num_read_dw
)
367 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
368 struct si_pc_block_base
*regs
= sigroup
->b
;
369 unsigned layout_multi
= regs
->layout
& SI_PC_MULTI_MASK
;
371 if (layout_multi
== SI_PC_MULTI_BLOCK
) {
372 if (count
< regs
->num_multi
)
373 *num_select_dw
= 2 * (count
+ 2) + regs
->num_prelude
;
375 *num_select_dw
= 2 + count
+ regs
->num_multi
+ regs
->num_prelude
;
376 } else if (layout_multi
== SI_PC_MULTI_TAIL
) {
377 *num_select_dw
= 4 + count
+ MIN2(count
, regs
->num_multi
) + regs
->num_prelude
;
378 } else if (layout_multi
== SI_PC_MULTI_CUSTOM
) {
379 assert(regs
->num_prelude
== 0);
380 *num_select_dw
= 3 * (count
+ MIN2(count
, regs
->num_multi
));
382 assert(layout_multi
== SI_PC_MULTI_ALTERNATE
);
384 *num_select_dw
= 2 + count
+ MIN2(count
, regs
->num_multi
) + regs
->num_prelude
;
387 *num_read_dw
= 6 * count
;
390 static void si_pc_emit_instance(struct r600_common_context
*ctx
,
391 int se
, int instance
)
393 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
394 unsigned value
= S_030800_SH_BROADCAST_WRITES(1);
397 value
|= S_030800_SE_INDEX(se
);
399 value
|= S_030800_SE_BROADCAST_WRITES(1);
403 value
|= S_030800_INSTANCE_INDEX(instance
);
405 value
|= S_030800_INSTANCE_BROADCAST_WRITES(1);
408 radeon_set_uconfig_reg(cs
, R_030800_GRBM_GFX_INDEX
, value
);
411 static void si_pc_emit_shaders(struct r600_common_context
*ctx
,
414 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
416 radeon_set_uconfig_reg_seq(cs
, R_036780_SQ_PERFCOUNTER_CTRL
, 2);
417 radeon_emit(cs
, shaders
& 0x7f);
418 radeon_emit(cs
, 0xffffffff);
421 static void si_pc_emit_select(struct r600_common_context
*ctx
,
422 struct r600_perfcounter_block
*group
,
423 unsigned count
, unsigned *selectors
)
425 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
426 struct si_pc_block_base
*regs
= sigroup
->b
;
427 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
429 unsigned layout_multi
= regs
->layout
& SI_PC_MULTI_MASK
;
432 assert(count
<= regs
->num_counters
);
434 if (layout_multi
== SI_PC_MULTI_BLOCK
) {
435 assert(!(regs
->layout
& SI_PC_REG_REVERSE
));
437 dw
= count
+ regs
->num_prelude
;
438 if (count
>= regs
->num_multi
)
439 dw
+= regs
->num_multi
;
440 radeon_set_uconfig_reg_seq(cs
, regs
->select0
, dw
);
441 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
443 for (idx
= 0; idx
< MIN2(count
, regs
->num_multi
); ++idx
)
444 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
446 if (count
< regs
->num_multi
) {
448 regs
->select0
+ 4 * regs
->num_multi
;
449 radeon_set_uconfig_reg_seq(cs
, select1
, count
);
452 for (idx
= 0; idx
< MIN2(count
, regs
->num_multi
); ++idx
)
455 if (count
> regs
->num_multi
) {
456 for (idx
= regs
->num_multi
; idx
< count
; ++idx
)
457 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
459 } else if (layout_multi
== SI_PC_MULTI_TAIL
) {
460 unsigned select1
, select1_count
;
462 assert(!(regs
->layout
& SI_PC_REG_REVERSE
));
464 radeon_set_uconfig_reg_seq(cs
, regs
->select0
, count
+ regs
->num_prelude
);
465 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
467 for (idx
= 0; idx
< count
; ++idx
)
468 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
470 select1
= regs
->select0
+ 4 * regs
->num_counters
;
471 select1_count
= MIN2(count
, regs
->num_multi
);
472 radeon_set_uconfig_reg_seq(cs
, select1
, select1_count
);
473 for (idx
= 0; idx
< select1_count
; ++idx
)
475 } else if (layout_multi
== SI_PC_MULTI_CUSTOM
) {
476 unsigned *reg
= regs
->select
;
477 for (idx
= 0; idx
< count
; ++idx
) {
478 radeon_set_uconfig_reg(cs
, *reg
++, selectors
[idx
] | regs
->select_or
);
479 if (idx
< regs
->num_multi
)
480 radeon_set_uconfig_reg(cs
, *reg
++, 0);
483 assert(layout_multi
== SI_PC_MULTI_ALTERNATE
);
485 unsigned reg_base
= regs
->select0
;
486 unsigned reg_count
= count
+ MIN2(count
, regs
->num_multi
);
487 reg_count
+= regs
->num_prelude
;
489 if (!(regs
->layout
& SI_PC_REG_REVERSE
)) {
490 radeon_set_uconfig_reg_seq(cs
, reg_base
, reg_count
);
492 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
494 for (idx
= 0; idx
< count
; ++idx
) {
495 radeon_emit(cs
, selectors
[idx
] | regs
->select_or
);
496 if (idx
< regs
->num_multi
)
500 reg_base
-= (reg_count
- 1) * 4;
501 radeon_set_uconfig_reg_seq(cs
, reg_base
, reg_count
);
503 for (idx
= count
; idx
> 0; --idx
) {
504 if (idx
<= regs
->num_multi
)
506 radeon_emit(cs
, selectors
[idx
- 1] | regs
->select_or
);
508 for (idx
= 0; idx
< regs
->num_prelude
; ++idx
)
514 static void si_pc_emit_start(struct r600_common_context
*ctx
,
515 struct r600_resource
*buffer
, uint64_t va
)
517 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
519 radeon_add_to_buffer_list(ctx
, &ctx
->gfx
, buffer
,
520 RADEON_USAGE_WRITE
, RADEON_PRIO_QUERY
);
522 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
523 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_IMM
) |
524 COPY_DATA_DST_SEL(COPY_DATA_MEM
));
525 radeon_emit(cs
, 1); /* immediate */
526 radeon_emit(cs
, 0); /* unused */
528 radeon_emit(cs
, va
>> 32);
530 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
531 S_036020_PERFMON_STATE(V_036020_DISABLE_AND_RESET
));
532 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
533 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_START
) | EVENT_INDEX(0));
534 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
535 S_036020_PERFMON_STATE(V_036020_START_COUNTING
));
538 /* Note: The buffer was already added in si_pc_emit_start, so we don't have to
539 * do it again in here. */
540 static void si_pc_emit_stop(struct r600_common_context
*ctx
,
541 struct r600_resource
*buffer
, uint64_t va
)
543 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
545 if (ctx
->screen
->chip_class
== CIK
) {
546 /* Workaround for cache flush problems: send two EOP events. */
547 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE_EOP
, 4, 0));
548 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT
) |
551 radeon_emit(cs
, (va
>> 32) | EOP_DATA_SEL(1));
552 radeon_emit(cs
, 0); /* immediate data */
553 radeon_emit(cs
, 0); /* unused */
556 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE_EOP
, 4, 0));
557 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_CACHE_FLUSH_AND_INV_TS_EVENT
) |
560 radeon_emit(cs
, (va
>> 32) | EOP_DATA_SEL(1));
561 radeon_emit(cs
, 0); /* immediate data */
562 radeon_emit(cs
, 0); /* unused */
564 radeon_emit(cs
, PKT3(PKT3_WAIT_REG_MEM
, 5, 0));
565 radeon_emit(cs
, WAIT_REG_MEM_EQUAL
| WAIT_REG_MEM_MEM_SPACE(1));
567 radeon_emit(cs
, va
>> 32);
568 radeon_emit(cs
, 0); /* reference value */
569 radeon_emit(cs
, 0xffffffff); /* mask */
570 radeon_emit(cs
, 4); /* poll interval */
572 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
573 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_SAMPLE
) | EVENT_INDEX(0));
574 radeon_emit(cs
, PKT3(PKT3_EVENT_WRITE
, 0, 0));
575 radeon_emit(cs
, EVENT_TYPE(EVENT_TYPE_PERFCOUNTER_STOP
) | EVENT_INDEX(0));
576 radeon_set_uconfig_reg(cs
, R_036020_CP_PERFMON_CNTL
,
577 S_036020_PERFMON_STATE(V_036020_STOP_COUNTING
) |
578 S_036020_PERFMON_SAMPLE_ENABLE(1));
581 static void si_pc_emit_read(struct r600_common_context
*ctx
,
582 struct r600_perfcounter_block
*group
,
583 unsigned count
, unsigned *selectors
,
584 struct r600_resource
*buffer
, uint64_t va
)
586 struct si_pc_block
*sigroup
= (struct si_pc_block
*)group
->data
;
587 struct si_pc_block_base
*regs
= sigroup
->b
;
588 struct radeon_winsys_cs
*cs
= ctx
->gfx
.cs
;
590 unsigned reg
= regs
->counter0_lo
;
591 unsigned reg_delta
= 8;
593 if (regs
->layout
& SI_PC_REG_REVERSE
)
594 reg_delta
= -reg_delta
;
596 for (idx
= 0; idx
< count
; ++idx
) {
598 reg
= regs
->counters
[idx
];
600 radeon_emit(cs
, PKT3(PKT3_COPY_DATA
, 4, 0));
601 radeon_emit(cs
, COPY_DATA_SRC_SEL(COPY_DATA_PERF
) |
602 COPY_DATA_DST_SEL(COPY_DATA_MEM
));
603 radeon_emit(cs
, reg
>> 2);
604 radeon_emit(cs
, 0); /* unused */
606 radeon_emit(cs
, va
>> 32);
612 static void si_pc_cleanup(struct r600_common_screen
*rscreen
)
614 r600_perfcounters_do_destroy(rscreen
->perfcounters
);
615 rscreen
->perfcounters
= NULL
;
618 void si_init_perfcounters(struct si_screen
*screen
)
620 struct r600_perfcounters
*pc
;
621 struct si_pc_block
*blocks
;
625 switch (screen
->b
.chip_class
) {
628 num_blocks
= ARRAY_SIZE(groups_CIK
);
632 num_blocks
= ARRAY_SIZE(groups_VI
);
636 return; /* not implemented */
639 if (screen
->b
.info
.max_sh_per_se
!= 1) {
640 /* This should not happen on non-SI chips. */
641 fprintf(stderr
, "si_init_perfcounters: max_sh_per_se = %d not "
642 "supported (inaccurate performance counters)\n",
643 screen
->b
.info
.max_sh_per_se
);
646 pc
= CALLOC_STRUCT(r600_perfcounters
);
650 pc
->num_start_cs_dwords
= 14;
651 pc
->num_stop_cs_dwords
= 20;
652 pc
->num_instance_cs_dwords
= 3;
653 pc
->num_shaders_cs_dwords
= 4;
655 if (screen
->b
.chip_class
== CIK
) {
656 pc
->num_stop_cs_dwords
+= 6;
659 pc
->get_size
= si_pc_get_size
;
660 pc
->emit_instance
= si_pc_emit_instance
;
661 pc
->emit_shaders
= si_pc_emit_shaders
;
662 pc
->emit_select
= si_pc_emit_select
;
663 pc
->emit_start
= si_pc_emit_start
;
664 pc
->emit_stop
= si_pc_emit_stop
;
665 pc
->emit_read
= si_pc_emit_read
;
666 pc
->cleanup
= si_pc_cleanup
;
668 if (!r600_perfcounters_init(pc
, num_blocks
))
671 for (i
= 0; i
< num_blocks
; ++i
) {
672 struct si_pc_block
*block
= &blocks
[i
];
673 unsigned instances
= block
->instances
;
675 if (!strcmp(block
->b
->name
, "IA")) {
676 if (screen
->b
.info
.max_se
> 2)
680 r600_perfcounters_add_block(&screen
->b
, pc
,
683 block
->b
->num_counters
,
689 screen
->b
.perfcounters
= pc
;
693 r600_perfcounters_do_destroy(pc
);