diff options
author | Lynne <dev@lynne.ee> | 2020-05-20 20:58:03 +0100 |
---|---|---|
committer | Lynne <dev@lynne.ee> | 2020-05-23 19:07:26 +0100 |
commit | 2e08b39444ab27477e6ea2a184ae7fe1b9786594 (patch) | |
tree | 085ed11f850d45108a492b80e5b5cb5c5b5708d3 /libavutil/hwcontext_vulkan.c | |
parent | 9576e49b40f335de091e9f77c71e4bc2f638d224 (diff) |
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).
Diffstat (limited to 'libavutil/hwcontext_vulkan.c')
-rw-r--r-- | libavutil/hwcontext_vulkan.c | 9 |
1 files changed, 5 insertions, 4 deletions
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: |