Lines Matching refs:hwctx
107 #define GET_QUEUE_COUNT(hwctx, graph, comp, tx) ( \ argument
108 graph ? hwctx->nb_graphics_queues : \
109 comp ? (hwctx->nb_comp_queues ? \
110 hwctx->nb_comp_queues : hwctx->nb_graphics_queues) : \
111 tx ? (hwctx->nb_tx_queues ? hwctx->nb_tx_queues : \
112 (hwctx->nb_comp_queues ? \
113 hwctx->nb_comp_queues : hwctx->nb_graphics_queues)) : \
220 static int pixfmt_is_supported(AVVulkanDeviceContext *hwctx, enum AVPixelFormat p, in pixfmt_is_supported() argument
234 vkGetPhysicalDeviceFormatProperties2(hwctx->phys_dev, fmt[i], &prop); in pixfmt_is_supported()
345 AVVulkanDeviceContext *hwctx = ctx->hwctx; in check_extensions() local
385 vkEnumerateDeviceExtensionProperties(hwctx->phys_dev, NULL, in check_extensions()
390 vkEnumerateDeviceExtensionProperties(hwctx->phys_dev, NULL, in check_extensions()
475 AVVulkanDeviceContext *hwctx = ctx->hwctx; in create_instance() local
504 ret = vkCreateInstance(&inst_props, hwctx->alloc, &hwctx->inst); in create_instance()
529 VK_LOAD_PFN(hwctx->inst, vkCreateDebugUtilsMessengerEXT); in create_instance()
531 pfn_vkCreateDebugUtilsMessengerEXT(hwctx->inst, &dbg, in create_instance()
532 hwctx->alloc, &p->debug_ctx); in create_instance()
535 hwctx->enabled_inst_extensions = inst_props.ppEnabledExtensionNames; in create_instance()
536 hwctx->nb_enabled_inst_extensions = inst_props.enabledExtensionCount; in create_instance()
570 AVVulkanDeviceContext *hwctx = ctx->hwctx; in find_device() local
572 ret = vkEnumeratePhysicalDevices(hwctx->inst, &num, NULL); in find_device()
582 ret = vkEnumeratePhysicalDevices(hwctx->inst, &num, devices); in find_device()
674 hwctx->phys_dev = devices[choice]; in find_device()
688 AVVulkanDeviceContext *hwctx = ctx->hwctx; in search_queue_families() local
693 vkGetPhysicalDeviceQueueFamilyProperties(hwctx->phys_dev, &num, NULL); in search_queue_families()
705 vkGetPhysicalDeviceQueueFamilyProperties(hwctx->phys_dev, &num, qs); in search_queue_families()
745 hwctx->queue_family_index = graph_index; in search_queue_families()
746 hwctx->queue_family_comp_index = graph_index; in search_queue_families()
747 hwctx->queue_family_tx_index = graph_index; in search_queue_families()
748 hwctx->nb_graphics_queues = qs[graph_index].queueCount; in search_queue_families()
752 hwctx->queue_family_tx_index = comp_index; in search_queue_families()
753 hwctx->queue_family_comp_index = comp_index; in search_queue_families()
754 hwctx->nb_comp_queues = qs[comp_index].queueCount; in search_queue_families()
759 hwctx->queue_family_tx_index = tx_index; in search_queue_families()
760 hwctx->nb_tx_queues = qs[tx_index].queueCount; in search_queue_families()
781 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in create_exec_ctx() local
797 ret = vkCreateCommandPool(hwctx->act_dev, &cqueue_create, in create_exec_ctx()
798 hwctx->alloc, &cmd->pool); in create_exec_ctx()
812 ret = vkAllocateCommandBuffers(hwctx->act_dev, &cbuf_create, cmd->bufs); in create_exec_ctx()
826 vkGetDeviceQueue(hwctx->act_dev, queue_family_index, i, &q->queue); in create_exec_ctx()
835 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in free_exec_ctx() local
843 vkWaitForFences(hwctx->act_dev, 1, &q->fence, VK_TRUE, UINT64_MAX); in free_exec_ctx()
844 vkResetFences(hwctx->act_dev, 1, &q->fence); in free_exec_ctx()
849 vkDestroyFence(hwctx->act_dev, q->fence, hwctx->alloc); in free_exec_ctx()
859 vkFreeCommandBuffers(hwctx->act_dev, cmd->pool, cmd->nb_queues, cmd->bufs); in free_exec_ctx()
861 vkDestroyCommandPool(hwctx->act_dev, cmd->pool, hwctx->alloc); in free_exec_ctx()
885 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in wait_start_exec_ctx() local
898 ret = vkCreateFence(hwctx->act_dev, &fence_spawn, hwctx->alloc, in wait_start_exec_ctx()
906 vkWaitForFences(hwctx->act_dev, 1, &q->fence, VK_TRUE, UINT64_MAX); in wait_start_exec_ctx()
907 vkResetFences(hwctx->act_dev, 1, &q->fence); in wait_start_exec_ctx()
979 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in submit_exec_ctx() local
980 vkWaitForFences(hwctx->act_dev, 1, &q->fence, VK_TRUE, UINT64_MAX); in submit_exec_ctx()
981 vkResetFences(hwctx->act_dev, 1, &q->fence); in submit_exec_ctx()
993 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_device_free() local
995 vkDestroyDevice(hwctx->act_dev, hwctx->alloc); in vulkan_device_free()
998 VK_LOAD_PFN(hwctx->inst, vkDestroyDebugUtilsMessengerEXT); in vulkan_device_free()
999 pfn_vkDestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx, in vulkan_device_free()
1000 hwctx->alloc); in vulkan_device_free()
1003 vkDestroyInstance(hwctx->inst, hwctx->alloc); in vulkan_device_free()
1005 for (int i = 0; i < hwctx->nb_enabled_inst_extensions; i++) in vulkan_device_free()
1006 av_free((void *)hwctx->enabled_inst_extensions[i]); in vulkan_device_free()
1007 av_free((void *)hwctx->enabled_inst_extensions); in vulkan_device_free()
1009 for (int i = 0; i < hwctx->nb_enabled_dev_extensions; i++) in vulkan_device_free()
1010 av_free((void *)hwctx->enabled_dev_extensions[i]); in vulkan_device_free()
1011 av_free((void *)hwctx->enabled_dev_extensions); in vulkan_device_free()
1022 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_device_create_internal() local
1032 .pNext = &hwctx->device_features, in vulkan_device_create_internal()
1037 hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; in vulkan_device_create_internal()
1048 vkGetPhysicalDeviceFeatures(hwctx->phys_dev, &dev_features); in vulkan_device_create_internal()
1050 COPY_FEATURE(hwctx->device_features, shaderImageGatherExtended) in vulkan_device_create_internal()
1051 COPY_FEATURE(hwctx->device_features, shaderStorageImageReadWithoutFormat) in vulkan_device_create_internal()
1052 COPY_FEATURE(hwctx->device_features, shaderStorageImageWriteWithoutFormat) in vulkan_device_create_internal()
1053 COPY_FEATURE(hwctx->device_features, fragmentStoresAndAtomics) in vulkan_device_create_internal()
1054 COPY_FEATURE(hwctx->device_features, vertexPipelineStoresAndAtomics) in vulkan_device_create_internal()
1055 COPY_FEATURE(hwctx->device_features, shaderInt64) in vulkan_device_create_internal()
1070 ret = vkCreateDevice(hwctx->phys_dev, &dev_info, hwctx->alloc, in vulkan_device_create_internal()
1071 &hwctx->act_dev); in vulkan_device_create_internal()
1092 hwctx->enabled_dev_extensions = dev_info.ppEnabledExtensionNames; in vulkan_device_create_internal()
1093 hwctx->nb_enabled_dev_extensions = dev_info.enabledExtensionCount; in vulkan_device_create_internal()
1102 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_device_init() local
1106 for (int i = 0; i < hwctx->nb_enabled_dev_extensions; i++) { in vulkan_device_init()
1108 if (!strcmp(hwctx->enabled_dev_extensions[i], in vulkan_device_init()
1111 hwctx->enabled_dev_extensions[i]); in vulkan_device_init()
1122 vkGetPhysicalDeviceProperties2(hwctx->phys_dev, &p->props); in vulkan_device_init()
1136 vkGetPhysicalDeviceQueueFamilyProperties(hwctx->phys_dev, &queue_num, NULL); in vulkan_device_init()
1149 CHECK_QUEUE("graphics", hwctx->queue_family_index) in vulkan_device_init()
1150 CHECK_QUEUE("upload", hwctx->queue_family_tx_index) in vulkan_device_init()
1151 CHECK_QUEUE("compute", hwctx->queue_family_comp_index) in vulkan_device_init()
1155 p->qfs[p->num_qfs++] = hwctx->queue_family_index; in vulkan_device_init()
1156 if ((hwctx->queue_family_tx_index != hwctx->queue_family_index) && in vulkan_device_init()
1157 (hwctx->queue_family_tx_index != hwctx->queue_family_comp_index)) in vulkan_device_init()
1158 p->qfs[p->num_qfs++] = hwctx->queue_family_tx_index; in vulkan_device_init()
1159 if ((hwctx->queue_family_comp_index != hwctx->queue_family_index) && in vulkan_device_init()
1160 (hwctx->queue_family_comp_index != hwctx->queue_family_tx_index)) in vulkan_device_init()
1161 p->qfs[p->num_qfs++] = hwctx->queue_family_comp_index; in vulkan_device_init()
1164 vkGetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops); in vulkan_device_init()
1198 AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx; in vulkan_device_derive()
1215 AVDRMDeviceContext *src_hwctx = src_ctx->hwctx; in vulkan_device_derive()
1235 AVCUDADeviceContext *src_hwctx = src_ctx->hwctx; in vulkan_device_derive()
1261 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_frames_get_constraints() local
1265 count += pixfmt_is_supported(hwctx, i, p->use_linear_images); in vulkan_frames_get_constraints()
1279 if (pixfmt_is_supported(hwctx, i, p->use_linear_images)) in vulkan_frames_get_constraints()
1310 AVVulkanDeviceContext *dev_hwctx = ctx->hwctx; in alloc_mem()
1370 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_free_internal()
1394 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_frame_free() local
1400 vkDestroyImage(hwctx->act_dev, f->img[i], hwctx->alloc); in vulkan_frame_free()
1401 vkFreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); in vulkan_frame_free()
1402 vkDestroySemaphore(hwctx->act_dev, f->sem[i], hwctx->alloc); in vulkan_frame_free()
1418 AVVulkanDeviceContext *hwctx = ctx->hwctx; in alloc_bind_mem() local
1438 vkGetImageMemoryRequirements2(hwctx->act_dev, &req_desc, &req); in alloc_bind_mem()
1466 ret = vkBindImageMemory2(hwctx->act_dev, planes, bind_info); in alloc_bind_mem()
1580 AVVulkanDeviceContext *hwctx = ctx->hwctx; in create_frame() local
1625 ret = vkCreateImage(hwctx->act_dev, &create_info, in create_frame()
1626 hwctx->alloc, &f->img[i]); in create_frame()
1635 ret = vkCreateSemaphore(hwctx->act_dev, &sem_spawn, in create_frame()
1636 hwctx->alloc, &f->sem[i]); in create_frame()
1638 av_log(hwctx, AV_LOG_ERROR, "Failed to create semaphore: %s\n", in create_frame()
1665 AVVulkanFramesContext *hwctx = hwfc->hwctx; in try_export_flags() local
1666 AVVulkanDeviceContext *dev_hwctx = hwfc->device_ctx->hwctx; in try_export_flags()
1683 .tiling = hwctx->tiling, in try_export_flags()
1684 .usage = hwctx->usage, in try_export_flags()
1702 AVVulkanFramesContext *hwctx = hwfc->hwctx; in vulkan_pool_alloc() local
1710 .pNext = hwctx->create_pnext, in vulkan_pool_alloc()
1723 eminfo[i].pNext = hwctx->alloc_pnext[i]; in vulkan_pool_alloc()
1727 err = create_frame(hwfc, &f, hwctx->tiling, hwctx->usage, in vulkan_pool_alloc()
1765 AVVulkanFramesContext *hwctx = hwfc->hwctx; in vulkan_frames_init() local
1767 AVVulkanDeviceContext *dev_hwctx = hwfc->device_ctx->hwctx; in vulkan_frames_init()
1771 hwctx->tiling = hwctx->tiling ? hwctx->tiling : p->use_linear_images ? in vulkan_frames_init()
1774 if (!hwctx->usage) in vulkan_frames_init()
1775 hwctx->usage = DEFAULT_USAGE_FLAGS; in vulkan_frames_init()
1795 err = create_frame(hwfc, &f, hwctx->tiling, hwctx->usage, in vulkan_frames_init()
1796 hwctx->create_pnext); in vulkan_frames_init()
1852 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_unmap_frame() local
1867 ret = vkFlushMappedMemoryRanges(hwctx->act_dev, planes, in vulkan_unmap_frame()
1876 vkUnmapMemory(hwctx->act_dev, map->frame->mem[i]); in vulkan_unmap_frame()
1887 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_map_frame_to_mem() local
1913 ret = vkMapMemory(hwctx->act_dev, f->mem[i], 0, in vulkan_map_frame_to_mem()
1934 ret = vkInvalidateMappedMemoryRanges(hwctx->act_dev, planes, in vulkan_map_frame_to_mem()
1949 vkGetImageSubresourceLayout(hwctx->act_dev, f->img[i], &sub, &layout); in vulkan_map_frame_to_mem()
1965 vkUnmapMemory(hwctx->act_dev, f->mem[i]); in vulkan_map_frame_to_mem()
1975 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_unmap_from() local
1979 vkDestroyImage(hwctx->act_dev, map->frame->img[i], hwctx->alloc); in vulkan_unmap_from()
1980 vkFreeMemory(hwctx->act_dev, map->frame->mem[i], hwctx->alloc); in vulkan_unmap_from()
1981 vkDestroySemaphore(hwctx->act_dev, map->frame->sem[i], hwctx->alloc); in vulkan_unmap_from()
2019 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_map_from_drm_frame_desc() local
2022 AVVulkanFramesContext *frames_hwctx = hwfc->hwctx; in vulkan_map_from_drm_frame_desc()
2030 VK_LOAD_PFN(hwctx->inst, vkGetMemoryFdPropertiesKHR); in vulkan_map_from_drm_frame_desc()
2100 ret = vkCreateImage(hwctx->act_dev, &create_info, in vulkan_map_from_drm_frame_desc()
2101 hwctx->alloc, &f->img[i]); in vulkan_map_from_drm_frame_desc()
2109 ret = vkCreateSemaphore(hwctx->act_dev, &sem_spawn, in vulkan_map_from_drm_frame_desc()
2110 hwctx->alloc, &f->sem[i]); in vulkan_map_from_drm_frame_desc()
2112 av_log(hwctx, AV_LOG_ERROR, "Failed to create semaphore: %s\n", in vulkan_map_from_drm_frame_desc()
2144 ret = pfn_vkGetMemoryFdPropertiesKHR(hwctx->act_dev, htype, in vulkan_map_from_drm_frame_desc()
2172 vkGetImageMemoryRequirements2(hwctx->act_dev, &req_desc, &req2); in vulkan_map_from_drm_frame_desc()
2212 ret = vkBindImageMemory2(hwctx->act_dev, bind_counts, bind_info); in vulkan_map_from_drm_frame_desc()
2232 vkDestroyImage(hwctx->act_dev, f->img[i], hwctx->alloc); in vulkan_map_from_drm_frame_desc()
2233 vkDestroySemaphore(hwctx->act_dev, f->sem[i], hwctx->alloc); in vulkan_map_from_drm_frame_desc()
2236 vkFreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); in vulkan_map_from_drm_frame_desc()
2275 vulkan_frame_free(hwfc->device_ctx->hwctx, (uint8_t *)f); in vulkan_map_from_drm()
2288 AVVAAPIDeviceContext *vaapi_ctx = vaapi_fc->device_ctx->hwctx; in vulkan_map_from_vaapi()
2326 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_export_to_cuda() local
2329 VK_LOAD_PFN(hwctx->inst, vkGetMemoryFdKHR); in vulkan_export_to_cuda()
2330 VK_LOAD_PFN(hwctx->inst, vkGetSemaphoreFdKHR); in vulkan_export_to_cuda()
2334 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_export_to_cuda()
2393 ret = pfn_vkGetMemoryFdKHR(hwctx->act_dev, &export_info, in vulkan_export_to_cuda()
2422 ret = pfn_vkGetSemaphoreFdKHR(hwctx->act_dev, &sem_export, in vulkan_export_to_cuda()
2459 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_transfer_data_from_cuda()
2585 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_map_to_drm() local
2587 VK_LOAD_PFN(hwctx->inst, vkGetMemoryFdKHR); in vulkan_map_to_drm()
2605 VK_LOAD_PFN(hwctx->inst, vkGetImageDrmFormatModifierPropertiesEXT); in vulkan_map_to_drm()
2606 ret = pfn_vkGetImageDrmFormatModifierPropertiesEXT(hwctx->act_dev, f->img[0], in vulkan_map_to_drm()
2622 ret = pfn_vkGetMemoryFdKHR(hwctx->act_dev, &export_info, in vulkan_map_to_drm()
2659 vkGetImageSubresourceLayout(hwctx->act_dev, f->img[i], &sub, &layout); in vulkan_map_to_drm()
2736 AVVulkanDeviceContext *hwctx = ctx->hwctx; in free_buf() local
2740 vkDestroyBuffer(hwctx->act_dev, vkbuf->buf, hwctx->alloc); in free_buf()
2742 vkFreeMemory(hwctx->act_dev, vkbuf->mem, hwctx->alloc); in free_buf()
2764 AVVulkanDeviceContext *hwctx = ctx->hwctx; in create_buf() local
2795 ret = vkCreateBuffer(hwctx->act_dev, &buf_spawn, NULL, &vkbuf->buf); in create_buf()
2805 vkGetBufferMemoryRequirements2(hwctx->act_dev, &req_desc, &req); in create_buf()
2823 ret = vkBindBufferMemory(hwctx->act_dev, vkbuf->buf, vkbuf->mem, 0); in create_buf()
2849 AVVulkanDeviceContext *hwctx = ctx->hwctx; in map_buffers() local
2858 ret = vkMapMemory(hwctx->act_dev, vkbuf->mem, 0, in map_buffers()
2891 ret = vkInvalidateMappedMemoryRanges(hwctx->act_dev, invalidate_count, in map_buffers()
2906 AVVulkanDeviceContext *hwctx = ctx->hwctx; in unmap_buffers() local
2927 ret = vkFlushMappedMemoryRanges(hwctx->act_dev, flush_count, flush_ctx); in unmap_buffers()
2940 vkUnmapMemory(hwctx->act_dev, vkbuf->mem); in unmap_buffers()
3067 AVVulkanDeviceContext *hwctx = dev_ctx->hwctx; in vulkan_transfer_data() local
3080 VK_LOAD_PFN(hwctx->inst, vkGetMemoryHostPointerPropertiesEXT); in vulkan_transfer_data()
3140 ret = pfn_vkGetMemoryHostPointerPropertiesEXT(hwctx->act_dev, in vulkan_transfer_data()
3252 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_transfer_data_to_cuda()