From a871a7d4ffe3f94488cd5091794e683c720bc5df Mon Sep 17 00:00:00 2001 From: Lynne Date: Fri, 17 Feb 2023 04:30:00 +0100 Subject: [PATCH 54/72] hwcontext_vulkan: disable all mapping code Multiplane formats are currently not easy to map. --- libavutil/hwcontext_vulkan.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 647a072bdd..761a63ddd7 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -44,7 +44,7 @@ #include "vulkan.h" #include "vulkan_loader.h" -#if CONFIG_LIBDRM +#if 0 #include #include #include "hwcontext_drm.h" @@ -54,7 +54,7 @@ #endif #endif -#if CONFIG_CUDA +#if 0 #include "hwcontext_cuda_internal.h" #include "cuda_check.h" #define CHECK_CU(x) FF_CUDA_CHECK_DL(cuda_cu, cu, x) @@ -139,7 +139,7 @@ typedef struct VulkanFramesPriv { typedef struct AVVkFrameInternal { pthread_mutex_t update_mutex; -#if CONFIG_CUDA +#if 0 /* Importing external memory into cuda is really expensive so we keep the * memory imported all the time */ AVBufferRef *cuda_fc_ref; /* Need to keep it around for uninit */ @@ -1718,7 +1718,7 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx, * by the following checks (e.g. non-PCIe ARM GPU), having an empty * dev_select will mean it'll get picked. */ switch(src_ctx->type) { -#if CONFIG_LIBDRM +#if 0 #if CONFIG_VAAPI case AV_HWDEVICE_TYPE_VAAPI: { AVVAAPIDeviceContext *src_hwctx = src_ctx->hwctx; @@ -1753,7 +1753,7 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx, return vulkan_device_create_internal(ctx, &dev_select, opts, flags); } #endif -#if CONFIG_CUDA +#if 0 case AV_HWDEVICE_TYPE_CUDA: { AVHWDeviceContext *cuda_cu = src_ctx; AVCUDADeviceContext *src_hwctx = src_ctx->hwctx; @@ -1789,7 +1789,7 @@ static int vulkan_frames_get_constraints(AVHWDeviceContext *ctx, 0, NULL, NULL, NULL, NULL) >= 0; } -#if CONFIG_CUDA +#if 0 if (p->dev_is_nvidia) count++; #endif @@ -1807,7 +1807,7 @@ static int vulkan_frames_get_constraints(AVHWDeviceContext *ctx, } } -#if CONFIG_CUDA +#if 0 if (p->dev_is_nvidia) constraints->valid_sw_formats[count++] = AV_PIX_FMT_CUDA; #endif @@ -1890,7 +1890,7 @@ static void vulkan_free_internal(AVVkFrame *f) { av_unused AVVkFrameInternal *internal = f->internal; -#if CONFIG_CUDA +#if 0 if (internal->cuda_fc_ref) { AVHWFramesContext *cuda_fc = (AVHWFramesContext *)internal->cuda_fc_ref->data; int planes = av_pix_fmt_count_planes(cuda_fc->sw_format); @@ -2672,7 +2672,7 @@ fail: return err; } -#if CONFIG_LIBDRM +#if 0 static void vulkan_unmap_from_drm(AVHWFramesContext *hwfc, HWMapDescriptor *hwmap) { AVVkFrame *f = hwmap->priv; @@ -2746,6 +2746,7 @@ static int vulkan_map_from_drm_frame_desc(AVHWFramesContext *hwfc, AVVkFrame **f AVVulkanDeviceContext *hwctx = ctx->hwctx; VulkanDevicePriv *p = ctx->internal->priv; FFVulkanFunctions *vk = &p->vkfn; + AVVulkanFramesContext *hwfctx = hwfc->hwctx; VulkanFramesPriv *fp = hwfc->internal->priv; const AVDRMFrameDescriptor *desc = (AVDRMFrameDescriptor *)src->data[0]; VkBindImageMemoryInfo bind_info[AV_DRM_MAX_PLANES]; @@ -3076,7 +3077,7 @@ fail: #endif #endif -#if CONFIG_CUDA +#if 0 static int vulkan_export_to_cuda(AVHWFramesContext *hwfc, AVBufferRef *cuda_hwfc, const AVFrame *frame) @@ -3346,7 +3347,7 @@ static int vulkan_map_to(AVHWFramesContext *hwfc, AVFrame *dst, av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; switch (src->format) { -#if CONFIG_LIBDRM +#if 0 #if CONFIG_VAAPI case AV_PIX_FMT_VAAPI: if (p->extensions & (FF_VK_EXT_EXTERNAL_DMABUF_MEMORY | FF_VK_EXT_DRM_MODIFIER_FLAGS)) @@ -3365,7 +3366,7 @@ static int vulkan_map_to(AVHWFramesContext *hwfc, AVFrame *dst, } } -#if CONFIG_LIBDRM +#if 0 typedef struct VulkanDRMMapping { AVDRMFrameDescriptor drm_desc; AVVkFrame *source; @@ -3533,7 +3534,7 @@ static int vulkan_map_from(AVHWFramesContext *hwfc, AVFrame *dst, av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; switch (dst->format) { -#if CONFIG_LIBDRM +#if 0 case AV_PIX_FMT_DRM_PRIME: if (p->extensions & (FF_VK_EXT_EXTERNAL_DMABUF_MEMORY | FF_VK_EXT_DRM_MODIFIER_FLAGS)) return vulkan_map_to_drm(hwfc, dst, src, flags); @@ -4091,7 +4092,7 @@ static int vulkan_transfer_data_to(AVHWFramesContext *hwfc, AVFrame *dst, av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; switch (src->format) { -#if CONFIG_CUDA +#if 0 case AV_PIX_FMT_CUDA: #ifdef _WIN32 if ((p->extensions & FF_VK_EXT_EXTERNAL_WIN32_MEMORY) && @@ -4110,7 +4111,7 @@ static int vulkan_transfer_data_to(AVHWFramesContext *hwfc, AVFrame *dst, } } -#if CONFIG_CUDA +#if 0 static int vulkan_transfer_data_to_cuda(AVHWFramesContext *hwfc, AVFrame *dst, const AVFrame *src) { @@ -4209,7 +4210,7 @@ static int vulkan_transfer_data_from(AVHWFramesContext *hwfc, AVFrame *dst, av_unused VulkanDevicePriv *p = hwfc->device_ctx->internal->priv; switch (dst->format) { -#if CONFIG_CUDA +#if 0 case AV_PIX_FMT_CUDA: #ifdef _WIN32 if ((p->extensions & FF_VK_EXT_EXTERNAL_WIN32_MEMORY) && -- 2.39.2