1From 8ac02ab40c03233285bd77d58433e19792bc152e Mon Sep 17 00:00:00 2001 2From: Jeffy Chen <jeffy.chen@rock-chips.com> 3Date: Mon, 7 Mar 2022 18:22:04 +0800 4Subject: [PATCH 56/79] pixel-formats: Support NV15/YU08/YU10 5 6Only for importing dmabuf to drm fb. 7 8Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> 9--- 10 libweston/pixel-formats.c | 12 ++++++++++++ 11 shared/weston-drm-fourcc.h | 12 ++++++++++++ 12 2 files changed, 24 insertions(+) 13 14diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c 15index a7ae8c00..0aa94573 100644 16--- a/libweston/pixel-formats.c 17+++ b/libweston/pixel-formats.c 18@@ -591,6 +591,18 @@ static const struct pixel_format_info pixel_format_table[] = { 19 DRM_FORMAT(XYUV8888), 20 .bpp = 32, 21 }, 22+ { 23+ DRM_FORMAT(NV15), 24+ .num_planes = 1, 25+ }, 26+ { 27+ DRM_FORMAT(YUV420_8BIT), 28+ .num_planes = 1, 29+ }, 30+ { 31+ DRM_FORMAT(YUV420_10BIT), 32+ .num_planes = 1, 33+ }, 34 }; 35 36 WL_EXPORT const struct pixel_format_info * 37diff --git a/shared/weston-drm-fourcc.h b/shared/weston-drm-fourcc.h 38index 31d80398..be9eaf68 100644 39--- a/shared/weston-drm-fourcc.h 40+++ b/shared/weston-drm-fourcc.h 41@@ -34,6 +34,18 @@ 42 #define DRM_MOD_VALID(mod) \ 43 ((mod) != DRM_FORMAT_MOD_LINEAR && (mod) != DRM_FORMAT_MOD_INVALID) 44 45+#ifndef DRM_FORMAT_NV15 46+#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') 47+#endif 48+ 49+#ifndef DRM_FORMAT_YUV420_8BIT 50+#define DRM_FORMAT_YUV420_8BIT fourcc_code('Y', 'U', '0', '8') 51+#endif 52+ 53+#ifndef DRM_FORMAT_YUV420_10BIT 54+#define DRM_FORMAT_YUV420_10BIT fourcc_code('Y', 'U', '1', '0') 55+#endif 56+ 57 /* The kernel header drm_fourcc.h defines the DRM formats below. We duplicate 58 * some of the definitions here so that building Weston won't require 59 * bleeding-edge kernel headers. 60-- 612.20.1 62 63