hc
2023-03-13 2ec15ae1cb4be1b4fcb56c6d621123d7ebdaad6c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From c41ad5e822a18fa58103770f471c80d5723bb1ce Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
Date: Fri, 3 Jul 2020 14:23:45 +0800
Subject: [PATCH 17/74] pixman-renderer: Support yuv formats
 
Support yuy2/yv12/i420/nv12/nv16.
 
Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
---
 libweston/pixel-formats.c | 11 +++++++++++
 meson.build               | 10 ++++++++++
 2 files changed, 21 insertions(+)
 
diff --git a/libweston/pixel-formats.c b/libweston/pixel-formats.c
index 9064cb6..172e6cc 100644
--- a/libweston/pixel-formats.c
+++ b/libweston/pixel-formats.c
@@ -337,6 +337,7 @@ static const struct pixel_format_info pixel_format_table[] = {
         SAMPLER_TYPE(EGL_TEXTURE_Y_XUXV_WL),
         .num_planes = 1,
         .hsub = 2,
+        PIXMAN_FMT(yuy2),
     },
     {
         DRM_FORMAT(YVYU),
@@ -366,6 +367,9 @@ static const struct pixel_format_info pixel_format_table[] = {
         .num_planes = 2,
         .hsub = 2,
         .vsub = 2,
+#ifdef HAVE_PIXMAN_NV12
+        PIXMAN_FMT(nv12),
+#endif
     },
     {
         DRM_FORMAT(NV21),
@@ -381,6 +385,9 @@ static const struct pixel_format_info pixel_format_table[] = {
         .num_planes = 2,
         .hsub = 2,
         .vsub = 1,
+#ifdef HAVE_PIXMAN_NV16
+        PIXMAN_FMT(nv16),
+#endif
     },
     {
         DRM_FORMAT(NV61),
@@ -437,6 +444,9 @@ static const struct pixel_format_info pixel_format_table[] = {
         .num_planes = 3,
         .hsub = 2,
         .vsub = 2,
+#ifdef HAVE_PIXMAN_I420
+        PIXMAN_FMT(i420),
+#endif
     },
     {
         DRM_FORMAT(YVU420),
@@ -445,6 +455,7 @@ static const struct pixel_format_info pixel_format_table[] = {
         .chroma_order = ORDER_VU,
         .hsub = 2,
         .vsub = 2,
+        PIXMAN_FMT(yv12),
     },
     {
         DRM_FORMAT(YUV422),
diff --git a/meson.build b/meson.build
index c9c58e0..d867771 100644
--- a/meson.build
+++ b/meson.build
@@ -161,6 +161,16 @@ dep_libdrm = dependency('libdrm', version: '>= 2.4.95')
 dep_libdrm_headers = dep_libdrm.partial_dependency(compile_args: true)
 dep_threads = dependency('threads')
 
+if cc.has_header_symbol('pixman.h', 'PIXMAN_nv12', dependencies : dep_pixman)
+  config_h.set('HAVE_PIXMAN_NV12', 1)
+endif
+if cc.has_header_symbol('pixman.h', 'PIXMAN_i420', dependencies : dep_pixman)
+  config_h.set('HAVE_PIXMAN_I420', 1)
+endif
+if cc.has_header_symbol('pixman.h', 'PIXMAN_nv16', dependencies : dep_pixman)
+  config_h.set('HAVE_PIXMAN_NV16', 1)
+endif
+
 dep_libdrm_version = dep_libdrm.version()
 if dep_libdrm_version.version_compare('>=2.4.107')
   message('Found libdrm with human format modifier support.')
-- 
2.20.1