diff options
author | Chris Dimich <chris.dimich@boundarydevices.com> | 2023-02-08 11:20:04 -0800 |
---|---|---|
committer | Chris Dimich <chris.dimich@boundarydevices.com> | 2023-02-08 11:20:04 -0800 |
commit | fd3289315d7d3410299271adde149c624d197698 (patch) | |
tree | 13761f3997986956e84770f93ee20fa52c4c01c4 /dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0118-V4L2VDA-Use-dlopen-to-dynamically-use-g2d-api.patch | |
parent | a43df6bd68253640c6808cec0d20bbfac51612e6 (diff) | |
download | meta-freescale-fd3289315d7d3410299271adde149c624d197698.tar.gz |
chromium-ozone-wayland: remove bbappend and patches
Removing because they are based on older version of chromium
(101.0.4951.54) and do not apply on latest/HEAD.
Signed-off-by: Chris Dimich <chris.dimich@boundarydevices.com>
Diffstat (limited to 'dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0118-V4L2VDA-Use-dlopen-to-dynamically-use-g2d-api.patch')
-rw-r--r-- | dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0118-V4L2VDA-Use-dlopen-to-dynamically-use-g2d-api.patch | 306 |
1 files changed, 0 insertions, 306 deletions
diff --git a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0118-V4L2VDA-Use-dlopen-to-dynamically-use-g2d-api.patch b/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0118-V4L2VDA-Use-dlopen-to-dynamically-use-g2d-api.patch deleted file mode 100644 index 7cd0b852..00000000 --- a/dynamic-layers/chromium-browser-layer/recipes-browser/chromium/chromium-ozone-wayland/0118-V4L2VDA-Use-dlopen-to-dynamically-use-g2d-api.patch +++ /dev/null | |||
@@ -1,306 +0,0 @@ | |||
1 | From 59bf28174104b591088a08e2ed61644cc93101fd Mon Sep 17 00:00:00 2001 | ||
2 | From: Hou Qi <qi.hou@nxp.com> | ||
3 | Date: Thu, 22 Sep 2022 11:10:46 +0800 | ||
4 | Subject: [PATCH] V4L2VDA: Use dlopen to dynamically use g2d api | ||
5 | |||
6 | Upstream-Status: Inappropriate [NXP specific] | ||
7 | --- | ||
8 | media/gpu/v4l2/BUILD.gn | 1 - | ||
9 | media/gpu/v4l2/v4l2_device.cc | 205 ++++++++++++++++++++++++++++++++-- | ||
10 | 2 files changed, 194 insertions(+), 12 deletions(-) | ||
11 | |||
12 | diff --git a/media/gpu/v4l2/BUILD.gn b/media/gpu/v4l2/BUILD.gn | ||
13 | index 273f6066de175..ebd0a4ad64646 100644 | ||
14 | --- a/media/gpu/v4l2/BUILD.gn | ||
15 | +++ b/media/gpu/v4l2/BUILD.gn | ||
16 | @@ -86,7 +86,6 @@ source_set("v4l2") { | ||
17 | "EGL", | ||
18 | "GLESv2", | ||
19 | ] | ||
20 | - libs += [ "g2d" ] | ||
21 | |||
22 | if (use_v4l2_codec_aml) { | ||
23 | sources += [ | ||
24 | diff --git a/media/gpu/v4l2/v4l2_device.cc b/media/gpu/v4l2/v4l2_device.cc | ||
25 | index 42cd8386f41cb..af71f54d141aa 100644 | ||
26 | --- a/media/gpu/v4l2/v4l2_device.cc | ||
27 | +++ b/media/gpu/v4l2/v4l2_device.cc | ||
28 | @@ -40,10 +40,12 @@ | ||
29 | #include "media/gpu/v4l2/aml_v4l2_device.h" | ||
30 | #endif | ||
31 | |||
32 | -#include "g2d.h" | ||
33 | -#include "g2dExt.h" | ||
34 | +// #include "g2d.h" | ||
35 | +// #include "g2dExt.h" | ||
36 | + | ||
37 | #include <linux/dma-buf.h> | ||
38 | #include <time.h> | ||
39 | +#include <dlfcn.h> | ||
40 | |||
41 | namespace media { | ||
42 | |||
43 | @@ -142,6 +144,158 @@ void V4L2ProcessingTrace(const struct v4l2_buffer* v4l2_buffer, bool start) { | ||
44 | |||
45 | } // namespace | ||
46 | |||
47 | +/* g2d.h g2dExt.h */ | ||
48 | +enum g2d_format | ||
49 | +{ | ||
50 | +//rgb formats | ||
51 | + G2D_RGB565 = 0, /* [0:4] Blue; [5:10] Green; [11:15] Red */ | ||
52 | + G2D_RGBA8888 = 1, /* [0:7] Red; [8:15] Green; [16:23] Blue; [23:31] Alpha */ | ||
53 | + G2D_RGBX8888 = 2, /* [0:7] Red; [8:15] Green; [16:23] Blue; [23:31] don't care */ | ||
54 | + G2D_BGRA8888 = 3, /* [0:7] Blue; [8:15] Green; [16:23] Red; [23:31] Alpha */ | ||
55 | + G2D_BGRX8888 = 4, /* [0:7] Blue; [8:15] Green; [16:23] Red; [23:31] don't care */ | ||
56 | + G2D_BGR565 = 5, /* [0:4] Red; [5:10] Green; [11:15] Blue */ | ||
57 | + | ||
58 | + G2D_ARGB8888 = 6, /* [0:7] Alpha; [8:15] Red; [16:23] Green; [23:31] Blue */ | ||
59 | + G2D_ABGR8888 = 7, /* [0:7] Alpha; [8:15] Blue; [16:23] Green; [23:31] Red */ | ||
60 | + G2D_XRGB8888 = 8, /* [0:7] don't care; [8:15] Red; [16:23] Green; [23:31] Blue */ | ||
61 | + G2D_XBGR8888 = 9, /* [0:7] don't care; [8:15] Blue; [16:23] Green; [23:31] Red */ | ||
62 | + G2D_RGB888 = 10, /* [0:7] Red; [8:15] Green; [16:23] Blue */ | ||
63 | + G2D_BGR888 = 11, /* [0:7] Blue; [8:15] Green; [16:23] Red */ | ||
64 | + | ||
65 | + G2D_RGBA5551 = 12, /* [0:4] Red; [5:9] Green; [10:14] Blue; [15] Alpha */ | ||
66 | + G2D_RGBX5551 = 13, /* [0:4] Red; [5:9] Green; [10:14] Blue; [15] don't care */ | ||
67 | + G2D_BGRA5551 = 14, /* [0:4] Blue; [5:9] Green; [10:14] Red; [15] Alpha */ | ||
68 | + G2D_BGRX5551 = 15, /* [0:4] Blue; [5:9] Green; [10:14] Red; [15] don't care */ | ||
69 | + | ||
70 | +//yuv formats | ||
71 | + G2D_NV12 = 20, /* 2 plane 420 format; plane 1: [0:7] Y ; plane 2: [0:7] U; [8:15] V */ | ||
72 | + G2D_I420 = 21, /* 3 plane 420 format; plane 1: [0:7] Y ; plane 2: [0:7] U; plane 3: [0:7] V */ | ||
73 | + G2D_YV12 = 22, /* 3 plane 420 format; plane 1: [0:7] Y ; plane 2: [0:7] V; plane 3: [0:7] U */ | ||
74 | + G2D_NV21 = 23, /* 2 plane 420 format; plane 1: [0:7] Y ; plane 2: [0:7] V; [8:15] U */ | ||
75 | + G2D_YUYV = 24, /* 1 plane 422 format; [0:7] Y; [8:15; U; [16:23] Y; [24:31] V */ | ||
76 | + G2D_YVYU = 25, /* 1 plane 422 format; [0:7] Y; [8:15; V; [16:23] Y; [24:31] U */ | ||
77 | + G2D_UYVY = 26, /* 1 plane 422 format; [0:7] U; [8:15; Y; [16:23] V; [24:31] Y */ | ||
78 | + G2D_VYUY = 27, /* 1 plane 422 format; [0:7] V; [8:15; Y; [16:23] U; [24:31] Y */ | ||
79 | + G2D_NV16 = 28, /* 2 plane 422 format; plane 1: [0:7] Y ; plane 2: [0:7] U; [8:15] V */ | ||
80 | + G2D_NV61 = 29, /* 2 plane 422 format; plane 1: [0:7] Y ; plane 2: [0:7] V; [8:15] U */ | ||
81 | +}; | ||
82 | + | ||
83 | +enum g2d_tiling | ||
84 | +{ | ||
85 | + G2D_LINEAR = 0x1, | ||
86 | + G2D_TILED = 0x2, | ||
87 | + G2D_SUPERTILED = 0x4, | ||
88 | + G2D_AMPHION_TILED = 0x8, | ||
89 | + G2D_AMPHION_INTERLACED = 0x10, | ||
90 | + G2D_TILED_STATUS = 0x20, | ||
91 | + G2D_AMPHION_TILED_10BIT = 0x40, | ||
92 | +}; | ||
93 | + | ||
94 | +struct g2d_tile_status | ||
95 | +{ | ||
96 | + unsigned int ts_addr; | ||
97 | + | ||
98 | + unsigned int fc_enabled; | ||
99 | + unsigned int fc_value; | ||
100 | + unsigned int fc_value_upper; | ||
101 | +}; | ||
102 | + | ||
103 | +struct g2d_buf | ||
104 | +{ | ||
105 | + void *buf_handle; | ||
106 | + void *buf_vaddr; | ||
107 | + int buf_paddr; | ||
108 | + int buf_size; | ||
109 | +}; | ||
110 | + | ||
111 | +enum g2d_blend_func | ||
112 | +{ | ||
113 | +//basic blend | ||
114 | + G2D_ZERO = 0, | ||
115 | + G2D_ONE = 1, | ||
116 | + G2D_SRC_ALPHA = 2, | ||
117 | + G2D_ONE_MINUS_SRC_ALPHA = 3, | ||
118 | + G2D_DST_ALPHA = 4, | ||
119 | + G2D_ONE_MINUS_DST_ALPHA = 5, | ||
120 | + | ||
121 | +// extensive blend is set with basic blend together, | ||
122 | +// such as, G2D_ONE | G2D_PRE_MULTIPLIED_ALPHA | ||
123 | + G2D_PRE_MULTIPLIED_ALPHA = 0x10, | ||
124 | + G2D_DEMULTIPLY_OUT_ALPHA = 0x20, | ||
125 | +}; | ||
126 | + | ||
127 | +enum g2d_rotation | ||
128 | +{ | ||
129 | + G2D_ROTATION_0 = 0, | ||
130 | + G2D_ROTATION_90 = 1, | ||
131 | + G2D_ROTATION_180 = 2, | ||
132 | + G2D_ROTATION_270 = 3, | ||
133 | + G2D_FLIP_H = 4, | ||
134 | + G2D_FLIP_V = 5, | ||
135 | +}; | ||
136 | + | ||
137 | +struct g2d_surface | ||
138 | +{ | ||
139 | + enum g2d_format format; | ||
140 | + | ||
141 | + int planes[3];//surface buffer addresses are set in physical planes separately | ||
142 | + //RGB: planes[0] - RGB565/RGBA8888/RGBX8888/BGRA8888/BRGX8888 | ||
143 | + //NV12: planes[0] - Y, planes[1] - packed UV | ||
144 | + //I420: planes[0] - Y, planes[1] - U, planes[2] - V | ||
145 | + //YV12: planes[0] - Y, planes[1] - V, planes[2] - U | ||
146 | + //NV21: planes[0] - Y, planes[1] - packed VU | ||
147 | + //YUYV: planes[0] - packed YUYV | ||
148 | + //YVYU: planes[0] - packed YVYU | ||
149 | + //UYVY: planes[0] - packed UYVY | ||
150 | + //VYUY: planes[0] - packed VYUY | ||
151 | + //NV16: planes[0] - Y, planes[1] - packed UV | ||
152 | + //NV61: planes[0] - Y, planes[1] - packed VU | ||
153 | + | ||
154 | + //blit rectangle in surface | ||
155 | + int left; | ||
156 | + int top; | ||
157 | + int right; | ||
158 | + int bottom; | ||
159 | + int stride; ///< buffer stride, in Pixels | ||
160 | + int width; ///< surface width, in Pixels | ||
161 | + int height; ///< surface height, in Pixels | ||
162 | + enum g2d_blend_func blendfunc; ///< alpha blending parameters | ||
163 | + int global_alpha; ///< value is 0 ~ 255 | ||
164 | + //clrcolor format is RGBA8888, used as dst for clear, as src for blend dim | ||
165 | + int clrcolor; | ||
166 | + | ||
167 | + //rotation degree | ||
168 | + enum g2d_rotation rot; | ||
169 | +}; | ||
170 | + | ||
171 | +struct g2d_surfaceEx | ||
172 | +{ | ||
173 | + struct g2d_surface base; | ||
174 | + enum g2d_tiling tiling; | ||
175 | + | ||
176 | + struct g2d_tile_status ts; | ||
177 | + int reserved[8]; | ||
178 | +}; | ||
179 | + | ||
180 | +void *dl_handle = NULL; | ||
181 | + | ||
182 | +typedef int (*g2d_api_open)(void **handle); | ||
183 | +typedef int (*g2d_api_close)(void *handle); | ||
184 | +typedef int (*g2d_api_free)(struct g2d_buf *buf); | ||
185 | +typedef struct g2d_buf* (*g2d_api_alloc)(int size, int cacheable); | ||
186 | +typedef int (*g2d_api_buf_export_fd)(struct g2d_buf *); | ||
187 | +typedef int (*g2d_api_blitEx)(void *handle, struct g2d_surfaceEx *srcEx, struct g2d_surfaceEx *dstEx); | ||
188 | + | ||
189 | +#define G2D_API_SYM(name) g2d_api_##name g2d_##name = nullptr | ||
190 | +G2D_API_SYM(open); | ||
191 | +G2D_API_SYM(close); | ||
192 | +G2D_API_SYM(free); | ||
193 | +G2D_API_SYM(alloc); | ||
194 | +G2D_API_SYM(buf_export_fd); | ||
195 | +G2D_API_SYM(blitEx); | ||
196 | +#undef G2D_API_SYM | ||
197 | +/* g2d.h g2dExt.h */ | ||
198 | + | ||
199 | V4L2ExtCtrl::V4L2ExtCtrl(uint32_t id) { | ||
200 | memset(&ctrl, 0, sizeof(ctrl)); | ||
201 | ctrl.id = id; | ||
202 | @@ -261,7 +415,7 @@ V4L2Buffer::~V4L2Buffer() { | ||
203 | } | ||
204 | } | ||
205 | } | ||
206 | - if(g2dbuf_p0 && g2dbuf_p1) { | ||
207 | + if(g2d_free && g2dbuf_p0 && g2dbuf_p1) { | ||
208 | g2d_free(g2dbuf_p0); | ||
209 | g2d_free(g2dbuf_p1); | ||
210 | } | ||
211 | @@ -399,14 +553,18 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() { | ||
212 | else | ||
213 | phys_1 = query1.phys; | ||
214 | |||
215 | - g2dbuf_p0 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height, 0); | ||
216 | - g2dbuf_p1 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height / 2, 0); | ||
217 | + if (g2d_alloc) { | ||
218 | + g2dbuf_p0 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height, 0); | ||
219 | + g2dbuf_p1 = g2d_alloc(format_.fmt.pix_mp.width * format_.fmt.pix_mp.height / 2, 0); | ||
220 | + } | ||
221 | if((!g2dbuf_p0) || (!g2dbuf_p1)){ | ||
222 | DLOG(ERROR)<<"g2d buf alloc failed"; | ||
223 | return nullptr; | ||
224 | } | ||
225 | |||
226 | - int tmpfd = g2d_buf_export_fd(g2dbuf_p0); | ||
227 | + int tmpfd = -1; | ||
228 | + if (g2d_buf_export_fd) | ||
229 | + tmpfd = g2d_buf_export_fd(g2dbuf_p0); | ||
230 | tmpfd = dup(tmpfd); | ||
231 | if(tmpfd > 0) | ||
232 | g2dbufs_fds.push_back(base::ScopedFD(tmpfd)); | ||
233 | @@ -416,7 +574,8 @@ scoped_refptr<VideoFrame> V4L2Buffer::CreateVideoFrame() { | ||
234 | return nullptr; | ||
235 | } | ||
236 | |||
237 | - tmpfd = g2d_buf_export_fd(g2dbuf_p1); | ||
238 | + if (g2d_buf_export_fd) | ||
239 | + tmpfd = g2d_buf_export_fd(g2dbuf_p1); | ||
240 | tmpfd = dup(tmpfd); | ||
241 | if(tmpfd>0) | ||
242 | g2dbufs_fds.push_back(base::ScopedFD(tmpfd)); | ||
243 | @@ -1152,7 +1311,7 @@ V4L2Queue::V4L2Queue(scoped_refptr<V4L2Device> dev, | ||
244 | #endif | ||
245 | |||
246 | g2d_handle = NULL; | ||
247 | - if(g2d_open(&g2d_handle)) | ||
248 | + if(g2d_open && g2d_open(&g2d_handle)) | ||
249 | VLOGF(1) << "g2d_open fail"; | ||
250 | } | ||
251 | |||
252 | @@ -1172,7 +1331,7 @@ V4L2Queue::~V4L2Queue() { | ||
253 | DeallocateBuffers(); | ||
254 | } | ||
255 | |||
256 | - if(g2d_handle) | ||
257 | + if(g2d_close && g2d_handle) | ||
258 | g2d_close(g2d_handle); | ||
259 | |||
260 | std::move(destroy_cb_).Run(); | ||
261 | @@ -1573,7 +1732,8 @@ std::pair<bool, V4L2ReadableBufferRef> V4L2Queue::DequeueBuffer() { | ||
262 | src->global_alpha = 0xff; | ||
263 | src->blendfunc = G2D_ONE; | ||
264 | |||
265 | - g2d_blitEx(g2d_handle, &srcEx, &dstEx); | ||
266 | + if (g2d_blitEx) | ||
267 | + g2d_blitEx(g2d_handle, &srcEx, &dstEx); | ||
268 | } | ||
269 | |||
270 | return std::make_pair(true, V4L2BufferRefFactory::CreateReadableRef( | ||
271 | @@ -1747,8 +1907,31 @@ scoped_refptr<V4L2Device> V4L2Device::Create() { | ||
272 | #endif | ||
273 | |||
274 | device = new GenericV4L2Device(); | ||
275 | - if (device->Initialize()) | ||
276 | + if (device->Initialize()) { | ||
277 | + dl_handle = dlopen("/usr/lib/libg2d.so", | ||
278 | + RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE | RTLD_LAZY); | ||
279 | + if (!dl_handle) { | ||
280 | + VLOGF(1) << "Has no libg2d.so"; | ||
281 | + return device; | ||
282 | + } | ||
283 | + | ||
284 | +#define G2D_API_DLSYM(lib, name) \ | ||
285 | + do { \ | ||
286 | + g2d_##name = reinterpret_cast<g2d_api_##name>(dlsym(lib, "g2d_" #name)); \ | ||
287 | + if (!(g2d_##name)) \ | ||
288 | + VLOGF(1) << "Failed to dlsym g2d_" #name; \ | ||
289 | + } while (0) | ||
290 | + | ||
291 | + G2D_API_DLSYM(dl_handle, open); | ||
292 | + G2D_API_DLSYM(dl_handle, close); | ||
293 | + G2D_API_DLSYM(dl_handle, free); | ||
294 | + G2D_API_DLSYM(dl_handle, alloc); | ||
295 | + G2D_API_DLSYM(dl_handle, buf_export_fd); | ||
296 | + G2D_API_DLSYM(dl_handle, blitEx); | ||
297 | + | ||
298 | return device; | ||
299 | + } | ||
300 | + | ||
301 | |||
302 | VLOGF(1) << "Failed to create a V4L2Device"; | ||
303 | return nullptr; | ||
304 | -- | ||
305 | 2.17.1 | ||
306 | |||