[FFmpeg-devel] [PATCH 2/2] hwcontext_vulkan: expose enabled device and instance extensions

Mark Thompson sw at jkqxz.net
Mon May 11 00:39:57 EEST 2020


On 10/05/2020 15:23, Lynne wrote:
> May 10, 2020, 14:33 by sw at jkqxz.net:
>> On 10/05/2020 11:54, Lynne wrote:
>>>  ...
> 
> From 6ecc3547bcfcc450c8ffe8d93a3040fd863f6288 Mon Sep 17 00:00:00 2001
> From: Lynne <dev at lynne.ee>
> Date: Sun, 10 May 2020 11:47:50 +0100
> Subject: [PATCH 2/3] hwcontext_vulkan: expose enabled device and instance
>  extensions
> 
> This solves a huge oversight - it lets users reliably use their own
> AVVulkanDeviceContext. Otherwise, the extensions supplied and enabled
> are not discoverable by anything outside of hwcontext_vulkan.
> ---
>  doc/APIchanges               |  4 ++++
>  libavutil/hwcontext_vulkan.c | 40 ++++++++++++++++++++++++++++--------
>  libavutil/hwcontext_vulkan.h | 21 ++++++++++++++++++-
>  libavutil/version.h          |  2 +-
>  4 files changed, 56 insertions(+), 11 deletions(-)
> 
> diff --git a/doc/APIchanges b/doc/APIchanges
> index b3e7e89412..75cfdb08b0 100644
> --- a/doc/APIchanges
> +++ b/doc/APIchanges
> @@ -15,6 +15,10 @@ libavutil:     2017-10-21
>  
>  API changes, most recent first:
>  
> +2020-05-10 - xxxxxxxxxx - lavu 56.44.100 - hwcontext_vulkan.h
> +  Add enabled_inst_extensions, num_enabled_inst_extensions, enabled_dev_extensions
> +  and num_enabled_dev_extensions fields to AVVulkanDeviceContext
> +
>  2020-04-22 - 0e1db79e37 - lavc 58.81.100 - packet.h
>                          - lavu 56.43.100 - dovi_meta.h
>    Add AV_PKT_DATA_DOVI_CONF and AVDOVIDecoderConfigurationRecord.
> ...
> diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
> index ebc28916f3..909f88a7e4 100644
> --- a/libavutil/hwcontext_vulkan.h
> +++ b/libavutil/hwcontext_vulkan.h
> @@ -39,7 +39,7 @@ typedef struct AVVulkanDeviceContext {
>       */
>      const VkAllocationCallbacks *alloc;
>      /**
> -     * Instance
> +     * Vulkan instance. Must be at least version 1.1.
>       */
>      VkInstance inst;
>      /**
> @@ -65,6 +65,25 @@ typedef struct AVVulkanDeviceContext {
>       * Queue family index for compute ops
>       */
>      int queue_family_comp_index;
> +    /**
> +     * Enabled instance extensions. By default, VK_KHR_surface is enabled if found.
> +     * If supplying your own device context, set this to an array of strings, with
> +     * each entry containing the specified Vulkan extension string to enable.
> +     * Duplicates are possible and accepted.
> +     * If no extensions are enabled, set these fields to NULL, and 0 respectively.
> +     */
> +    const char * const *enabled_inst_extensions;
> +    int num_enabled_inst_extensions;
> +    /**
> +     * Enabled device extensions. By default, VK_KHR_external_memory_fd,
> +     * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier and
> +     * VK_KHR_external_semaphore_fd are enabled if found.
> +     * If supplying your own device context, these fields takes the same format as
> +     * the above fields, with the same conditions that duplicates are possible
> +     * and accepted, and that NULL and 0 respectively means no extensions are enabled.
> +     */

That's much clearer, thank you :)

> +    const char * const *enabled_dev_extensions;
> +    int num_enabled_dev_extensions;

A minor stylistic niggle - fields like this are "nb_something" rather than "num_something" in pretty much all other ffmpeg headers.

>  } AVVulkanDeviceContext;
>  
>  /**
> diff --git a/libavutil/version.h b/libavutil/version.h
> index ea9363e8e9..48d8a38c42 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -79,7 +79,7 @@
>   */
>  
>  #define LIBAVUTIL_VERSION_MAJOR  56
> -#define LIBAVUTIL_VERSION_MINOR  43
> +#define LIBAVUTIL_VERSION_MINOR  44
>  #define LIBAVUTIL_VERSION_MICRO 100
>  
>  #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
> -- 
> 2.26.2

LGTM with or without that change.

Thanks,

- Mark


More information about the ffmpeg-devel mailing list