From 83fe28221e92921f74d99ed15c258a3c79f4441d Mon Sep 17 00:00:00 2001 From: Wenbin Chen Date: Tue, 7 Dec 2021 17:05:53 +0800 Subject: hwcontext_vulkan: support creating DRM-tiled images and autodetecting modifiers When vulkan image exports to drm, the tilling need to be VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT. Now add code to create vulkan image using this format. Now the following command line works: ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format \ vaapi -i input_1080p.264 -vf "hwmap=derive_device=vulkan,format=vulkan, \ scale_vulkan=1920:1080,hwmap=derive_device=vaapi,format=vaapi" -c:v h264_vaapi output.264 Signed-off-by: Wenbin Chen Further-modifications-by: Lynne --- libavutil/hwcontext_vulkan.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libavutil/hwcontext_vulkan.h') diff --git a/libavutil/hwcontext_vulkan.h b/libavutil/hwcontext_vulkan.h index ed59fe9f0a..8de79f5f33 100644 --- a/libavutil/hwcontext_vulkan.h +++ b/libavutil/hwcontext_vulkan.h @@ -156,7 +156,10 @@ typedef enum AVVkFrameFlags { */ typedef struct AVVulkanFramesContext { /** - * Controls the tiling of allocated frames. + * Controls the tiling of allocated frames. If left as optimal tiling, + * then during av_hwframe_ctx_init() will decide based on whether the device + * supports DRM modifiers, or if the linear_images flag is set, otherwise + * will allocate optimally-tiled images. */ VkImageTiling tiling; @@ -168,6 +171,12 @@ typedef struct AVVulkanFramesContext { /** * Extension data for image creation. + * If VkImageDrmFormatModifierListCreateInfoEXT is present in the chain, + * and the device supports DRM modifiers, then images will be allocated + * with the specific requested DRM modifiers. + * Additional structures may be added at av_hwframe_ctx_init() time, + * which will be freed automatically on uninit(), so users need only free + * any structures they've allocated themselves. */ void *create_pnext; -- cgit v1.2.3