[FFmpeg-devel] [PATCH V4 3/5] libavutil/hwcontext_vulkan: Allocate vkFrame in one memory
Anton Khirnov
anton at khirnov.net
Wed Dec 1 13:53:11 EET 2021
Quoting Wenbin Chen (2021-11-30 07:28:13)
> diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h
> index fdf2a60156..c485ee7437 100644
> --- a/libavutil/hwcontext_vulkan.h
> +++ b/libavutil/hwcontext_vulkan.h
> @@ -35,6 +35,17 @@
> * with the data pointer set to an AVVkFrame.
> */
>
> +/**
> + * Defines the behaviour of frame allocation
> + * AV_VK_FRAME_FLAG_NONE: planes will be allocated in separte memory
> + * AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY: planes will be allocated in a
> + * contiguous memory.
> + */
> +typedef enum {
> + AV_VK_FRAME_FLAG_NONE = (1ULL << 0),
> + AV_VK_FRAME_FLAG_CONTIGUOUS_MEMORY = (1ULL << 1) | 1ULL
> +} AVVkFrameFlags;
> +
> /**
> * Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
> * All of these can be set before init to change what the context uses
> @@ -157,6 +168,14 @@ typedef struct AVVulkanFramesContext {
> */
> void *create_pnext;
>
> + /**
> + * Is a combination of AVVkFrameFlags. Defines the behaviour of frame
> + * allocation.
> + * If no flag is set, then the flags are automatically determined
> + * based on the device.
> + */
> + int flags;
> +
> /**
> * Extension data for memory allocation. Must have as many entries as
> * the number of planes of the sw_format.
> @@ -198,6 +217,11 @@ typedef struct AVVkFrame {
> VkDeviceMemory mem[AV_NUM_DATA_POINTERS];
> size_t size[AV_NUM_DATA_POINTERS];
>
> + /**
> + * Describe the offset from the memory currently bound to the VkImage.
> + */
> + size_t offset[AV_NUM_DATA_POINTERS];
> +
These are public structs, you have to add any new fields at the end or
you will break ABI compatibility.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list