Lines Matching refs:device
183 radv_physical_device_init(struct radv_physical_device *device, in radv_physical_device_init() argument
209 device->_loader_data.loaderMagic = ICD_LOADER_MAGIC; in radv_physical_device_init()
210 device->instance = instance; in radv_physical_device_init()
211 assert(strlen(path) < ARRAY_SIZE(device->path)); in radv_physical_device_init()
212 strncpy(device->path, path, ARRAY_SIZE(device->path)); in radv_physical_device_init()
214 device->ws = radv_amdgpu_winsys_create(fd); in radv_physical_device_init()
215 if (!device->ws) { in radv_physical_device_init()
219 device->ws->query_info(device->ws, &device->rad_info); in radv_physical_device_init()
220 result = radv_init_wsi(device); in radv_physical_device_init()
222 device->ws->destroy(device->ws); in radv_physical_device_init()
226 if (radv_device_get_cache_uuid(device->rad_info.family, device->uuid)) { in radv_physical_device_init()
227 radv_finish_wsi(device); in radv_physical_device_init()
228 device->ws->destroy(device->ws); in radv_physical_device_init()
235 &device->extensions, in radv_physical_device_init()
242 device->name = device->rad_info.name; in radv_physical_device_init()
252 radv_physical_device_finish(struct radv_physical_device *device) in radv_physical_device_finish() argument
254 radv_extensions_finish(device->instance, &device->extensions); in radv_physical_device_finish()
255 radv_finish_wsi(device); in radv_physical_device_finish()
256 device->ws->destroy(device->ws); in radv_physical_device_finish()
703 radv_queue_init(struct radv_device *device, struct radv_queue *queue, in radv_queue_init() argument
707 queue->device = device; in radv_queue_init()
711 queue->hw_ctx = device->ws->ctx_create(device->ws); in radv_queue_init()
722 queue->device->ws->ctx_destroy(queue->hw_ctx); in radv_queue_finish()
733 struct radv_device *device; in radv_CreateDevice() local
742 device = vk_alloc2(&physical_device->instance->alloc, pAllocator, in radv_CreateDevice()
743 sizeof(*device), 8, in radv_CreateDevice()
745 if (!device) in radv_CreateDevice()
748 memset(device, 0, sizeof(*device)); in radv_CreateDevice()
750 device->_loader_data.loaderMagic = ICD_LOADER_MAGIC; in radv_CreateDevice()
751 device->instance = physical_device->instance; in radv_CreateDevice()
752 device->physical_device = physical_device; in radv_CreateDevice()
754 device->debug_flags = device->instance->debug_flags; in radv_CreateDevice()
756 device->ws = physical_device->ws; in radv_CreateDevice()
758 device->alloc = *pAllocator; in radv_CreateDevice()
760 device->alloc = physical_device->instance->alloc; in radv_CreateDevice()
766 device->queues[qfi] = vk_alloc(&device->alloc, in radv_CreateDevice()
768 if (!device->queues[qfi]) { in radv_CreateDevice()
773 memset(device->queues[qfi], 0, queue_create->queueCount * sizeof(struct radv_queue)); in radv_CreateDevice()
775 device->queue_count[qfi] = queue_create->queueCount; in radv_CreateDevice()
778 result = radv_queue_init(device, &device->queues[qfi][q], qfi, q); in radv_CreateDevice()
784 result = radv_device_init_meta(device); in radv_CreateDevice()
788 radv_device_init_msaa(device); in radv_CreateDevice()
791 device->empty_cs[family] = device->ws->cs_create(device->ws, family); in radv_CreateDevice()
794 radeon_emit(device->empty_cs[family], PKT3(PKT3_CONTEXT_CONTROL, 1, 0)); in radv_CreateDevice()
795 radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_LOAD_ENABLE(1)); in radv_CreateDevice()
796 radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_SHADOW_ENABLE(1)); in radv_CreateDevice()
799 radeon_emit(device->empty_cs[family], PKT3(PKT3_NOP, 0, 0)); in radv_CreateDevice()
800 radeon_emit(device->empty_cs[family], 0); in radv_CreateDevice()
803 device->ws->cs_finalize(device->empty_cs[family]); in radv_CreateDevice()
807 device->trace_bo = device->ws->buffer_create(device->ws, 4096, 8, in radv_CreateDevice()
809 if (!device->trace_bo) in radv_CreateDevice()
812 device->trace_id_ptr = device->ws->buffer_map(device->trace_bo); in radv_CreateDevice()
813 if (!device->trace_id_ptr) in radv_CreateDevice()
817 *pDevice = radv_device_to_handle(device); in radv_CreateDevice()
821 if (device->trace_bo) in radv_CreateDevice()
822 device->ws->buffer_destroy(device->trace_bo); in radv_CreateDevice()
825 for (unsigned q = 0; q < device->queue_count[i]; q++) in radv_CreateDevice()
826 radv_queue_finish(&device->queues[i][q]); in radv_CreateDevice()
827 if (device->queue_count[i]) in radv_CreateDevice()
828 vk_free(&device->alloc, device->queues[i]); in radv_CreateDevice()
831 vk_free(&device->alloc, device); in radv_CreateDevice()
839 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyDevice()
841 if (device->trace_bo) in radv_DestroyDevice()
842 device->ws->buffer_destroy(device->trace_bo); in radv_DestroyDevice()
845 for (unsigned q = 0; q < device->queue_count[i]; q++) in radv_DestroyDevice()
846 radv_queue_finish(&device->queues[i][q]); in radv_DestroyDevice()
847 if (device->queue_count[i]) in radv_DestroyDevice()
848 vk_free(&device->alloc, device->queues[i]); in radv_DestroyDevice()
850 radv_device_finish_meta(device); in radv_DestroyDevice()
852 vk_free(&device->alloc, device); in radv_DestroyDevice()
929 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetDeviceQueue()
931 *pQueue = radv_queue_to_handle(&device->queues[queueFamilyIndex][queueIndex]); in radv_GetDeviceQueue()
934 static void radv_dump_trace(struct radv_device *device, in radv_dump_trace() argument
944 fprintf(f, "Trace ID: %x\n", *device->trace_id_ptr); in radv_dump_trace()
945 device->ws->cs_dump(cs, f, *device->trace_id_ptr); in radv_dump_trace()
960 uint32_t max_cs_submission = queue->device->trace_bo ? 1 : UINT32_MAX; in radv_QueueSubmit()
989 if (queue->device->trace_bo) in radv_QueueSubmit()
990 *queue->device->trace_id_ptr = 0; in radv_QueueSubmit()
992 ret = queue->device->ws->cs_submit(ctx, queue->queue_idx, cs_array + j, advance, in radv_QueueSubmit()
1003 if (queue->device->trace_bo) { in radv_QueueSubmit()
1004 bool success = queue->device->ws->ctx_wait_idle( in radv_QueueSubmit()
1011 radv_dump_trace(queue->device, cs_array[j]); in radv_QueueSubmit()
1021 ret = queue->device->ws->cs_submit(ctx, queue->queue_idx, in radv_QueueSubmit()
1022 &queue->device->empty_cs[queue->queue_family_index], in radv_QueueSubmit()
1036 queue->device->ws->ctx_wait_idle(queue->hw_ctx, in radv_QueueWaitIdle()
1045 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DeviceWaitIdle()
1048 for (unsigned q = 0; q < device->queue_count[i]; q++) { in radv_DeviceWaitIdle()
1049 radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q])); in radv_DeviceWaitIdle()
1079 VkDevice device, in radv_GetDeviceProcAddr() argument
1091 RADV_FROM_HANDLE(radv_device, device, _device); in radv_AllocateMemory()
1104 mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8, in radv_AllocateMemory()
1124 mem->bo = device->ws->buffer_create(device->ws, alloc_size, 65536, in radv_AllocateMemory()
1138 vk_free2(&device->alloc, pAllocator, mem); in radv_AllocateMemory()
1148 RADV_FROM_HANDLE(radv_device, device, _device); in radv_FreeMemory()
1154 device->ws->buffer_destroy(mem->bo); in radv_FreeMemory()
1157 vk_free2(&device->alloc, pAllocator, mem); in radv_FreeMemory()
1168 RADV_FROM_HANDLE(radv_device, device, _device); in radv_MapMemory()
1176 *ppData = device->ws->buffer_map(mem->bo); in radv_MapMemory()
1189 RADV_FROM_HANDLE(radv_device, device, _device); in radv_UnmapMemory()
1195 device->ws->buffer_unmap(mem->bo); in radv_UnmapMemory()
1215 VkDevice device, in radv_GetBufferMemoryRequirements() argument
1228 VkDevice device, in radv_GetImageMemoryRequirements() argument
1241 VkDevice device, in radv_GetImageSparseMemoryRequirements() argument
1250 VkDevice device, in radv_GetDeviceMemoryCommitment() argument
1258 VkDevice device, in radv_BindBufferMemory() argument
1278 VkDevice device, in radv_BindImageMemory() argument
1312 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateFence()
1313 struct radv_fence *fence = vk_alloc2(&device->alloc, pAllocator, in radv_CreateFence()
1323 fence->fence = device->ws->create_fence(); in radv_CreateFence()
1325 vk_free2(&device->alloc, pAllocator, fence); in radv_CreateFence()
1339 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyFence()
1344 device->ws->destroy_fence(fence->fence); in radv_DestroyFence()
1345 vk_free2(&device->alloc, pAllocator, fence); in radv_DestroyFence()
1368 RADV_FROM_HANDLE(radv_device, device, _device); in radv_WaitForFences()
1385 expired = device->ws->fence_wait(device->ws, fence->fence, true, timeout); in radv_WaitForFences()
1395 VkResult radv_ResetFences(VkDevice device, in radv_ResetFences() argument
1409 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetFenceStatus()
1417 if (!device->ws->fence_wait(device->ws, fence->fence, false, 0)) in radv_GetFenceStatus()
1432 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateSemaphore()
1435 sem = device->ws->create_sem(device->ws); in radv_CreateSemaphore()
1448 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroySemaphore()
1454 device->ws->destroy_sem(sem); in radv_DestroySemaphore()
1463 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateEvent()
1464 struct radv_event *event = vk_alloc2(&device->alloc, pAllocator, in radv_CreateEvent()
1471 event->bo = device->ws->buffer_create(device->ws, 8, 8, in radv_CreateEvent()
1475 vk_free2(&device->alloc, pAllocator, event); in radv_CreateEvent()
1479 event->map = (uint64_t*)device->ws->buffer_map(event->bo); in radv_CreateEvent()
1491 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyEvent()
1496 device->ws->buffer_destroy(event->bo); in radv_DestroyEvent()
1497 vk_free2(&device->alloc, pAllocator, event); in radv_DestroyEvent()
1537 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateBuffer()
1542 buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8, in radv_CreateBuffer()
1562 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyBuffer()
1568 vk_free2(&device->alloc, pAllocator, buffer); in radv_DestroyBuffer()
1581 radv_initialise_color_surface(struct radv_device *device, in radv_initialise_color_surface() argument
1597 va = device->ws->buffer_get_va(iview->bo) + iview->image->offset; in radv_initialise_color_surface()
1602 va = device->ws->buffer_get_va(iview->bo) + iview->image->offset; in radv_initialise_color_surface()
1607 va = device->ws->buffer_get_va(iview->bo) + iview->image->offset; in radv_initialise_color_surface()
1634 va = device->ws->buffer_get_va(iview->bo) + iview->image->offset + iview->image->fmask.offset; in radv_initialise_color_surface()
1635 if (device->physical_device->rad_info.chip_class >= CIK) in radv_initialise_color_surface()
1642 if (device->physical_device->rad_info.chip_class >= CIK) in radv_initialise_color_surface()
1696 (device->debug_flags & RADV_DEBUG_FAST_CLEARS)) in radv_initialise_color_surface()
1702 if (device->physical_device->rad_info.chip_class >= VI) { in radv_initialise_color_surface()
1717 device->physical_device->rad_info.chip_class == SI) { in radv_initialise_color_surface()
1724 radv_initialise_ds_surface(struct radv_device *device, in radv_initialise_ds_surface() argument
1759 va = device->ws->buffer_get_va(iview->bo) + iview->image->offset; in radv_initialise_ds_surface()
1777 if (device->physical_device->rad_info.chip_class >= CIK) { in radv_initialise_ds_surface()
1778 struct radeon_info *info = &device->physical_device->rad_info; in radv_initialise_ds_surface()
1824 va = device->ws->buffer_get_va(iview->bo) + iview->image->offset + in radv_initialise_ds_surface()
1847 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateFramebuffer()
1854 framebuffer = vk_alloc2(&device->alloc, pAllocator, size, 8, in radv_CreateFramebuffer()
1865 radv_initialise_color_surface(device, &framebuffer->attachments[i].cb, iview); in radv_CreateFramebuffer()
1867 radv_initialise_ds_surface(device, &framebuffer->attachments[i].ds, iview); in radv_CreateFramebuffer()
1884 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyFramebuffer()
1889 vk_free2(&device->alloc, pAllocator, fb); in radv_DestroyFramebuffer()
2001 radv_init_sampler(struct radv_device *device, in radv_init_sampler() argument
2008 bool is_vi = (device->physical_device->rad_info.chip_class >= VI); in radv_init_sampler()
2041 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateSampler()
2046 sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8, in radv_CreateSampler()
2051 radv_init_sampler(device, sampler, pCreateInfo); in radv_CreateSampler()
2062 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroySampler()
2067 vk_free2(&device->alloc, pAllocator, sampler); in radv_DestroySampler()