Lines Matching refs:device
39 radv_se_is_disabled(struct radv_device *device, unsigned se) in radv_se_is_disabled() argument
42 return device->physical_device->rad_info.cu_mask[se][0] == 0; in radv_se_is_disabled()
46 gfx10_get_thread_trace_ctrl(struct radv_device *device, bool enable) in gfx10_get_thread_trace_ctrl() argument
54 if (device->physical_device->rad_info.gfx_level == GFX10_3) in gfx10_get_thread_trace_ctrl()
57 if (device->physical_device->rad_info.has_sqtt_auto_flush_mode_bug) in gfx10_get_thread_trace_ctrl()
64 radv_emit_wait_for_idle(struct radv_device *device, struct radeon_cmdbuf *cs, int family) in radv_emit_wait_for_idle() argument
68 cs, device->physical_device->rad_info.gfx_level, NULL, 0, in radv_emit_wait_for_idle()
69 family == AMD_IP_COMPUTE && device->physical_device->rad_info.gfx_level >= GFX7, in radv_emit_wait_for_idle()
79 radv_emit_thread_trace_start(struct radv_device *device, struct radeon_cmdbuf *cs, in radv_emit_thread_trace_start() argument
82 uint32_t shifted_size = device->thread_trace.buffer_size >> SQTT_BUFFER_ALIGN_SHIFT; in radv_emit_thread_trace_start()
83 struct radeon_info *rad_info = &device->physical_device->rad_info; in radv_emit_thread_trace_start()
87 uint64_t va = radv_buffer_get_va(device->thread_trace.bo); in radv_emit_thread_trace_start()
88 uint64_t data_va = ac_thread_trace_get_data_va(rad_info, &device->thread_trace, va, se); in radv_emit_thread_trace_start()
90 int first_active_cu = ffs(device->physical_device->rad_info.cu_mask[se][0]); in radv_emit_thread_trace_start()
92 if (radv_se_is_disabled(device, se)) in radv_emit_thread_trace_start()
100 if (device->physical_device->rad_info.gfx_level >= GFX10) { in radv_emit_thread_trace_start()
135 gfx10_get_thread_trace_ctrl(device, true)); in radv_emit_thread_trace_start()
152 if (device->physical_device->rad_info.gfx_level < GFX9) { in radv_emit_thread_trace_start()
171 if (device->physical_device->rad_info.gfx_level == GFX9) { in radv_emit_thread_trace_start()
183 if (device->physical_device->rad_info.gfx_level == GFX9) { in radv_emit_thread_trace_start()
225 radv_copy_thread_trace_info_regs(struct radv_device *device, struct radeon_cmdbuf *cs, in radv_copy_thread_trace_info_regs() argument
230 if (device->physical_device->rad_info.gfx_level >= GFX10) { in radv_copy_thread_trace_info_regs()
232 } else if (device->physical_device->rad_info.gfx_level == GFX9) { in radv_copy_thread_trace_info_regs()
235 assert(device->physical_device->rad_info.gfx_level == GFX8); in radv_copy_thread_trace_info_regs()
240 uint64_t va = radv_buffer_get_va(device->thread_trace.bo); in radv_copy_thread_trace_info_regs()
256 radv_emit_thread_trace_stop(struct radv_device *device, struct radeon_cmdbuf *cs, in radv_emit_thread_trace_stop() argument
259 unsigned max_se = device->physical_device->rad_info.max_se; in radv_emit_thread_trace_stop()
272 if (device->physical_device->rad_info.has_sqtt_rb_harvest_bug) { in radv_emit_thread_trace_stop()
274 radv_emit_wait_for_idle(device, cs, qf); in radv_emit_thread_trace_stop()
278 if (radv_se_is_disabled(device, se)) in radv_emit_thread_trace_stop()
286 if (device->physical_device->rad_info.gfx_level >= GFX10) { in radv_emit_thread_trace_stop()
287 if (!device->physical_device->rad_info.has_sqtt_rb_harvest_bug) { in radv_emit_thread_trace_stop()
302 gfx10_get_thread_trace_ctrl(device, false)); in radv_emit_thread_trace_stop()
328 radv_copy_thread_trace_info_regs(device, cs, se); in radv_emit_thread_trace_stop()
341 struct radv_device *device = cmd_buffer->device; in radv_emit_thread_trace_userdata() local
352 radeon_check_space(device->ws, cs, 2 + count); in radv_emit_thread_trace_userdata()
356 if (device->physical_device->rad_info.gfx_level >= GFX10) in radv_emit_thread_trace_userdata()
368 radv_emit_spi_config_cntl(struct radv_device *device, struct radeon_cmdbuf *cs, bool enable) in radv_emit_spi_config_cntl() argument
370 if (device->physical_device->rad_info.gfx_level >= GFX9) { in radv_emit_spi_config_cntl()
375 if (device->physical_device->rad_info.gfx_level >= GFX10) in radv_emit_spi_config_cntl()
388 radv_emit_inhibit_clockgating(struct radv_device *device, struct radeon_cmdbuf *cs, bool inhibit) in radv_emit_inhibit_clockgating() argument
390 if (device->physical_device->rad_info.gfx_level >= GFX11) in radv_emit_inhibit_clockgating()
393 if (device->physical_device->rad_info.gfx_level >= GFX10) { in radv_emit_inhibit_clockgating()
396 } else if (device->physical_device->rad_info.gfx_level >= GFX8) { in radv_emit_inhibit_clockgating()
403 radv_thread_trace_init_bo(struct radv_device *device) in radv_thread_trace_init_bo() argument
405 unsigned max_se = device->physical_device->rad_info.max_se; in radv_thread_trace_init_bo()
406 struct radeon_winsys *ws = device->ws; in radv_thread_trace_init_bo()
413 device->thread_trace.buffer_size = in radv_thread_trace_init_bo()
414 align64(device->thread_trace.buffer_size, 1u << SQTT_BUFFER_ALIGN_SHIFT); in radv_thread_trace_init_bo()
418 size += device->thread_trace.buffer_size * (uint64_t)max_se; in radv_thread_trace_init_bo()
425 device->thread_trace.bo = bo; in radv_thread_trace_init_bo()
429 result = ws->buffer_make_resident(ws, device->thread_trace.bo, true); in radv_thread_trace_init_bo()
433 device->thread_trace.ptr = ws->buffer_map(device->thread_trace.bo); in radv_thread_trace_init_bo()
434 if (!device->thread_trace.ptr) in radv_thread_trace_init_bo()
441 radv_thread_trace_finish_bo(struct radv_device *device) in radv_thread_trace_finish_bo() argument
443 struct radeon_winsys *ws = device->ws; in radv_thread_trace_finish_bo()
445 if (unlikely(device->thread_trace.bo)) { in radv_thread_trace_finish_bo()
446 ws->buffer_make_resident(ws, device->thread_trace.bo, false); in radv_thread_trace_finish_bo()
447 ws->buffer_destroy(ws, device->thread_trace.bo); in radv_thread_trace_finish_bo()
452 radv_thread_trace_init(struct radv_device *device) in radv_thread_trace_init() argument
454 struct ac_thread_trace_data *thread_trace_data = &device->thread_trace; in radv_thread_trace_init()
457 device->thread_trace.buffer_size = in radv_thread_trace_init()
459 device->thread_trace.start_frame = radv_get_int_debug_option("RADV_THREAD_TRACE", -1); in radv_thread_trace_init()
463 device->thread_trace.trigger_file = strdup(trigger_file); in radv_thread_trace_init()
465 if (!radv_thread_trace_init_bo(device)) in radv_thread_trace_init()
468 if (!radv_device_acquire_performance_counters(device)) in radv_thread_trace_init()
484 radv_thread_trace_finish(struct radv_device *device) in radv_thread_trace_finish() argument
486 struct ac_thread_trace_data *thread_trace_data = &device->thread_trace; in radv_thread_trace_finish()
487 struct radeon_winsys *ws = device->ws; in radv_thread_trace_finish()
489 free(device->thread_trace.trigger_file); in radv_thread_trace_finish()
491 radv_thread_trace_finish_bo(device); in radv_thread_trace_finish()
494 if (device->thread_trace.start_cs[i]) in radv_thread_trace_finish()
495 ws->cs_destroy(device->thread_trace.start_cs[i]); in radv_thread_trace_finish()
496 if (device->thread_trace.stop_cs[i]) in radv_thread_trace_finish()
497 ws->cs_destroy(device->thread_trace.stop_cs[i]); in radv_thread_trace_finish()
511 radv_thread_trace_resize_bo(struct radv_device *device) in radv_thread_trace_resize_bo() argument
514 radv_thread_trace_finish_bo(device); in radv_thread_trace_resize_bo()
517 device->thread_trace.buffer_size *= 2; in radv_thread_trace_resize_bo()
522 device->thread_trace.buffer_size / 1024); in radv_thread_trace_resize_bo()
525 return radv_thread_trace_init_bo(device); in radv_thread_trace_resize_bo()
531 struct radv_device *device = queue->device; in radv_begin_thread_trace() local
533 struct radeon_winsys *ws = device->ws; in radv_begin_thread_trace()
538 if (device->thread_trace.start_cs[family]) { in radv_begin_thread_trace()
539 ws->cs_destroy(device->thread_trace.start_cs[family]); in radv_begin_thread_trace()
540 device->thread_trace.start_cs[family] = NULL; in radv_begin_thread_trace()
563 radv_emit_wait_for_idle(device, cs, family); in radv_begin_thread_trace()
566 radv_emit_inhibit_clockgating(device, cs, true); in radv_begin_thread_trace()
569 radv_emit_spi_config_cntl(device, cs, true); in radv_begin_thread_trace()
573 if (device->spm_trace.bo) { in radv_begin_thread_trace()
577 radv_emit_spm_setup(device, cs); in radv_begin_thread_trace()
581 radv_emit_thread_trace_start(device, cs, family); in radv_begin_thread_trace()
583 if (device->spm_trace.bo) in radv_begin_thread_trace()
584 radv_perfcounter_emit_spm_start(device, cs, family); in radv_begin_thread_trace()
592 device->thread_trace.start_cs[family] = cs; in radv_begin_thread_trace()
600 struct radv_device *device = queue->device; in radv_end_thread_trace() local
602 struct radeon_winsys *ws = device->ws; in radv_end_thread_trace()
607 if (queue->device->thread_trace.stop_cs[family]) { in radv_end_thread_trace()
608 ws->cs_destroy(device->thread_trace.stop_cs[family]); in radv_end_thread_trace()
609 device->thread_trace.stop_cs[family] = NULL; in radv_end_thread_trace()
632 radv_emit_wait_for_idle(device, cs, family); in radv_end_thread_trace()
634 if (device->spm_trace.bo) in radv_end_thread_trace()
635 radv_perfcounter_emit_spm_stop(device, cs, family); in radv_end_thread_trace()
638 radv_emit_thread_trace_stop(device, cs, family); in radv_end_thread_trace()
643 radv_emit_spi_config_cntl(device, cs, false); in radv_end_thread_trace()
646 radv_emit_inhibit_clockgating(device, cs, false); in radv_end_thread_trace()
654 device->thread_trace.stop_cs[family] = cs; in radv_end_thread_trace()
662 struct radv_device *device = queue->device; in radv_get_thread_trace() local
663 struct radeon_info *rad_info = &device->physical_device->rad_info; in radv_get_thread_trace()
665 void *thread_trace_ptr = device->thread_trace.ptr; in radv_get_thread_trace()
671 uint64_t data_offset = ac_thread_trace_get_data_offset(rad_info, &device->thread_trace, se); in radv_get_thread_trace()
676 int first_active_cu = ffs(device->physical_device->rad_info.cu_mask[se][0]); in radv_get_thread_trace()
678 if (radv_se_is_disabled(device, se)) in radv_get_thread_trace()
681 if (!ac_is_thread_trace_complete(&device->physical_device->rad_info, &device->thread_trace, in radv_get_thread_trace()
683 if (!radv_thread_trace_resize_bo(device)) { in radv_get_thread_trace()
696 thread_trace_se.compute_unit = device->physical_device->rad_info.gfx_level >= GFX10 in radv_get_thread_trace()
704 thread_trace->data = &device->thread_trace; in radv_get_thread_trace()