Lines Matching refs:device
118 radv_physical_device_init_mem_types(struct radv_physical_device *device) in radv_physical_device_init_mem_types() argument
121 uint64_t visible_vram_size = MIN2(device->rad_info.vram_size, in radv_physical_device_init_mem_types()
122 device->rad_info.vram_vis_size); in radv_physical_device_init_mem_types()
125 device->memory_properties.memoryHeapCount = 0; in radv_physical_device_init_mem_types()
126 if (device->rad_info.vram_size - visible_vram_size > 0) { in radv_physical_device_init_mem_types()
127 vram_index = device->memory_properties.memoryHeapCount++; in radv_physical_device_init_mem_types()
128 device->memory_properties.memoryHeaps[vram_index] = (VkMemoryHeap) { in radv_physical_device_init_mem_types()
129 .size = device->rad_info.vram_size - visible_vram_size, in radv_physical_device_init_mem_types()
134 visible_vram_index = device->memory_properties.memoryHeapCount++; in radv_physical_device_init_mem_types()
135 device->memory_properties.memoryHeaps[visible_vram_index] = (VkMemoryHeap) { in radv_physical_device_init_mem_types()
140 if (device->rad_info.gart_size > 0) { in radv_physical_device_init_mem_types()
141 gart_index = device->memory_properties.memoryHeapCount++; in radv_physical_device_init_mem_types()
142 device->memory_properties.memoryHeaps[gart_index] = (VkMemoryHeap) { in radv_physical_device_init_mem_types()
143 .size = device->rad_info.gart_size, in radv_physical_device_init_mem_types()
144 .flags = device->rad_info.has_dedicated_vram ? 0 : VK_MEMORY_HEAP_DEVICE_LOCAL_BIT, in radv_physical_device_init_mem_types()
151 device->mem_type_indices[type_count] = RADV_MEM_TYPE_VRAM; in radv_physical_device_init_mem_types()
152 device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) { in radv_physical_device_init_mem_types()
158 device->mem_type_indices[type_count] = RADV_MEM_TYPE_GTT_WRITE_COMBINE; in radv_physical_device_init_mem_types()
159 device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) { in radv_physical_device_init_mem_types()
162 (device->rad_info.has_dedicated_vram ? 0 : VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT), in radv_physical_device_init_mem_types()
167 device->mem_type_indices[type_count] = RADV_MEM_TYPE_VRAM_CPU_ACCESS; in radv_physical_device_init_mem_types()
168 device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) { in radv_physical_device_init_mem_types()
176 device->mem_type_indices[type_count] = RADV_MEM_TYPE_GTT_CACHED; in radv_physical_device_init_mem_types()
177 device->memory_properties.memoryTypes[type_count++] = (VkMemoryType) { in radv_physical_device_init_mem_types()
181 (device->rad_info.has_dedicated_vram ? 0 : VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT), in radv_physical_device_init_mem_types()
185 device->memory_properties.memoryTypeCount = type_count; in radv_physical_device_init_mem_types()
189 radv_physical_device_init(struct radv_physical_device *device, in radv_physical_device_init() argument
216 device->_loader_data.loaderMagic = ICD_LOADER_MAGIC; in radv_physical_device_init()
217 device->instance = instance; in radv_physical_device_init()
218 assert(strlen(path) < ARRAY_SIZE(device->path)); in radv_physical_device_init()
219 strncpy(device->path, path, ARRAY_SIZE(device->path)); in radv_physical_device_init()
221 device->ws = radv_amdgpu_winsys_create(fd, instance->debug_flags, in radv_physical_device_init()
223 if (!device->ws) { in radv_physical_device_init()
228 device->local_fd = fd; in radv_physical_device_init()
229 device->ws->query_info(device->ws, &device->rad_info); in radv_physical_device_init()
231 radv_get_device_name(device->rad_info.family, device->name, sizeof(device->name)); in radv_physical_device_init()
233 if (radv_device_get_cache_uuid(device->rad_info.family, device->cache_uuid)) { in radv_physical_device_init()
234 device->ws->destroy(device->ws); in radv_physical_device_init()
242 (device->instance->perftest_flags & RADV_PERFTEST_SISCHED ? 0x1 : 0) | in radv_physical_device_init()
243 (device->instance->debug_flags & RADV_DEBUG_UNSAFE_MATH ? 0x2 : 0); in radv_physical_device_init()
249 disk_cache_format_hex_id(buf, device->cache_uuid, VK_UUID_SIZE * 2); in radv_physical_device_init()
250 device->disk_cache = disk_cache_create(device->name, buf, shader_env_flags); in radv_physical_device_init()
254 radv_get_driver_uuid(&device->device_uuid); in radv_physical_device_init()
255 radv_get_device_uuid(&device->rad_info, &device->device_uuid); in radv_physical_device_init()
257 if (device->rad_info.family == CHIP_STONEY || in radv_physical_device_init()
258 device->rad_info.chip_class >= GFX9) { in radv_physical_device_init()
259 device->has_rbplus = true; in radv_physical_device_init()
260 device->rbplus_allowed = device->rad_info.family == CHIP_STONEY; in radv_physical_device_init()
266 device->has_clear_state = device->rad_info.chip_class >= CIK; in radv_physical_device_init()
268 device->cpdma_prefetch_writes_memory = device->rad_info.chip_class <= VI; in radv_physical_device_init()
271 device->has_scissor_bug = device->rad_info.family == CHIP_VEGA10 || in radv_physical_device_init()
272 device->rad_info.family == CHIP_RAVEN; in radv_physical_device_init()
274 radv_physical_device_init_mem_types(device); in radv_physical_device_init()
276 result = radv_init_wsi(device); in radv_physical_device_init()
278 device->ws->destroy(device->ws); in radv_physical_device_init()
290 radv_physical_device_finish(struct radv_physical_device *device) in radv_physical_device_finish() argument
292 radv_finish_wsi(device); in radv_physical_device_finish()
293 device->ws->destroy(device->ws); in radv_physical_device_finish()
294 disk_cache_destroy(device->disk_cache); in radv_physical_device_finish()
295 close(device->local_fd); in radv_physical_device_finish()
951 radv_queue_init(struct radv_device *device, struct radv_queue *queue, in radv_queue_init() argument
956 queue->device = device; in radv_queue_init()
961 queue->hw_ctx = device->ws->ctx_create(device->ws, queue->priority); in radv_queue_init()
972 queue->device->ws->ctx_destroy(queue->hw_ctx); in radv_queue_finish()
975 queue->device->ws->cs_destroy(queue->initial_full_flush_preamble_cs); in radv_queue_finish()
977 queue->device->ws->cs_destroy(queue->initial_preamble_cs); in radv_queue_finish()
979 queue->device->ws->cs_destroy(queue->continue_preamble_cs); in radv_queue_finish()
981 queue->device->ws->buffer_destroy(queue->descriptor_bo); in radv_queue_finish()
983 queue->device->ws->buffer_destroy(queue->scratch_bo); in radv_queue_finish()
985 queue->device->ws->buffer_destroy(queue->esgs_ring_bo); in radv_queue_finish()
987 queue->device->ws->buffer_destroy(queue->gsvs_ring_bo); in radv_queue_finish()
989 queue->device->ws->buffer_destroy(queue->tess_factor_ring_bo); in radv_queue_finish()
991 queue->device->ws->buffer_destroy(queue->tess_offchip_ring_bo); in radv_queue_finish()
993 queue->device->ws->buffer_destroy(queue->compute_scratch_bo); in radv_queue_finish()
997 radv_device_init_gs_info(struct radv_device *device) in radv_device_init_gs_info() argument
999 switch (device->physical_device->rad_info.family) { in radv_device_init_gs_info()
1008 device->gs_table_depth = 16; in radv_device_init_gs_info()
1022 device->gs_table_depth = 32; in radv_device_init_gs_info()
1037 struct radv_device *device; in radv_CreateDevice() local
1063 device = vk_zalloc2(&physical_device->instance->alloc, pAllocator, in radv_CreateDevice()
1064 sizeof(*device), 8, in radv_CreateDevice()
1066 if (!device) in radv_CreateDevice()
1069 device->_loader_data.loaderMagic = ICD_LOADER_MAGIC; in radv_CreateDevice()
1070 device->instance = physical_device->instance; in radv_CreateDevice()
1071 device->physical_device = physical_device; in radv_CreateDevice()
1073 device->ws = physical_device->ws; in radv_CreateDevice()
1075 device->alloc = *pAllocator; in radv_CreateDevice()
1077 device->alloc = physical_device->instance->alloc; in radv_CreateDevice()
1079 mtx_init(&device->shader_slab_mutex, mtx_plain); in radv_CreateDevice()
1080 list_inithead(&device->shader_slabs); in radv_CreateDevice()
1088 assert(!global_priority || device->physical_device->rad_info.has_ctx_priority); in radv_CreateDevice()
1090 device->queues[qfi] = vk_alloc(&device->alloc, in radv_CreateDevice()
1092 if (!device->queues[qfi]) { in radv_CreateDevice()
1097 memset(device->queues[qfi], 0, queue_create->queueCount * sizeof(struct radv_queue)); in radv_CreateDevice()
1099 device->queue_count[qfi] = queue_create->queueCount; in radv_CreateDevice()
1102 result = radv_queue_init(device, &device->queues[qfi][q], qfi, q, global_priority); in radv_CreateDevice()
1108 device->pbb_allowed = device->physical_device->rad_info.chip_class >= GFX9 && in radv_CreateDevice()
1109 (device->instance->perftest_flags & RADV_PERFTEST_BINNING); in radv_CreateDevice()
1112 device->dfsm_allowed = device->pbb_allowed && false; in radv_CreateDevice()
1115 device->always_use_syncobj = device->physical_device->rad_info.has_syncobj_wait_for_submit; in radv_CreateDevice()
1119 device->llvm_supports_spill = false; in radv_CreateDevice()
1121 device->llvm_supports_spill = true; in radv_CreateDevice()
1137 device->scratch_waves = MAX2(32 * physical_device->rad_info.num_good_compute_units, in radv_CreateDevice()
1140 device->dispatch_initiator = S_00B800_COMPUTE_SHADER_EN(1) | in radv_CreateDevice()
1143 if (device->physical_device->rad_info.chip_class >= CIK) { in radv_CreateDevice()
1147 device->dispatch_initiator |= S_00B800_ORDER_MODE(1); in radv_CreateDevice()
1150 radv_device_init_gs_info(device); in radv_CreateDevice()
1152 device->tess_offchip_block_dw_size = in radv_CreateDevice()
1153 device->physical_device->rad_info.family == CHIP_HAWAII ? 4096 : 8192; in radv_CreateDevice()
1154 device->has_distributed_tess = in radv_CreateDevice()
1155 device->physical_device->rad_info.chip_class >= VI && in radv_CreateDevice()
1156 device->physical_device->rad_info.max_se >= 2; in radv_CreateDevice()
1161 if (!radv_init_trace(device)) in radv_CreateDevice()
1165 device->keep_shader_info = keep_shader_info; in radv_CreateDevice()
1167 result = radv_device_init_meta(device); in radv_CreateDevice()
1171 radv_device_init_msaa(device); in radv_CreateDevice()
1174 device->empty_cs[family] = device->ws->cs_create(device->ws, family); in radv_CreateDevice()
1177 radeon_emit(device->empty_cs[family], PKT3(PKT3_CONTEXT_CONTROL, 1, 0)); in radv_CreateDevice()
1178 radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_LOAD_ENABLE(1)); in radv_CreateDevice()
1179 radeon_emit(device->empty_cs[family], CONTEXT_CONTROL_SHADOW_ENABLE(1)); in radv_CreateDevice()
1182 radeon_emit(device->empty_cs[family], PKT3(PKT3_NOP, 0, 0)); in radv_CreateDevice()
1183 radeon_emit(device->empty_cs[family], 0); in radv_CreateDevice()
1186 device->ws->cs_finalize(device->empty_cs[family]); in radv_CreateDevice()
1189 if (device->physical_device->rad_info.chip_class >= CIK) in radv_CreateDevice()
1190 cik_create_gfx_config(device); in radv_CreateDevice()
1199 result = radv_CreatePipelineCache(radv_device_to_handle(device), in radv_CreateDevice()
1204 device->mem_cache = radv_pipeline_cache_from_handle(pc); in radv_CreateDevice()
1206 *pDevice = radv_device_to_handle(device); in radv_CreateDevice()
1210 radv_device_finish_meta(device); in radv_CreateDevice()
1212 if (device->trace_bo) in radv_CreateDevice()
1213 device->ws->buffer_destroy(device->trace_bo); in radv_CreateDevice()
1215 if (device->gfx_init) in radv_CreateDevice()
1216 device->ws->buffer_destroy(device->gfx_init); in radv_CreateDevice()
1219 for (unsigned q = 0; q < device->queue_count[i]; q++) in radv_CreateDevice()
1220 radv_queue_finish(&device->queues[i][q]); in radv_CreateDevice()
1221 if (device->queue_count[i]) in radv_CreateDevice()
1222 vk_free(&device->alloc, device->queues[i]); in radv_CreateDevice()
1225 vk_free(&device->alloc, device); in radv_CreateDevice()
1233 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyDevice()
1235 if (!device) in radv_DestroyDevice()
1238 if (device->trace_bo) in radv_DestroyDevice()
1239 device->ws->buffer_destroy(device->trace_bo); in radv_DestroyDevice()
1241 if (device->gfx_init) in radv_DestroyDevice()
1242 device->ws->buffer_destroy(device->gfx_init); in radv_DestroyDevice()
1245 for (unsigned q = 0; q < device->queue_count[i]; q++) in radv_DestroyDevice()
1246 radv_queue_finish(&device->queues[i][q]); in radv_DestroyDevice()
1247 if (device->queue_count[i]) in radv_DestroyDevice()
1248 vk_free(&device->alloc, device->queues[i]); in radv_DestroyDevice()
1249 if (device->empty_cs[i]) in radv_DestroyDevice()
1250 device->ws->cs_destroy(device->empty_cs[i]); in radv_DestroyDevice()
1252 radv_device_finish_meta(device); in radv_DestroyDevice()
1254 VkPipelineCache pc = radv_pipeline_cache_to_handle(device->mem_cache); in radv_DestroyDevice()
1255 radv_DestroyPipelineCache(radv_device_to_handle(device), pc, NULL); in radv_DestroyDevice()
1257 radv_destroy_shader_slabs(device); in radv_DestroyDevice()
1259 vk_free(&device->alloc, device); in radv_DestroyDevice()
1295 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetDeviceQueue()
1297 *pQueue = radv_queue_to_handle(&device->queues[queueFamilyIndex][queueIndex]); in radv_GetDeviceQueue()
1434 memcpy(desc, queue->device->sample_locations_1x, 8); in fill_geom_tess_rings()
1436 memcpy(desc, queue->device->sample_locations_2x, 16); in fill_geom_tess_rings()
1438 memcpy(desc, queue->device->sample_locations_4x, 32); in fill_geom_tess_rings()
1440 memcpy(desc, queue->device->sample_locations_8x, 64); in fill_geom_tess_rings()
1442 memcpy(desc, queue->device->sample_locations_16x, 128); in fill_geom_tess_rings()
1446 radv_get_hs_offchip_param(struct radv_device *device, uint32_t *max_offchip_buffers_p) in radv_get_hs_offchip_param() argument
1448 bool double_offchip_buffers = device->physical_device->rad_info.chip_class >= CIK && in radv_get_hs_offchip_param()
1449 device->physical_device->rad_info.family != CHIP_CARRIZO && in radv_get_hs_offchip_param()
1450 device->physical_device->rad_info.family != CHIP_STONEY; in radv_get_hs_offchip_param()
1453 device->physical_device->rad_info.max_se; in radv_get_hs_offchip_param()
1456 switch (device->tess_offchip_block_dw_size) { in radv_get_hs_offchip_param()
1468 switch (device->physical_device->rad_info.chip_class) { in radv_get_hs_offchip_param()
1481 if (device->physical_device->rad_info.chip_class >= CIK) { in radv_get_hs_offchip_param()
1482 if (device->physical_device->rad_info.chip_class >= VI) in radv_get_hs_offchip_param()
1527 tess_factor_ring_size = 32768 * queue->device->physical_device->rad_info.max_se; in radv_get_preamble_cs()
1528 hs_offchip_param = radv_get_hs_offchip_param(queue->device, in radv_get_preamble_cs()
1531 queue->device->tess_offchip_block_dw_size * 4; in radv_get_preamble_cs()
1548 scratch_bo = queue->device->ws->buffer_create(queue->device->ws, in radv_get_preamble_cs()
1559 compute_scratch_bo = queue->device->ws->buffer_create(queue->device->ws, in radv_get_preamble_cs()
1571 esgs_ring_bo = queue->device->ws->buffer_create(queue->device->ws, in radv_get_preamble_cs()
1584 gsvs_ring_bo = queue->device->ws->buffer_create(queue->device->ws, in radv_get_preamble_cs()
1597 tess_factor_ring_bo = queue->device->ws->buffer_create(queue->device->ws, in radv_get_preamble_cs()
1604 tess_offchip_ring_bo = queue->device->ws->buffer_create(queue->device->ws, in radv_get_preamble_cs()
1631 descriptor_bo = queue->device->ws->buffer_create(queue->device->ws, in radv_get_preamble_cs()
1645 cs = queue->device->ws->cs_create(queue->device->ws, in radv_get_preamble_cs()
1653 radv_cs_add_buffer(queue->device->ws, cs, scratch_bo, 8); in radv_get_preamble_cs()
1656 radv_cs_add_buffer(queue->device->ws, cs, esgs_ring_bo, 8); in radv_get_preamble_cs()
1659 radv_cs_add_buffer(queue->device->ws, cs, gsvs_ring_bo, 8); in radv_get_preamble_cs()
1662 radv_cs_add_buffer(queue->device->ws, cs, tess_factor_ring_bo, 8); in radv_get_preamble_cs()
1665 radv_cs_add_buffer(queue->device->ws, cs, tess_offchip_ring_bo, 8); in radv_get_preamble_cs()
1668 radv_cs_add_buffer(queue->device->ws, cs, descriptor_bo, 8); in radv_get_preamble_cs()
1671 uint32_t *map = (uint32_t*)queue->device->ws->buffer_map(descriptor_bo); in radv_get_preamble_cs()
1689 queue->device->ws->buffer_unmap(descriptor_bo); in radv_get_preamble_cs()
1700 if (queue->device->physical_device->rad_info.chip_class >= CIK) { in radv_get_preamble_cs()
1713 if (queue->device->physical_device->rad_info.chip_class >= CIK) { in radv_get_preamble_cs()
1718 if (queue->device->physical_device->rad_info.chip_class >= GFX9) { in radv_get_preamble_cs()
1735 if (queue->device->physical_device->rad_info.chip_class >= GFX9) { in radv_get_preamble_cs()
1767 radv_cs_add_buffer(queue->device->ws, cs, compute_scratch_bo, 8); in radv_get_preamble_cs()
1776 queue->device->physical_device->rad_info.chip_class, in radv_get_preamble_cs()
1779 queue->device->physical_device->rad_info.chip_class >= CIK, in radv_get_preamble_cs()
1787 queue->device->physical_device->rad_info.chip_class, in radv_get_preamble_cs()
1790 queue->device->physical_device->rad_info.chip_class >= CIK, in radv_get_preamble_cs()
1797 if (!queue->device->ws->cs_finalize(cs)) in radv_get_preamble_cs()
1802 queue->device->ws->cs_destroy(queue->initial_full_flush_preamble_cs); in radv_get_preamble_cs()
1805 queue->device->ws->cs_destroy(queue->initial_preamble_cs); in radv_get_preamble_cs()
1808 queue->device->ws->cs_destroy(queue->continue_preamble_cs); in radv_get_preamble_cs()
1816 queue->device->ws->buffer_destroy(queue->scratch_bo); in radv_get_preamble_cs()
1823 queue->device->ws->buffer_destroy(queue->compute_scratch_bo); in radv_get_preamble_cs()
1830 queue->device->ws->buffer_destroy(queue->esgs_ring_bo); in radv_get_preamble_cs()
1837 queue->device->ws->buffer_destroy(queue->gsvs_ring_bo); in radv_get_preamble_cs()
1853 queue->device->ws->buffer_destroy(queue->descriptor_bo); in radv_get_preamble_cs()
1870 queue->device->ws->cs_destroy(dest_cs[i]); in radv_get_preamble_cs()
1872 queue->device->ws->buffer_destroy(descriptor_bo); in radv_get_preamble_cs()
1874 queue->device->ws->buffer_destroy(scratch_bo); in radv_get_preamble_cs()
1876 queue->device->ws->buffer_destroy(compute_scratch_bo); in radv_get_preamble_cs()
1878 queue->device->ws->buffer_destroy(esgs_ring_bo); in radv_get_preamble_cs()
1880 queue->device->ws->buffer_destroy(gsvs_ring_bo); in radv_get_preamble_cs()
1882 queue->device->ws->buffer_destroy(tess_factor_ring_bo); in radv_get_preamble_cs()
1884 queue->device->ws->buffer_destroy(tess_offchip_ring_bo); in radv_get_preamble_cs()
1962 static void radv_free_temp_syncobjs(struct radv_device *device, in radv_free_temp_syncobjs() argument
1970 device->ws->destroy_syncobj(device->ws, sem->temp_syncobj); in radv_free_temp_syncobjs()
2012 ret = queue->device->ws->cs_submit(queue->hw_ctx, queue->queue_idx, in radv_signal_fence()
2013 &queue->device->empty_cs[queue->queue_family_index], in radv_signal_fence()
2036 uint32_t max_cs_submission = queue->device->trace_bo ? 1 : UINT32_MAX; in radv_QueueSubmit()
2088 ret = queue->device->ws->cs_submit(ctx, queue->queue_idx, in radv_QueueSubmit()
2089 &queue->device->empty_cs[queue->queue_family_index], in radv_QueueSubmit()
2123 if (queue->device->trace_bo) in radv_QueueSubmit()
2124 *queue->device->trace_id_ptr = 0; in radv_QueueSubmit()
2129 ret = queue->device->ws->cs_submit(ctx, queue->queue_idx, cs_array + j, in radv_QueueSubmit()
2139 if (queue->device->trace_bo) { in radv_QueueSubmit()
2144 radv_free_temp_syncobjs(queue->device, in radv_QueueSubmit()
2166 queue->device->ws->ctx_wait_idle(queue->hw_ctx, in radv_QueueWaitIdle()
2175 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DeviceWaitIdle()
2178 for (unsigned q = 0; q < device->queue_count[i]; q++) { in radv_DeviceWaitIdle()
2179 radv_QueueWaitIdle(radv_queue_to_handle(&device->queues[i][q])); in radv_DeviceWaitIdle()
2209 VkDevice device, in radv_GetDeviceProcAddr() argument
2215 bool radv_get_memory_fd(struct radv_device *device, in radv_get_memory_fd() argument
2222 radv_init_metadata(device, memory->image, &metadata); in radv_get_memory_fd()
2223 device->ws->buffer_set_metadata(memory->bo, &metadata); in radv_get_memory_fd()
2226 return device->ws->buffer_get_fd(device->ws, memory->bo, in radv_get_memory_fd()
2230 static VkResult radv_alloc_memory(struct radv_device *device, in radv_alloc_memory() argument
2239 …enum radv_mem_type mem_type_index = device->physical_device->mem_type_indices[pAllocateInfo->memor… in radv_alloc_memory()
2259 mem = vk_alloc2(&device->alloc, pAllocator, sizeof(*mem), 8, in radv_alloc_memory()
2280 mem->bo = device->ws->buffer_from_fd(device->ws, import_info->fd, in radv_alloc_memory()
2309 …mem->bo = device->ws->buffer_create(device->ws, alloc_size, device->physical_device->rad_info.max_… in radv_alloc_memory()
2323 vk_free2(&device->alloc, pAllocator, mem); in radv_alloc_memory()
2334 RADV_FROM_HANDLE(radv_device, device, _device); in radv_AllocateMemory()
2335 return radv_alloc_memory(device, pAllocateInfo, pAllocator, pMem); in radv_AllocateMemory()
2343 RADV_FROM_HANDLE(radv_device, device, _device); in radv_FreeMemory()
2349 device->ws->buffer_destroy(mem->bo); in radv_FreeMemory()
2352 vk_free2(&device->alloc, pAllocator, mem); in radv_FreeMemory()
2363 RADV_FROM_HANDLE(radv_device, device, _device); in radv_MapMemory()
2371 *ppData = device->ws->buffer_map(mem->bo); in radv_MapMemory()
2384 RADV_FROM_HANDLE(radv_device, device, _device); in radv_UnmapMemory()
2390 device->ws->buffer_unmap(mem->bo); in radv_UnmapMemory()
2414 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetBufferMemoryRequirements()
2417 …pMemoryRequirements->memoryTypeBits = (1u << device->physical_device->memory_properties.memoryType… in radv_GetBufferMemoryRequirements()
2428 VkDevice device, in radv_GetBufferMemoryRequirements2KHR() argument
2432 radv_GetBufferMemoryRequirements(device, pInfo->buffer, in radv_GetBufferMemoryRequirements2KHR()
2455 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetImageMemoryRequirements()
2458 …pMemoryRequirements->memoryTypeBits = (1u << device->physical_device->memory_properties.memoryType… in radv_GetImageMemoryRequirements()
2465 VkDevice device, in radv_GetImageMemoryRequirements2KHR() argument
2469 radv_GetImageMemoryRequirements(device, pInfo->image, in radv_GetImageMemoryRequirements2KHR()
2490 VkDevice device, in radv_GetImageSparseMemoryRequirements() argument
2499 VkDevice device, in radv_GetImageSparseMemoryRequirements2KHR() argument
2508 VkDevice device, in radv_GetDeviceMemoryCommitment() argument
2515 VkResult radv_BindBufferMemory2KHR(VkDevice device, in radv_BindBufferMemory2KHR() argument
2534 VkDevice device, in radv_BindBufferMemory() argument
2546 return radv_BindBufferMemory2KHR(device, 1, &info); in radv_BindBufferMemory()
2549 VkResult radv_BindImageMemory2KHR(VkDevice device, in radv_BindImageMemory2KHR() argument
2570 VkDevice device, in radv_BindImageMemory() argument
2582 return radv_BindImageMemory2KHR(device, 1, &info); in radv_BindImageMemory()
2587 radv_sparse_buffer_bind_memory(struct radv_device *device, in radv_sparse_buffer_bind_memory() argument
2598 device->ws->buffer_virtual_bind(buffer->bo, in radv_sparse_buffer_bind_memory()
2607 radv_sparse_image_opaque_bind_memory(struct radv_device *device, in radv_sparse_image_opaque_bind_memory() argument
2618 device->ws->buffer_virtual_bind(image->bo, in radv_sparse_image_opaque_bind_memory()
2640 radv_sparse_buffer_bind_memory(queue->device, in radv_QueueBindSparse()
2645 radv_sparse_image_opaque_bind_memory(queue->device, in radv_QueueBindSparse()
2660 queue->device->ws->cs_submit(queue->hw_ctx, queue->queue_idx, in radv_QueueBindSparse()
2661 &queue->device->empty_cs[queue->queue_family_index], in radv_QueueBindSparse()
2690 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateFence()
2696 struct radv_fence *fence = vk_alloc2(&device->alloc, pAllocator, in radv_CreateFence()
2706 if (device->always_use_syncobj || handleTypes) { in radv_CreateFence()
2707 int ret = device->ws->create_syncobj(device->ws, &fence->syncobj); in radv_CreateFence()
2709 vk_free2(&device->alloc, pAllocator, fence); in radv_CreateFence()
2713 device->ws->signal_syncobj(device->ws, fence->syncobj); in radv_CreateFence()
2717 fence->fence = device->ws->create_fence(); in radv_CreateFence()
2719 vk_free2(&device->alloc, pAllocator, fence); in radv_CreateFence()
2735 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyFence()
2742 device->ws->destroy_syncobj(device->ws, fence->temp_syncobj); in radv_DestroyFence()
2744 device->ws->destroy_syncobj(device->ws, fence->syncobj); in radv_DestroyFence()
2746 device->ws->destroy_fence(fence->fence); in radv_DestroyFence()
2747 vk_free2(&device->alloc, pAllocator, fence); in radv_DestroyFence()
2774 RADV_FROM_HANDLE(radv_device, device, _device); in radv_WaitForFences()
2792 if (!device->ws->wait_syncobj(device->ws, fence->temp_syncobj, timeout)) in radv_WaitForFences()
2798 if (!device->ws->wait_syncobj(device->ws, fence->syncobj, timeout)) in radv_WaitForFences()
2818 expired = device->ws->fence_wait(device->ws, fence->fence, true, timeout); in radv_WaitForFences()
2832 RADV_FROM_HANDLE(radv_device, device, _device); in radv_ResetFences()
2841 device->ws->destroy_syncobj(device->ws, fence->temp_syncobj); in radv_ResetFences()
2846 device->ws->reset_syncobj(device->ws, fence->syncobj); in radv_ResetFences()
2855 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetFenceStatus()
2859 bool success = device->ws->wait_syncobj(device->ws, fence->temp_syncobj, 0); in radv_GetFenceStatus()
2864 bool success = device->ws->wait_syncobj(device->ws, fence->syncobj, 0); in radv_GetFenceStatus()
2872 if (!device->ws->fence_wait(device->ws, fence->fence, false, 0)) in radv_GetFenceStatus()
2887 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateSemaphore()
2893 struct radv_semaphore *sem = vk_alloc2(&device->alloc, pAllocator, in radv_CreateSemaphore()
2901 if (device->always_use_syncobj || handleTypes) { in radv_CreateSemaphore()
2902 assert (device->physical_device->rad_info.has_syncobj); in radv_CreateSemaphore()
2903 int ret = device->ws->create_syncobj(device->ws, &sem->syncobj); in radv_CreateSemaphore()
2905 vk_free2(&device->alloc, pAllocator, sem); in radv_CreateSemaphore()
2910 sem->sem = device->ws->create_sem(device->ws); in radv_CreateSemaphore()
2912 vk_free2(&device->alloc, pAllocator, sem); in radv_CreateSemaphore()
2927 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroySemaphore()
2933 device->ws->destroy_syncobj(device->ws, sem->syncobj); in radv_DestroySemaphore()
2935 device->ws->destroy_sem(sem->sem); in radv_DestroySemaphore()
2936 vk_free2(&device->alloc, pAllocator, sem); in radv_DestroySemaphore()
2945 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateEvent()
2946 struct radv_event *event = vk_alloc2(&device->alloc, pAllocator, in radv_CreateEvent()
2953 event->bo = device->ws->buffer_create(device->ws, 8, 8, in radv_CreateEvent()
2957 vk_free2(&device->alloc, pAllocator, event); in radv_CreateEvent()
2961 event->map = (uint64_t*)device->ws->buffer_map(event->bo); in radv_CreateEvent()
2973 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyEvent()
2978 device->ws->buffer_destroy(event->bo); in radv_DestroyEvent()
2979 vk_free2(&device->alloc, pAllocator, event); in radv_DestroyEvent()
3019 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateBuffer()
3024 buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8, in radv_CreateBuffer()
3039 buffer->bo = device->ws->buffer_create(device->ws, in radv_CreateBuffer()
3043 vk_free2(&device->alloc, pAllocator, buffer); in radv_CreateBuffer()
3058 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyBuffer()
3065 device->ws->buffer_destroy(buffer->bo); in radv_DestroyBuffer()
3067 vk_free2(&device->alloc, pAllocator, buffer); in radv_DestroyBuffer()
3085 radv_initialise_color_surface(struct radv_device *device, in radv_initialise_color_surface() argument
3106 if (device->physical_device->rad_info.chip_class >= GFX9) { in radv_initialise_color_surface()
3139 if (device->physical_device->rad_info.chip_class >= CIK) in radv_initialise_color_surface()
3145 if (device->physical_device->rad_info.chip_class >= CIK) in radv_initialise_color_surface()
3225 if (device->physical_device->rad_info.chip_class == SI) { in radv_initialise_color_surface()
3232 !(device->instance->debug_flags & RADV_DEBUG_NO_FAST_CLEARS)) in radv_initialise_color_surface()
3238 if (device->physical_device->rad_info.chip_class >= VI) { in radv_initialise_color_surface()
3248 if (!device->physical_device->rad_info.has_dedicated_vram) in radv_initialise_color_surface()
3273 device->physical_device->rad_info.chip_class == SI) { in radv_initialise_color_surface()
3278 if (device->physical_device->rad_info.chip_class >= GFX9) { in radv_initialise_color_surface()
3292 radv_initialise_ds_surface(struct radv_device *device, in radv_initialise_ds_surface() argument
3339 if (device->physical_device->rad_info.chip_class >= GFX9) { in radv_initialise_ds_surface()
3398 if (device->physical_device->rad_info.chip_class >= CIK) { in radv_initialise_ds_surface()
3399 struct radeon_info *info = &device->physical_device->rad_info; in radv_initialise_ds_surface()
3468 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateFramebuffer()
3475 framebuffer = vk_alloc2(&device->alloc, pAllocator, size, 8, in radv_CreateFramebuffer()
3489 radv_initialise_color_surface(device, &framebuffer->attachments[i].cb, iview); in radv_CreateFramebuffer()
3491 radv_initialise_ds_surface(device, &framebuffer->attachments[i].ds, iview); in radv_CreateFramebuffer()
3507 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroyFramebuffer()
3512 vk_free2(&device->alloc, pAllocator, fb); in radv_DestroyFramebuffer()
3624 radv_init_sampler(struct radv_device *device, in radv_init_sampler() argument
3631 bool is_vi = (device->physical_device->rad_info.chip_class >= VI); in radv_init_sampler()
3651 S_008F38_DISABLE_LSB_CEIL(device->physical_device->rad_info.chip_class <= VI) | in radv_init_sampler()
3664 RADV_FROM_HANDLE(radv_device, device, _device); in radv_CreateSampler()
3669 sampler = vk_alloc2(&device->alloc, pAllocator, sizeof(*sampler), 8, in radv_CreateSampler()
3674 radv_init_sampler(device, sampler, pCreateInfo); in radv_CreateSampler()
3685 RADV_FROM_HANDLE(radv_device, device, _device); in radv_DestroySampler()
3690 vk_free2(&device->alloc, pAllocator, sampler); in radv_DestroySampler()
3741 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetMemoryFdKHR()
3752 bool ret = radv_get_memory_fd(device, memory, pFD); in radv_GetMemoryFdKHR()
3780 static VkResult radv_import_opaque_fd(struct radv_device *device, in radv_import_opaque_fd() argument
3785 int ret = device->ws->import_syncobj(device->ws, fd, &syncobj_handle); in radv_import_opaque_fd()
3790 device->ws->destroy_syncobj(device->ws, *syncobj); in radv_import_opaque_fd()
3798 static VkResult radv_import_sync_fd(struct radv_device *device, in radv_import_sync_fd() argument
3806 int ret = device->ws->create_syncobj(device->ws, &syncobj_handle); in radv_import_sync_fd()
3813 device->ws->signal_syncobj(device->ws, syncobj_handle); in radv_import_sync_fd()
3815 int ret = device->ws->import_syncobj_from_sync_file(device->ws, syncobj_handle, fd); in radv_import_sync_fd()
3830 RADV_FROM_HANDLE(radv_device, device, _device); in radv_ImportSemaphoreFdKHR()
3842 return radv_import_opaque_fd(device, pImportSemaphoreFdInfo->fd, syncobj_dst); in radv_ImportSemaphoreFdKHR()
3844 return radv_import_sync_fd(device, pImportSemaphoreFdInfo->fd, syncobj_dst); in radv_ImportSemaphoreFdKHR()
3854 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetSemaphoreFdKHR()
3866 ret = device->ws->export_syncobj(device->ws, syncobj_handle, pFd); in radv_GetSemaphoreFdKHR()
3869 ret = device->ws->export_syncobj_to_sync_file(device->ws, syncobj_handle, pFd); in radv_GetSemaphoreFdKHR()
3875 device->ws->reset_syncobj(device->ws, syncobj_handle); in radv_GetSemaphoreFdKHR()
3918 RADV_FROM_HANDLE(radv_device, device, _device); in radv_ImportFenceFdKHR()
3931 return radv_import_opaque_fd(device, pImportFenceFdInfo->fd, syncobj_dst); in radv_ImportFenceFdKHR()
3933 return radv_import_sync_fd(device, pImportFenceFdInfo->fd, syncobj_dst); in radv_ImportFenceFdKHR()
3943 RADV_FROM_HANDLE(radv_device, device, _device); in radv_GetFenceFdKHR()
3955 ret = device->ws->export_syncobj(device->ws, syncobj_handle, pFd); in radv_GetFenceFdKHR()
3958 ret = device->ws->export_syncobj_to_sync_file(device->ws, syncobj_handle, pFd); in radv_GetFenceFdKHR()
3964 device->ws->reset_syncobj(device->ws, syncobj_handle); in radv_GetFenceFdKHR()