Lines Matching full:device
51 radv_emit_wait_for_idle(const struct radv_device *device, struct radeon_cmdbuf *cs, int family) in radv_emit_wait_for_idle() argument
53 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_emit_wait_for_idle()
57 device->ws, cs, pdev->info.gfx_level, NULL, 0, qf, in radv_emit_wait_for_idle()
65 radv_emit_sqtt_start(const struct radv_device *device, struct radeon_cmdbuf *cs, enum radv_queue_fa… in radv_emit_sqtt_start() argument
67 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_emit_sqtt_start()
75 ac_sqtt_emit_start(&pdev->info, pm4, &device->sqtt, is_compute_queue); in radv_emit_sqtt_start()
78 radeon_check_space(device->ws, cs, pm4->ndw); in radv_emit_sqtt_start()
85 radv_emit_sqtt_stop(const struct radv_device *device, struct radeon_cmdbuf *cs, enum radv_queue_fam… in radv_emit_sqtt_stop() argument
87 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_emit_sqtt_stop()
98 radeon_check_space(device->ws, cs, pm4->ndw); in radv_emit_sqtt_stop()
105 radv_emit_wait_for_idle(device, cs, qf); in radv_emit_sqtt_stop()
108 ac_sqtt_emit_wait(&pdev->info, pm4, &device->sqtt, is_compute_queue); in radv_emit_sqtt_stop()
111 radeon_check_space(device->ws, cs, pm4->ndw); in radv_emit_sqtt_stop()
120 struct radv_device *device = radv_cmd_buffer_device(cmd_buffer); in radv_emit_sqtt_userdata() local
121 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_emit_sqtt_userdata()
134 radeon_check_space(device->ws, cs, 2 + count); in radv_emit_sqtt_userdata()
150 radv_emit_spi_config_cntl(const struct radv_device *device, struct radeon_cmdbuf *cs, bool enable) in radv_emit_spi_config_cntl() argument
152 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_emit_spi_config_cntl()
170 radv_emit_inhibit_clockgating(const struct radv_device *device, struct radeon_cmdbuf *cs, bool inhi… in radv_emit_inhibit_clockgating() argument
172 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_emit_inhibit_clockgating()
185 radv_sqtt_acquire_gpu_timestamp(struct radv_device *device, struct radeon_winsys_bo **gpu_timestamp… in radv_sqtt_acquire_gpu_timestamp() argument
188 simple_mtx_lock(&device->sqtt_timestamp_mtx); in radv_sqtt_acquire_gpu_timestamp()
190 if (device->sqtt_timestamp.offset + 8 > device->sqtt_timestamp.size) { in radv_sqtt_acquire_gpu_timestamp()
196 new_size = MAX2(4096, 2 * device->sqtt_timestamp.size); in radv_sqtt_acquire_gpu_timestamp()
198 result = radv_bo_create(device, NULL, new_size, 8, RADEON_DOMAIN_GTT, in radv_sqtt_acquire_gpu_timestamp()
202 simple_mtx_unlock(&device->sqtt_timestamp_mtx); in radv_sqtt_acquire_gpu_timestamp()
206 map = radv_buffer_map(device->ws, bo); in radv_sqtt_acquire_gpu_timestamp()
208 radv_bo_destroy(device, NULL, bo); in radv_sqtt_acquire_gpu_timestamp()
209 simple_mtx_unlock(&device->sqtt_timestamp_mtx); in radv_sqtt_acquire_gpu_timestamp()
213 if (device->sqtt_timestamp.bo) { in radv_sqtt_acquire_gpu_timestamp()
218 radv_bo_destroy(device, NULL, bo); in radv_sqtt_acquire_gpu_timestamp()
219 simple_mtx_unlock(&device->sqtt_timestamp_mtx); in radv_sqtt_acquire_gpu_timestamp()
223 memcpy(new_timestamp, &device->sqtt_timestamp, sizeof(*new_timestamp)); in radv_sqtt_acquire_gpu_timestamp()
224 list_add(&new_timestamp->list, &device->sqtt_timestamp.list); in radv_sqtt_acquire_gpu_timestamp()
227 device->sqtt_timestamp.bo = bo; in radv_sqtt_acquire_gpu_timestamp()
228 device->sqtt_timestamp.size = new_size; in radv_sqtt_acquire_gpu_timestamp()
229 device->sqtt_timestamp.offset = 0; in radv_sqtt_acquire_gpu_timestamp()
230 device->sqtt_timestamp.map = map; in radv_sqtt_acquire_gpu_timestamp()
233 *gpu_timestamp_bo = device->sqtt_timestamp.bo; in radv_sqtt_acquire_gpu_timestamp()
234 *gpu_timestamp_offset = device->sqtt_timestamp.offset; in radv_sqtt_acquire_gpu_timestamp()
235 *gpu_timestamp_ptr = device->sqtt_timestamp.map + device->sqtt_timestamp.offset; in radv_sqtt_acquire_gpu_timestamp()
237 device->sqtt_timestamp.offset += 8; in radv_sqtt_acquire_gpu_timestamp()
239 simple_mtx_unlock(&device->sqtt_timestamp_mtx); in radv_sqtt_acquire_gpu_timestamp()
245 radv_sqtt_reset_timestamp(struct radv_device *device) in radv_sqtt_reset_timestamp() argument
247 simple_mtx_lock(&device->sqtt_timestamp_mtx); in radv_sqtt_reset_timestamp()
249 list_for_each_entry_safe (struct radv_sqtt_timestamp, ts, &device->sqtt_timestamp.list, list) { in radv_sqtt_reset_timestamp()
250 radv_bo_destroy(device, NULL, ts->bo); in radv_sqtt_reset_timestamp()
255 device->sqtt_timestamp.offset = 0; in radv_sqtt_reset_timestamp()
257 simple_mtx_unlock(&device->sqtt_timestamp_mtx); in radv_sqtt_reset_timestamp()
261 radv_sqtt_init_queue_event(struct radv_device *device) in radv_sqtt_init_queue_event() argument
263 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_sqtt_init_queue_event()
273 …result = vk_common_CreateCommandPool(radv_device_to_handle(device), &create_gfx_info, NULL, &cmd_p… in radv_sqtt_init_queue_event()
277 device->sqtt_command_pool[0] = vk_command_pool_from_handle(cmd_pool); in radv_sqtt_init_queue_event()
285 …result = vk_common_CreateCommandPool(radv_device_to_handle(device), &create_comp_info, NULL, &cmd_… in radv_sqtt_init_queue_event()
289 device->sqtt_command_pool[1] = vk_command_pool_from_handle(cmd_pool); in radv_sqtt_init_queue_event()
292 simple_mtx_init(&device->sqtt_command_pool_mtx, mtx_plain); in radv_sqtt_init_queue_event()
294 simple_mtx_init(&device->sqtt_timestamp_mtx, mtx_plain); in radv_sqtt_init_queue_event()
295 list_inithead(&device->sqtt_timestamp.list); in radv_sqtt_init_queue_event()
301 radv_sqtt_finish_queue_event(struct radv_device *device) in radv_sqtt_finish_queue_event() argument
303 if (device->sqtt_timestamp.bo) in radv_sqtt_finish_queue_event()
304 radv_bo_destroy(device, NULL, device->sqtt_timestamp.bo); in radv_sqtt_finish_queue_event()
306 simple_mtx_destroy(&device->sqtt_timestamp_mtx); in radv_sqtt_finish_queue_event()
308 for (unsigned i = 0; i < ARRAY_SIZE(device->sqtt_command_pool); i++) in radv_sqtt_finish_queue_event()
309 vk_common_DestroyCommandPool(radv_device_to_handle(device), in radv_sqtt_finish_queue_event()
310 vk_command_pool_to_handle(device->sqtt_command_pool[i]), NULL); in radv_sqtt_finish_queue_event()
312 simple_mtx_destroy(&device->sqtt_command_pool_mtx); in radv_sqtt_finish_queue_event()
316 radv_sqtt_init_bo(struct radv_device *device) in radv_sqtt_init_bo() argument
318 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_sqtt_init_bo()
321 struct radeon_winsys *ws = device->ws; in radv_sqtt_init_bo()
328 device->sqtt.buffer_size = align64(device->sqtt.buffer_size, 1ull << align_shift); in radv_sqtt_init_bo()
332 size += device->sqtt.buffer_size * (uint64_t)max_se; in radv_sqtt_init_bo()
335 result = radv_bo_create(device, NULL, size, 4096, RADEON_DOMAIN_VRAM, in radv_sqtt_init_bo()
338 device->sqtt.bo = bo; in radv_sqtt_init_bo()
342 result = ws->buffer_make_resident(ws, device->sqtt.bo, true); in radv_sqtt_init_bo()
346 device->sqtt.ptr = radv_buffer_map(ws, device->sqtt.bo); in radv_sqtt_init_bo()
347 if (!device->sqtt.ptr) in radv_sqtt_init_bo()
350 device->sqtt.buffer_va = radv_buffer_get_va(device->sqtt.bo); in radv_sqtt_init_bo()
356 radv_sqtt_finish_bo(struct radv_device *device) in radv_sqtt_finish_bo() argument
358 struct radeon_winsys *ws = device->ws; in radv_sqtt_finish_bo()
360 if (unlikely(device->sqtt.bo)) { in radv_sqtt_finish_bo()
361 ws->buffer_make_resident(ws, device->sqtt.bo, false); in radv_sqtt_finish_bo()
362 radv_bo_destroy(device, NULL, device->sqtt.bo); in radv_sqtt_finish_bo()
367 radv_register_queue(struct radv_device *device, struct radv_queue *queue) in radv_register_queue() argument
369 struct ac_sqtt *sqtt = &device->sqtt; in radv_register_queue()
396 radv_unregister_queue(struct radv_device *device, struct radv_queue *queue) in radv_unregister_queue() argument
398 struct ac_sqtt *sqtt = &device->sqtt; in radv_unregister_queue()
417 radv_register_queues(struct radv_device *device, struct ac_sqtt *sqtt) in radv_register_queues() argument
419 if (device->queue_count[RADV_QUEUE_GENERAL] == 1) in radv_register_queues()
420 radv_register_queue(device, &device->queues[RADV_QUEUE_GENERAL][0]); in radv_register_queues()
422 for (uint32_t i = 0; i < device->queue_count[RADV_QUEUE_COMPUTE]; i++) in radv_register_queues()
423 radv_register_queue(device, &device->queues[RADV_QUEUE_COMPUTE][i]); in radv_register_queues()
427 radv_unregister_queues(struct radv_device *device, struct ac_sqtt *sqtt) in radv_unregister_queues() argument
429 if (device->queue_count[RADV_QUEUE_GENERAL] == 1) in radv_unregister_queues()
430 radv_unregister_queue(device, &device->queues[RADV_QUEUE_GENERAL][0]); in radv_unregister_queues()
432 for (uint32_t i = 0; i < device->queue_count[RADV_QUEUE_COMPUTE]; i++) in radv_unregister_queues()
433 radv_unregister_queue(device, &device->queues[RADV_QUEUE_COMPUTE][i]); in radv_unregister_queues()
437 radv_sqtt_init(struct radv_device *device) in radv_sqtt_init() argument
439 struct ac_sqtt *sqtt = &device->sqtt; in radv_sqtt_init()
442 …device->sqtt.buffer_size = (uint32_t)debug_get_num_option("RADV_THREAD_TRACE_BUFFER_SIZE", 32 * 10… in radv_sqtt_init()
443 device->sqtt.instruction_timing_enabled = radv_is_instruction_timing_enabled(); in radv_sqtt_init()
445 if (!radv_sqtt_init_bo(device)) in radv_sqtt_init()
448 if (!radv_sqtt_init_queue_event(device)) in radv_sqtt_init()
451 if (!radv_device_acquire_performance_counters(device)) in radv_sqtt_init()
456 radv_register_queues(device, sqtt); in radv_sqtt_init()
462 radv_sqtt_finish(struct radv_device *device) in radv_sqtt_finish() argument
464 struct ac_sqtt *sqtt = &device->sqtt; in radv_sqtt_finish()
465 struct radeon_winsys *ws = device->ws; in radv_sqtt_finish()
467 radv_sqtt_finish_bo(device); in radv_sqtt_finish()
468 radv_sqtt_finish_queue_event(device); in radv_sqtt_finish()
471 if (device->sqtt.start_cs[i]) in radv_sqtt_finish()
472 ws->cs_destroy(device->sqtt.start_cs[i]); in radv_sqtt_finish()
473 if (device->sqtt.stop_cs[i]) in radv_sqtt_finish()
474 ws->cs_destroy(device->sqtt.stop_cs[i]); in radv_sqtt_finish()
477 radv_unregister_queues(device, sqtt); in radv_sqtt_finish()
483 radv_sqtt_resize_bo(struct radv_device *device) in radv_sqtt_resize_bo() argument
486 radv_sqtt_finish_bo(device); in radv_sqtt_resize_bo()
489 device->sqtt.buffer_size *= 2; in radv_sqtt_resize_bo()
494 device->sqtt.buffer_size / 1024); in radv_sqtt_resize_bo()
497 return radv_sqtt_init_bo(device); in radv_sqtt_resize_bo()
503 struct radv_device *device = radv_queue_device(queue); in radv_begin_sqtt() local
504 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_begin_sqtt()
506 struct radeon_winsys *ws = device->ws; in radv_begin_sqtt()
511 if (device->sqtt.start_cs[family]) { in radv_begin_sqtt()
512 ws->cs_destroy(device->sqtt.start_cs[family]); in radv_begin_sqtt()
513 device->sqtt.start_cs[family] = NULL; in radv_begin_sqtt()
538 radv_emit_wait_for_idle(device, cs, family); in radv_begin_sqtt()
541 radv_emit_inhibit_clockgating(device, cs, true); in radv_begin_sqtt()
544 radv_emit_spi_config_cntl(device, cs, true); in radv_begin_sqtt()
548 if (device->spm.bo) { in radv_begin_sqtt()
550 radv_perfcounter_emit_shaders(device, cs, ac_sqtt_get_shader_mask(&pdev->info)); in radv_begin_sqtt()
552 radv_emit_spm_setup(device, cs, family); in radv_begin_sqtt()
556 radv_emit_sqtt_start(device, cs, family); in radv_begin_sqtt()
558 if (device->spm.bo) { in radv_begin_sqtt()
560 radv_perfcounter_emit_spm_start(device, cs, family); in radv_begin_sqtt()
569 device->sqtt.start_cs[family] = cs; in radv_begin_sqtt()
577 struct radv_device *device = radv_queue_device(queue); in radv_end_sqtt() local
579 struct radeon_winsys *ws = device->ws; in radv_end_sqtt()
584 if (device->sqtt.stop_cs[family]) { in radv_end_sqtt()
585 ws->cs_destroy(device->sqtt.stop_cs[family]); in radv_end_sqtt()
586 device->sqtt.stop_cs[family] = NULL; in radv_end_sqtt()
611 radv_emit_wait_for_idle(device, cs, family); in radv_end_sqtt()
613 if (device->spm.bo) { in radv_end_sqtt()
615 radv_perfcounter_emit_spm_stop(device, cs, family); in radv_end_sqtt()
619 radv_emit_sqtt_stop(device, cs, family); in radv_end_sqtt()
624 radv_emit_spi_config_cntl(device, cs, false); in radv_end_sqtt()
627 radv_emit_inhibit_clockgating(device, cs, false); in radv_end_sqtt()
635 device->sqtt.stop_cs[family] = cs; in radv_end_sqtt()
643 struct radv_device *device = radv_queue_device(queue); in radv_sqtt_start_capturing() local
644 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_sqtt_start_capturing()
650 "/sys/class/drm/card0/device/power_dpm_force_performance_level\"\n"); in radv_sqtt_start_capturing()
655 if (!radv_sqtt_sample_clocks(device)) { in radv_sqtt_start_capturing()
660 assert(!device->sqtt_enabled); in radv_sqtt_start_capturing()
661 device->sqtt_enabled = true; in radv_sqtt_start_capturing()
667 struct radv_device *device = radv_queue_device(queue); in radv_sqtt_stop_capturing() local
668 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_sqtt_stop_capturing()
674 device->sqtt_enabled = false; in radv_sqtt_stop_capturing()
677 device->vk.dispatch_table.QueueWaitIdle(radv_queue_to_handle(queue)); in radv_sqtt_stop_capturing()
679 …if (radv_get_sqtt_trace(queue, &sqtt_trace) && (!device->spm.bo || radv_get_spm_trace(queue, &spm_… in radv_sqtt_stop_capturing()
680 ac_dump_rgp_capture(&pdev->info, &sqtt_trace, device->spm.bo ? &spm_trace : NULL); in radv_sqtt_stop_capturing()
687 radv_reset_sqtt_trace(device); in radv_sqtt_stop_capturing()
695 struct radv_device *device = radv_queue_device(queue); in radv_get_sqtt_trace() local
696 const struct radv_physical_device *pdev = radv_device_physical(device); in radv_get_sqtt_trace()
699 if (!ac_sqtt_get_trace(&device->sqtt, gpu_info, sqtt_trace)) { in radv_get_sqtt_trace()
700 if (!radv_sqtt_resize_bo(device)) in radv_get_sqtt_trace()
709 radv_reset_sqtt_trace(struct radv_device *device) in radv_reset_sqtt_trace() argument
711 struct ac_sqtt *sqtt = &device->sqtt; in radv_reset_sqtt_trace()
734 radv_sqtt_reset_timestamp(device); in radv_reset_sqtt_trace()
737 simple_mtx_lock(&device->sqtt_command_pool_mtx); in radv_reset_sqtt_trace()
738 for (unsigned i = 0; i < ARRAY_SIZE(device->sqtt_command_pool); i++) { in radv_reset_sqtt_trace()
740 if (device->sqtt_command_pool[i]) in radv_reset_sqtt_trace()
741 …vk_common_TrimCommandPool(radv_device_to_handle(device), vk_command_pool_to_handle(device->sqtt_co… in radv_reset_sqtt_trace()
744 simple_mtx_unlock(&device->sqtt_command_pool_mtx); in radv_reset_sqtt_trace()
748 radv_get_calibrated_timestamps(struct radv_device *device, uint64_t *cpu_timestamp, uint64_t *gpu_t… in radv_get_calibrated_timestamps() argument
763 …result = device->vk.dispatch_table.GetCalibratedTimestampsKHR(radv_device_to_handle(device), 2, ti… in radv_get_calibrated_timestamps()
775 radv_sqtt_sample_clocks(struct radv_device *device) in radv_sqtt_sample_clocks() argument
780 result = radv_get_calibrated_timestamps(device, &cpu_timestamp, &gpu_timestamp); in radv_sqtt_sample_clocks()
784 return ac_sqtt_add_clock_calibration(&device->sqtt, cpu_timestamp, gpu_timestamp); in radv_sqtt_sample_clocks()
791 struct radv_device *device = radv_queue_device(queue); in radv_sqtt_get_timed_cmdbuf() local
799 simple_mtx_lock(&device->sqtt_command_pool_mtx); in radv_sqtt_get_timed_cmdbuf()
803 .commandPool = vk_command_pool_to_handle(device->sqtt_command_pool[queue_family]), in radv_sqtt_get_timed_cmdbuf()
808 result = vk_common_AllocateCommandBuffers(radv_device_to_handle(device), &alloc_info, &cmdbuf); in radv_sqtt_get_timed_cmdbuf()
821 radeon_check_space(device->ws, radv_cmd_buffer_from_handle(cmdbuf)->cs, 28); in radv_sqtt_get_timed_cmdbuf()
825 radv_cs_add_buffer(device->ws, radv_cmd_buffer_from_handle(cmdbuf)->cs, timestamp_bo); in radv_sqtt_get_timed_cmdbuf()
836 simple_mtx_unlock(&device->sqtt_command_pool_mtx); in radv_sqtt_get_timed_cmdbuf()