[FFmpeg-devel] [PATCH] avutil/hwcontext_vulkan: add proper maps for XV3{0, 6}

Lynne dev at lynne.ee
Mon Oct 14 18:09:52 EEST 2024


On 14/10/2024 16:50, James Almer wrote:
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>   libavutil/hwcontext_vulkan.c | 9 ++++-----
>   libavutil/vulkan.c           | 3 ++-
>   2 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
> index 47e21fda83..465308271e 100644
> --- a/libavutil/hwcontext_vulkan.c
> +++ b/libavutil/hwcontext_vulkan.c
> @@ -308,7 +308,6 @@ static const struct FFVkFormatEntry {
>       { VK_FORMAT_R32_SFLOAT, AV_PIX_FMT_GRAYF32, VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R32_SFLOAT } },
>   
>       /* RGB formats */
> -    { VK_FORMAT_R16G16B16A16_UNORM,       AV_PIX_FMT_XV36,    VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R16G16B16A16_UNORM       } },
>       { VK_FORMAT_B8G8R8A8_UNORM,           AV_PIX_FMT_BGRA,    VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_B8G8R8A8_UNORM           } },
>       { VK_FORMAT_R8G8B8A8_UNORM,           AV_PIX_FMT_RGBA,    VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R8G8B8A8_UNORM           } },
>       { VK_FORMAT_R8G8B8_UNORM,             AV_PIX_FMT_RGB24,   VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R8G8B8_UNORM             } },
> @@ -367,6 +366,8 @@ static const struct FFVkFormatEntry {
>       { VK_FORMAT_B8G8R8G8_422_UNORM,                     AV_PIX_FMT_UYVY422, VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R8G8B8A8_UNORM     } },
>       { VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16, AV_PIX_FMT_Y210,    VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R16G16B16A16_UNORM } },
>       { VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16, AV_PIX_FMT_Y212,    VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R16G16B16A16_UNORM } },
> +    { VK_FORMAT_A2R10G10B10_UNORM_PACK32,               AV_PIX_FMT_XV30,    VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R16G16B16A16_UNORM } },
> +    { VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16,     AV_PIX_FMT_XV36,    VK_IMAGE_ASPECT_COLOR_BIT, 1, 1, 1, { VK_FORMAT_R16G16B16A16_UNORM } },
>   };
>   static const int nb_vk_formats_list = FF_ARRAY_ELEMS(vk_formats_list);
>   
> @@ -2863,10 +2864,8 @@ static const struct {
>       // All these DRM_FORMATs were added in the same libdrm commit.
>   #ifdef DRM_FORMAT_XYUV8888
>       { DRM_FORMAT_XYUV8888, VK_FORMAT_R8G8B8A8_UNORM     },
> -    { DRM_FORMAT_XVYU12_16161616, VK_FORMAT_R16G16B16A16_UNORM} ,
> -    // As we had to map XV36 to a 16bit Vulkan format, reverse mapping will
> -    // end up yielding Y416 as the DRM format, so we need to recognise it.
> -    { DRM_FORMAT_Y416,     VK_FORMAT_R16G16B16A16_UNORM },
> +    { DRM_FORMAT_XVYU2101010, VK_FORMAT_A2R10G10B10_UNORM_PACK32 } ,
> +    { DRM_FORMAT_XVYU12_16161616, VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 } ,
>   #endif
>   };
>   
> diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
> index 661b2627c9..e2d2478608 100644
> --- a/libavutil/vulkan.c
> +++ b/libavutil/vulkan.c
> @@ -1311,7 +1311,8 @@ const char *ff_vk_shader_rep_fmt(enum AVPixelFormat pix_fmt,
>       }
>       case AV_PIX_FMT_X2RGB10:
>       case AV_PIX_FMT_X2BGR10:
> -    case AV_PIX_FMT_Y210: {
> +    case AV_PIX_FMT_Y210:
> +    case AV_PIX_FMT_XV30: {
>           const char *rep_tab[] = {
>               [FF_VK_REP_NATIVE] = "rgb10_a2ui",
>               [FF_VK_REP_FLOAT] = "rgb10_a2",

LGTM

Thanks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_0xA2FEA5F03F034464.asc
Type: application/pgp-keys
Size: 624 bytes
Desc: OpenPGP public key
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241014/c77d9600/attachment.key>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 236 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20241014/c77d9600/attachment.sig>


More information about the ffmpeg-devel mailing list