From 2e08b39444ab27477e6ea2a184ae7fe1b9786594 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 20 May 2020 20:58:03 +0100 Subject: hwcontext: add av_hwdevice_ctx_create_derived_opts This allows for users who derive devices to set options for the new device context they derive. The main use case of this is to allow users to enable extensions (such as surface drawing extensions) in Vulkan while deriving from the device their frames are on. That way, users don't need to write any initialization code themselves, since the Vulkan spec invalidates mixing instances, physical devices and active devices. Apart from Vulkan, other hwcontexts ignore the opts argument since they don't support options at all (or in VAAPI and OpenCL's case, options are currently only used for device selection, which device_derive overrides). --- libavutil/hwcontext_vulkan.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'libavutil/hwcontext_vulkan.c') diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c index 262089f5da..b40974dce4 100644 --- a/libavutil/hwcontext_vulkan.c +++ b/libavutil/hwcontext_vulkan.c @@ -950,7 +950,8 @@ static int vulkan_device_create(AVHWDeviceContext *ctx, const char *device, } static int vulkan_device_derive(AVHWDeviceContext *ctx, - AVHWDeviceContext *src_ctx, int flags) + AVHWDeviceContext *src_ctx, + AVDictionary *opts, int flags) { av_unused VulkanDeviceSelection dev_select = { 0 }; @@ -974,7 +975,7 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx, if (strstr(vendor, "AMD")) dev_select.vendor_id = 0x1002; - return vulkan_device_create_internal(ctx, &dev_select, NULL, flags); + return vulkan_device_create_internal(ctx, &dev_select, opts, flags); } #endif case AV_HWDEVICE_TYPE_DRM: { @@ -992,7 +993,7 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx, drmFreeDevice(&drm_dev_info); - return vulkan_device_create_internal(ctx, &dev_select, NULL, flags); + return vulkan_device_create_internal(ctx, &dev_select, opts, flags); } #endif #if CONFIG_CUDA @@ -1011,7 +1012,7 @@ static int vulkan_device_derive(AVHWDeviceContext *ctx, dev_select.has_uuid = 1; - return vulkan_device_create_internal(ctx, &dev_select, NULL, flags); + return vulkan_device_create_internal(ctx, &dev_select, opts, flags); } #endif default: -- cgit v1.2.3