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)) : \
183 static int pixfmt_is_supported(AVVulkanDeviceContext *hwctx, enum AVPixelFormat p, in pixfmt_is_supported() argument
197 vkGetPhysicalDeviceFormatProperties2(hwctx->phys_dev, fmt[i], &prop); in pixfmt_is_supported()
304 AVVulkanDeviceContext *hwctx = ctx->hwctx; in check_extensions() local
344 vkEnumerateDeviceExtensionProperties(hwctx->phys_dev, NULL, in check_extensions()
349 vkEnumerateDeviceExtensionProperties(hwctx->phys_dev, NULL, in check_extensions()
434 AVVulkanDeviceContext *hwctx = ctx->hwctx; in create_instance() local
463 ret = vkCreateInstance(&inst_props, hwctx->alloc, &hwctx->inst); in create_instance()
488 VK_LOAD_PFN(hwctx->inst, vkCreateDebugUtilsMessengerEXT); in create_instance()
490 pfn_vkCreateDebugUtilsMessengerEXT(hwctx->inst, &dbg, in create_instance()
491 hwctx->alloc, &p->debug_ctx); in create_instance()
494 hwctx->enabled_inst_extensions = inst_props.ppEnabledExtensionNames; in create_instance()
495 hwctx->nb_enabled_inst_extensions = inst_props.enabledExtensionCount; in create_instance()
529 AVVulkanDeviceContext *hwctx = ctx->hwctx; in find_device() local
531 ret = vkEnumeratePhysicalDevices(hwctx->inst, &num, NULL); in find_device()
541 ret = vkEnumeratePhysicalDevices(hwctx->inst, &num, devices); in find_device()
633 hwctx->phys_dev = devices[choice]; in find_device()
647 AVVulkanDeviceContext *hwctx = ctx->hwctx; in search_queue_families() local
652 vkGetPhysicalDeviceQueueFamilyProperties(hwctx->phys_dev, &num, NULL); in search_queue_families()
664 vkGetPhysicalDeviceQueueFamilyProperties(hwctx->phys_dev, &num, qs); in search_queue_families()
704 hwctx->queue_family_index = graph_index; in search_queue_families()
705 hwctx->queue_family_comp_index = graph_index; in search_queue_families()
706 hwctx->queue_family_tx_index = graph_index; in search_queue_families()
707 hwctx->nb_graphics_queues = qs[graph_index].queueCount; in search_queue_families()
711 hwctx->queue_family_tx_index = comp_index; in search_queue_families()
712 hwctx->queue_family_comp_index = comp_index; in search_queue_families()
713 hwctx->nb_comp_queues = qs[comp_index].queueCount; in search_queue_families()
718 hwctx->queue_family_tx_index = tx_index; in search_queue_families()
719 hwctx->nb_tx_queues = qs[tx_index].queueCount; in search_queue_families()
740 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in create_exec_ctx() local
764 ret = vkCreateCommandPool(hwctx->act_dev, &cqueue_create, in create_exec_ctx()
765 hwctx->alloc, &cmd->pool); in create_exec_ctx()
775 ret = vkAllocateCommandBuffers(hwctx->act_dev, &cbuf_create, cmd->bufs); in create_exec_ctx()
784 vkGetDeviceQueue(hwctx->act_dev, queue_family_index, i, &q->queue); in create_exec_ctx()
793 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in free_exec_ctx() local
800 vkWaitForFences(hwctx->act_dev, 1, &q->fence, VK_TRUE, UINT64_MAX); in free_exec_ctx()
801 vkResetFences(hwctx->act_dev, 1, &q->fence); in free_exec_ctx()
806 vkDestroyFence(hwctx->act_dev, q->fence, hwctx->alloc); in free_exec_ctx()
815 vkFreeCommandBuffers(hwctx->act_dev, cmd->pool, cmd->nb_queues, cmd->bufs); in free_exec_ctx()
817 vkDestroyCommandPool(hwctx->act_dev, cmd->pool, hwctx->alloc); in free_exec_ctx()
840 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in wait_start_exec_ctx() local
853 ret = vkCreateFence(hwctx->act_dev, &fence_spawn, hwctx->alloc, in wait_start_exec_ctx()
861 vkWaitForFences(hwctx->act_dev, 1, &q->fence, VK_TRUE, UINT64_MAX); in wait_start_exec_ctx()
862 vkResetFences(hwctx->act_dev, 1, &q->fence); in wait_start_exec_ctx()
934 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in submit_exec_ctx() local
935 vkWaitForFences(hwctx->act_dev, 1, &q->fence, VK_TRUE, UINT64_MAX); in submit_exec_ctx()
936 vkResetFences(hwctx->act_dev, 1, &q->fence); in submit_exec_ctx()
948 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_device_free() local
950 vkDestroyDevice(hwctx->act_dev, hwctx->alloc); in vulkan_device_free()
953 VK_LOAD_PFN(hwctx->inst, vkDestroyDebugUtilsMessengerEXT); in vulkan_device_free()
954 pfn_vkDestroyDebugUtilsMessengerEXT(hwctx->inst, p->debug_ctx, in vulkan_device_free()
955 hwctx->alloc); in vulkan_device_free()
958 vkDestroyInstance(hwctx->inst, hwctx->alloc); in vulkan_device_free()
960 for (int i = 0; i < hwctx->nb_enabled_inst_extensions; i++) in vulkan_device_free()
961 av_free((void *)hwctx->enabled_inst_extensions[i]); in vulkan_device_free()
962 av_free((void *)hwctx->enabled_inst_extensions); in vulkan_device_free()
964 for (int i = 0; i < hwctx->nb_enabled_dev_extensions; i++) in vulkan_device_free()
965 av_free((void *)hwctx->enabled_dev_extensions[i]); in vulkan_device_free()
966 av_free((void *)hwctx->enabled_dev_extensions); in vulkan_device_free()
977 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_device_create_internal() local
987 .pNext = &hwctx->device_features, in vulkan_device_create_internal()
992 hwctx->device_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; in vulkan_device_create_internal()
1003 vkGetPhysicalDeviceFeatures(hwctx->phys_dev, &dev_features); in vulkan_device_create_internal()
1005 COPY_FEATURE(hwctx->device_features, shaderImageGatherExtended) in vulkan_device_create_internal()
1006 COPY_FEATURE(hwctx->device_features, fragmentStoresAndAtomics) in vulkan_device_create_internal()
1007 COPY_FEATURE(hwctx->device_features, vertexPipelineStoresAndAtomics) in vulkan_device_create_internal()
1008 COPY_FEATURE(hwctx->device_features, shaderInt64) in vulkan_device_create_internal()
1023 ret = vkCreateDevice(hwctx->phys_dev, &dev_info, hwctx->alloc, in vulkan_device_create_internal()
1024 &hwctx->act_dev); in vulkan_device_create_internal()
1045 hwctx->enabled_dev_extensions = dev_info.ppEnabledExtensionNames; in vulkan_device_create_internal()
1046 hwctx->nb_enabled_dev_extensions = dev_info.enabledExtensionCount; in vulkan_device_create_internal()
1055 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_device_init() local
1059 for (int i = 0; i < hwctx->nb_enabled_dev_extensions; i++) { in vulkan_device_init()
1061 if (!strcmp(hwctx->enabled_dev_extensions[i], in vulkan_device_init()
1064 hwctx->enabled_dev_extensions[i]); in vulkan_device_init()
1075 vkGetPhysicalDeviceProperties2(hwctx->phys_dev, &p->props); in vulkan_device_init()
1089 vkGetPhysicalDeviceQueueFamilyProperties(hwctx->phys_dev, &queue_num, NULL); in vulkan_device_init()
1102 CHECK_QUEUE("graphics", hwctx->queue_family_index) in vulkan_device_init()
1103 CHECK_QUEUE("upload", hwctx->queue_family_tx_index) in vulkan_device_init()
1104 CHECK_QUEUE("compute", hwctx->queue_family_comp_index) in vulkan_device_init()
1108 p->qfs[p->num_qfs++] = hwctx->queue_family_index; in vulkan_device_init()
1109 if ((hwctx->queue_family_tx_index != hwctx->queue_family_index) && in vulkan_device_init()
1110 (hwctx->queue_family_tx_index != hwctx->queue_family_comp_index)) in vulkan_device_init()
1111 p->qfs[p->num_qfs++] = hwctx->queue_family_tx_index; in vulkan_device_init()
1112 if ((hwctx->queue_family_comp_index != hwctx->queue_family_index) && in vulkan_device_init()
1113 (hwctx->queue_family_comp_index != hwctx->queue_family_tx_index)) in vulkan_device_init()
1114 p->qfs[p->num_qfs++] = hwctx->queue_family_comp_index; in vulkan_device_init()
1117 vkGetPhysicalDeviceMemoryProperties(hwctx->phys_dev, &p->mprops); in vulkan_device_init()
1151 AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx; in vulkan_device_derive()
1168 AVDRMDeviceContext *src_hwctx = src_ctx->hwctx; in vulkan_device_derive()
1188 AVCUDADeviceContext *src_hwctx = src_ctx->hwctx; in vulkan_device_derive()
1214 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_frames_get_constraints() local
1218 count += pixfmt_is_supported(hwctx, i, p->use_linear_images); in vulkan_frames_get_constraints()
1232 if (pixfmt_is_supported(hwctx, i, p->use_linear_images)) in vulkan_frames_get_constraints()
1263 AVVulkanDeviceContext *dev_hwctx = ctx->hwctx; in alloc_mem()
1317 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_free_internal()
1341 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_frame_free() local
1347 vkDestroyImage(hwctx->act_dev, f->img[i], hwctx->alloc); in vulkan_frame_free()
1348 vkFreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); in vulkan_frame_free()
1349 vkDestroySemaphore(hwctx->act_dev, f->sem[i], hwctx->alloc); in vulkan_frame_free()
1365 AVVulkanDeviceContext *hwctx = ctx->hwctx; in alloc_bind_mem() local
1385 vkGetImageMemoryRequirements2(hwctx->act_dev, &req_desc, &req); in alloc_bind_mem()
1413 ret = vkBindImageMemory2(hwctx->act_dev, planes, bind_info); in alloc_bind_mem()
1510 AVVulkanDeviceContext *hwctx = ctx->hwctx; in create_frame() local
1560 ret = vkCreateImage(hwctx->act_dev, &image_create_info, in create_frame()
1561 hwctx->alloc, &f->img[i]); in create_frame()
1570 ret = vkCreateSemaphore(hwctx->act_dev, &sem_spawn, in create_frame()
1571 hwctx->alloc, &f->sem[i]); in create_frame()
1573 av_log(hwctx, AV_LOG_ERROR, "Failed to create semaphore: %s\n", in create_frame()
1600 AVVulkanFramesContext *hwctx = hwfc->hwctx; in try_export_flags() local
1601 AVVulkanDeviceContext *dev_hwctx = hwfc->device_ctx->hwctx; in try_export_flags()
1618 .tiling = hwctx->tiling, in try_export_flags()
1619 .usage = hwctx->usage, in try_export_flags()
1637 AVVulkanFramesContext *hwctx = hwfc->hwctx; in vulkan_pool_alloc() local
1645 .pNext = hwctx->create_pnext, in vulkan_pool_alloc()
1658 eminfo[i].pNext = hwctx->alloc_pnext[i]; in vulkan_pool_alloc()
1662 err = create_frame(hwfc, &f, hwctx->tiling, hwctx->usage, in vulkan_pool_alloc()
1700 AVVulkanFramesContext *hwctx = hwfc->hwctx; in vulkan_frames_init() local
1702 AVVulkanDeviceContext *dev_hwctx = hwfc->device_ctx->hwctx; in vulkan_frames_init()
1706 hwctx->tiling = hwctx->tiling ? hwctx->tiling : p->use_linear_images ? in vulkan_frames_init()
1709 if (!hwctx->usage) in vulkan_frames_init()
1710 hwctx->usage = DEFAULT_USAGE_FLAGS; in vulkan_frames_init()
1730 err = create_frame(hwfc, &f, hwctx->tiling, hwctx->usage, in vulkan_frames_init()
1731 hwctx->create_pnext); in vulkan_frames_init()
1796 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_unmap_frame() local
1811 ret = vkFlushMappedMemoryRanges(hwctx->act_dev, planes, in vulkan_unmap_frame()
1820 vkUnmapMemory(hwctx->act_dev, map->frame->mem[i]); in vulkan_unmap_frame()
1831 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_map_frame_to_mem() local
1857 ret = vkMapMemory(hwctx->act_dev, f->mem[i], 0, in vulkan_map_frame_to_mem()
1878 ret = vkInvalidateMappedMemoryRanges(hwctx->act_dev, planes, in vulkan_map_frame_to_mem()
1893 vkGetImageSubresourceLayout(hwctx->act_dev, f->img[i], &sub, &layout); in vulkan_map_frame_to_mem()
1909 vkUnmapMemory(hwctx->act_dev, f->mem[i]); in vulkan_map_frame_to_mem()
1919 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_unmap_from() local
1923 vkDestroyImage(hwctx->act_dev, map->frame->img[i], hwctx->alloc); in vulkan_unmap_from()
1924 vkFreeMemory(hwctx->act_dev, map->frame->mem[i], hwctx->alloc); in vulkan_unmap_from()
1925 vkDestroySemaphore(hwctx->act_dev, map->frame->sem[i], hwctx->alloc); in vulkan_unmap_from()
1963 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_map_from_drm_frame_desc() local
1966 AVVulkanFramesContext *frames_hwctx = hwfc->hwctx; in vulkan_map_from_drm_frame_desc()
1974 VK_LOAD_PFN(hwctx->inst, vkGetMemoryFdPropertiesKHR); in vulkan_map_from_drm_frame_desc()
2046 ret = vkCreateImage(hwctx->act_dev, &image_create_info, in vulkan_map_from_drm_frame_desc()
2047 hwctx->alloc, &f->img[i]); in vulkan_map_from_drm_frame_desc()
2055 ret = vkCreateSemaphore(hwctx->act_dev, &sem_spawn, in vulkan_map_from_drm_frame_desc()
2056 hwctx->alloc, &f->sem[i]); in vulkan_map_from_drm_frame_desc()
2058 av_log(hwctx, AV_LOG_ERROR, "Failed to create semaphore: %s\n", in vulkan_map_from_drm_frame_desc()
2090 ret = pfn_vkGetMemoryFdPropertiesKHR(hwctx->act_dev, htype, in vulkan_map_from_drm_frame_desc()
2118 vkGetImageMemoryRequirements2(hwctx->act_dev, &req_desc, &req2); in vulkan_map_from_drm_frame_desc()
2158 ret = vkBindImageMemory2(hwctx->act_dev, bind_counts, bind_info); in vulkan_map_from_drm_frame_desc()
2178 vkDestroyImage(hwctx->act_dev, f->img[i], hwctx->alloc); in vulkan_map_from_drm_frame_desc()
2179 vkDestroySemaphore(hwctx->act_dev, f->sem[i], hwctx->alloc); in vulkan_map_from_drm_frame_desc()
2182 vkFreeMemory(hwctx->act_dev, f->mem[i], hwctx->alloc); in vulkan_map_from_drm_frame_desc()
2223 vulkan_frame_free(hwfc->device_ctx->hwctx, (uint8_t *)f); in vulkan_map_from_drm()
2236 AVVAAPIDeviceContext *vaapi_ctx = vaapi_fc->device_ctx->hwctx; in vulkan_map_from_vaapi()
2274 AVVulkanDeviceContext *hwctx = ctx->hwctx; in vulkan_export_to_cuda() local
2277 VK_LOAD_PFN(hwctx->inst, vkGetMemoryFdKHR); in vulkan_export_to_cuda()
2278 VK_LOAD_PFN(hwctx->inst, vkGetSemaphoreFdKHR); in vulkan_export_to_cuda()
2282 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_export_to_cuda()
2339 ret = pfn_vkGetMemoryFdKHR(hwctx->act_dev, &export_info, in vulkan_export_to_cuda()
2368 ret = pfn_vkGetSemaphoreFdKHR(hwctx->act_dev, &sem_export, in vulkan_export_to_cuda()
2405 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_transfer_data_from_cuda()
2529 AVVulkanDeviceContext *hwctx = hwfc->device_ctx->hwctx; in vulkan_map_to_drm() local
2531 VK_LOAD_PFN(hwctx->inst, vkGetMemoryFdKHR); in vulkan_map_to_drm()
2549 VK_LOAD_PFN(hwctx->inst, vkGetImageDrmFormatModifierPropertiesEXT); in vulkan_map_to_drm()
2550 ret = pfn_vkGetImageDrmFormatModifierPropertiesEXT(hwctx->act_dev, f->img[0], in vulkan_map_to_drm()
2566 ret = pfn_vkGetMemoryFdKHR(hwctx->act_dev, &export_info, in vulkan_map_to_drm()
2603 vkGetImageSubresourceLayout(hwctx->act_dev, f->img[i], &sub, &layout); in vulkan_map_to_drm()
2680 AVVulkanDeviceContext *hwctx = ctx->hwctx; in free_buf() local
2684 vkDestroyBuffer(hwctx->act_dev, vkbuf->buf, hwctx->alloc); in free_buf()
2686 vkFreeMemory(hwctx->act_dev, vkbuf->mem, hwctx->alloc); in free_buf()
2699 AVVulkanDeviceContext *hwctx = ctx->hwctx; in create_buf() local
2738 ret = vkCreateBuffer(hwctx->act_dev, &buf_spawn, NULL, &vkbuf->buf); in create_buf()
2747 vkGetBufferMemoryRequirements2(hwctx->act_dev, &req_desc, &req); in create_buf()
2761 ret = vkBindBufferMemory(hwctx->act_dev, vkbuf->buf, vkbuf->mem, 0); in create_buf()
2783 AVVulkanDeviceContext *hwctx = ctx->hwctx; in map_buffers() local
2792 ret = vkMapMemory(hwctx->act_dev, vkbuf->mem, 0, in map_buffers()
2817 ret = vkInvalidateMappedMemoryRanges(hwctx->act_dev, invalidate_count, in map_buffers()
2832 AVVulkanDeviceContext *hwctx = ctx->hwctx; in unmap_buffers() local
2851 ret = vkFlushMappedMemoryRanges(hwctx->act_dev, flush_count, flush_ctx); in unmap_buffers()
2864 vkUnmapMemory(hwctx->act_dev, vkbuf->mem); in unmap_buffers()
3118 AVCUDADeviceContext *cuda_dev = cuda_cu->hwctx; in vulkan_transfer_data_to_cuda()