From c1ad78476d52085203d22596d1eb59521d43a5ce Mon Sep 17 00:00:00 2001 From: Italo Nicola Date: Thu, 22 Jun 2023 11:55:01 +0000 Subject: [PATCH] panfrost: advertise support for YUYV and variants Signed-off-by: Italo Nicola Part-of: --- src/panfrost/lib/pan_format.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/panfrost/lib/pan_format.c b/src/panfrost/lib/pan_format.c index 7c758c2ec5f..ee47c36a91f 100644 --- a/src/panfrost/lib/pan_format.c +++ b/src/panfrost/lib/pan_format.c @@ -170,10 +170,32 @@ const struct pan_blendable_format } #endif +#if PAN_ARCH == 7 +#define YUV_NO_SWAP (0) +#define YUV_SWAP (1) + +#define FMT_YUV(pipe, mali, swizzle, swap, siting, flags) \ + [PIPE_FORMAT_##pipe] = { \ + .hw = (MALI_YUV_SWIZZLE_##swizzle) | ((YUV_##swap) << 3) | \ + ((MALI_YUV_CR_SITING_##siting) << 9) | ((MALI_##mali) << 12), \ + .bind = FLAGS_##flags, \ + } +#endif + /* clang-format off */ const struct panfrost_format GENX(panfrost_pipe_format)[PIPE_FORMAT_COUNT] = { FMT(NONE, CONSTANT, 0000, L, VTR_), +#if PAN_ARCH == 7 + /* Multiplane formats */ + FMT_YUV(R8G8_R8B8_UNORM, YUYV8, UVYA, NO_SWAP, CO_SITED, _T__), + FMT_YUV(G8R8_B8R8_UNORM, VYUY8, UYVA, SWAP, CO_SITED, _T__), + FMT_YUV(R8B8_R8G8_UNORM, YUYV8, VYUA, NO_SWAP, CO_SITED, _T__), + FMT_YUV(B8R8_G8R8_UNORM, VYUY8, VUYA, SWAP, CO_SITED, _T__), + FMT_YUV(R8_G8B8_420_UNORM, Y8_UV8_420, YUVA, NO_SWAP, CO_SITED, _T__), + FMT_YUV(G8_B8R8_420_UNORM, Y8_UV8_420, YVUA, NO_SWAP, CO_SITED, _T__), +#endif + #if PAN_ARCH <= 7 FMT(ETC1_RGB8, ETC2_RGB8, RGB1, L, _T__), FMT(ETC2_RGB8, ETC2_RGB8, RGB1, L, _T__),