@@ -1010,6 +1010,9 @@ static const struct {
DRM_MAP(NV12, 1, DRM_FORMAT_NV12),
#if defined(VA_FOURCC_P010) && defined(DRM_FORMAT_R16)
DRM_MAP(P010, 2, DRM_FORMAT_R16, DRM_FORMAT_RG1616),
+#endif
+#if defined(VA_FOURCC_P012) && defined(DRM_FORMAT_R16)
+ DRM_MAP(P012, 2, DRM_FORMAT_R16, DRM_FORMAT_RG1616),
#endif
DRM_MAP(BGRA, 1, DRM_FORMAT_ARGB8888),
DRM_MAP(BGRX, 1, DRM_FORMAT_XRGB8888),
@@ -1021,6 +1024,12 @@ static const struct {
#endif
DRM_MAP(ARGB, 1, DRM_FORMAT_BGRA8888),
DRM_MAP(XRGB, 1, DRM_FORMAT_BGRX8888),
+#ifdef VA_FOURCC_AYUV
+ DRM_MAP(AYUV, 1, DRM_FORMAT_AYUV),
+#endif
+#ifdef VA_FOURCC_Y412
+ DRM_MAP(Y412, 1, DRM_FORMAT_Y412),
+#endif
};
#undef DRM_MAP
@@ -173,6 +173,7 @@ static const struct {
{ AV_PIX_FMT_NV12, { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM } },
{ AV_PIX_FMT_NV21, { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM } },
{ AV_PIX_FMT_P010, { VK_FORMAT_R16_UNORM, VK_FORMAT_R16G16_UNORM } },
+ { AV_PIX_FMT_P012, { VK_FORMAT_R16_UNORM, VK_FORMAT_R16G16_UNORM } },
{ AV_PIX_FMT_P016, { VK_FORMAT_R16_UNORM, VK_FORMAT_R16G16_UNORM } },
{ AV_PIX_FMT_NV16, { VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_UNORM } },
@@ -210,6 +211,9 @@ static const struct {
{ AV_PIX_FMT_YUVA444P12, { VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM } },
{ AV_PIX_FMT_YUVA444P16, { VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM, VK_FORMAT_R16_UNORM } },
+ { AV_PIX_FMT_VUYA, { VK_FORMAT_R8G8B8A8_UNORM } },
+ { AV_PIX_FMT_Y412, { VK_FORMAT_R16G16B16A16_UNORM } },
+
{ AV_PIX_FMT_BGRA, { VK_FORMAT_B8G8R8A8_UNORM } },
{ AV_PIX_FMT_RGBA, { VK_FORMAT_R8G8B8A8_UNORM } },
{ AV_PIX_FMT_RGB24, { VK_FORMAT_R8G8B8_UNORM } },
@@ -2629,6 +2633,12 @@ static const struct {
{ DRM_FORMAT_XRGB8888, VK_FORMAT_B8G8R8A8_UNORM },
{ DRM_FORMAT_ABGR8888, VK_FORMAT_R8G8B8A8_UNORM },
{ DRM_FORMAT_XBGR8888, VK_FORMAT_R8G8B8A8_UNORM },
+
+ { DRM_FORMAT_AYUV, VK_FORMAT_R8G8B8A8_UNORM },
+ { DRM_FORMAT_Y412, VK_FORMAT_R16G16B16A16_UNORM },
+ // As we had to map Y412 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 },
};
static inline VkFormat drm_to_vulkan_fmt(uint32_t drm_fourcc)
These two of the Microsoft formats used by Intel VAAPI are sufficiently conventional that we can add simple mappings for them in the hwcontexts to enable back and forth mapping so that Vulkan filters can be used with vaapi decoding/encoding of these formats. Note that as with P010, we have to map to full 16bit Vulkan formats and so technically lose some information with P012 and Y412. The most significant consequence of this is that when mapping form Vulkan back to VAAPI, the underlying DRM format will actually be Y416 and so we need a mapping entry for it, even though we haven't added that as a pixel format. Signed-off-by: Philip Langdale <philipl@overt.org> --- libavutil/hwcontext_vaapi.c | 9 +++++++++ libavutil/hwcontext_vulkan.c | 10 ++++++++++ 2 files changed, 19 insertions(+)