1From caac3fa45a2502e32541a2f17592c127be95143d Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Fri, 3 Jul 2020 14:23:45 +0800
4Subject: [PATCH 20/93] pixman-renderer: Support yuv formats
5
6Support yuy2/yv12/i420/nv12/nv16.
7
8Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
9---
10 libweston/pixel-formats.c | 11 +++++++++++
11 meson.build               | 10 ++++++++++
12 2 files changed, 21 insertions(+)
13
14diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c
15index fc33997..7590171 100644
16--- a/libweston/pixel-formats.c
17+++ b/libweston/pixel-formats.c
18@@ -440,6 +440,7 @@ static const struct pixel_format_info pixel_format_table[] = {
19 		SAMPLER_TYPE(EGL_TEXTURE_Y_XUXV_WL),
20 		.num_planes = 1,
21 		.hsub = 2,
22+		PIXMAN_FMT(yuy2),
23 	},
24 	{
25 		DRM_FORMAT(YVYU),
26@@ -469,6 +470,9 @@ static const struct pixel_format_info pixel_format_table[] = {
27 		.num_planes = 2,
28 		.hsub = 2,
29 		.vsub = 2,
30+#ifdef HAVE_PIXMAN_NV12
31+		PIXMAN_FMT(nv12),
32+#endif
33 	},
34 	{
35 		DRM_FORMAT(NV21),
36@@ -484,6 +488,9 @@ static const struct pixel_format_info pixel_format_table[] = {
37 		.num_planes = 2,
38 		.hsub = 2,
39 		.vsub = 1,
40+#ifdef HAVE_PIXMAN_NV16
41+		PIXMAN_FMT(nv16),
42+#endif
43 	},
44 	{
45 		DRM_FORMAT(NV61),
46@@ -540,6 +547,9 @@ static const struct pixel_format_info pixel_format_table[] = {
47 		.num_planes = 3,
48 		.hsub = 2,
49 		.vsub = 2,
50+#ifdef HAVE_PIXMAN_I420
51+		PIXMAN_FMT(i420),
52+#endif
53 	},
54 	{
55 		DRM_FORMAT(YVU420),
56@@ -548,6 +558,7 @@ static const struct pixel_format_info pixel_format_table[] = {
57 		.chroma_order = ORDER_VU,
58 		.hsub = 2,
59 		.vsub = 2,
60+		PIXMAN_FMT(yv12),
61 	},
62 	{
63 		DRM_FORMAT(YUV422),
64diff --git a/meson.build b/meson.build
65index 46e57e2..e03d085 100644
66--- a/meson.build
67+++ b/meson.build
68@@ -157,6 +157,16 @@ dep_libdrm = dependency('libdrm', version: '>= 2.4.108')
69 dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true)
70 dep_threads = dependency('threads')
71
72+if cc.has_header_symbol('pixman.h', 'PIXMAN_nv12', dependencies : dep_pixman)
73+  config_h.set('HAVE_PIXMAN_NV12', 1)
74+endif
75+if cc.has_header_symbol('pixman.h', 'PIXMAN_i420', dependencies : dep_pixman)
76+  config_h.set('HAVE_PIXMAN_I420', 1)
77+endif
78+if cc.has_header_symbol('pixman.h', 'PIXMAN_nv16', dependencies : dep_pixman)
79+  config_h.set('HAVE_PIXMAN_NV16', 1)
80+endif
81+
82 dep_lcms2 = dependency('lcms2', version: '>= 2.9', required: false)
83
84 prog_python = import('python').find_installation('python3')
85--
862.20.1
87
88