diff options
author | Zan Dobersek <zdobersek@igalia.com> | 2020-11-10 11:14:28 +0100 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2020-11-10 16:25:41 -0300 |
commit | 447032d809427a20cc066b32254cea8821073281 (patch) | |
tree | 6b960d29ae34f963ee781cf03e7857f01b33dce6 /recipes-multimedia | |
parent | c25cd3a6366d3a4bd3b1b4d3da0115a600a4e9a9 (diff) | |
download | meta-freescale-447032d809427a20cc066b32254cea8821073281.tar.gz |
gstreamer1.0-plugins-base: add additional patches
Add a pair of patches that's to be applied over the iMX flavor of the
gstreamer1.0-plugins-base codebase.
First patch comes from upstream, and it fixes glupload behavior by avoiding
mapping the GL buffers into CPU memory. It's only applicable to the current
MM_04.05.05_2005_L5.4.24 branch that is based on the upstream 1.16.1 release,
since the patch itself is already present in 1.16.2.
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/444
Second patch is a fix for Meson builds that enable the viv-fb GL winsys. The
change is only applicable to the NXP gst-plugins-base repository. When enabled,
the GL plugins library should also link against libg2d since the viv-fb code
is using g2d allocators.
Signed-off-by: Zan Dobersek <zdobersek@igalia.com>
Diffstat (limited to 'recipes-multimedia')
3 files changed, 133 insertions, 0 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-glupload-Add-VideoMetas-and-GLSyncMeta-to-the-raw-up.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-glupload-Add-VideoMetas-and-GLSyncMeta-to-the-raw-up.patch new file mode 100644 index 00000000..f891a63a --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-glupload-Add-VideoMetas-and-GLSyncMeta-to-the-raw-up.patch | |||
@@ -0,0 +1,87 @@ | |||
1 | From 8d32de090554cf29fe359f83aa46000ba658a693 Mon Sep 17 00:00:00 2001 | ||
2 | From: Thibault Saunier <tsaunier@igalia.com> | ||
3 | Date: Fri, 27 Sep 2019 11:10:43 -0300 | ||
4 | Subject: [PATCH] glupload: Add VideoMetas and GLSyncMeta to the raw uploaded | ||
5 | buffers | ||
6 | |||
7 | This is done by reusing `gst_gl_memory_setup_buffer` avoiding to | ||
8 | duplicate code. | ||
9 | |||
10 | Without a VideoMeta, mapping those buffers lead to GstBuffer mapping the | ||
11 | buffer in system memory even when specifying the GL flags (through the | ||
12 | buffer merging mechanism) making the result totally broken. | ||
13 | |||
14 | Part-of: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/444 | ||
15 | Upstream-Status: Backport [8d32de090554cf29fe359f83aa46000ba658a693] | ||
16 | |||
17 | Signed-off-by: Zan Dobersek <zdobersek@igalia.com> | ||
18 | --- | ||
19 | gst-libs/gst/gl/gstglupload.c | 32 +++++++++++--------------------- | ||
20 | tests/check/libs/gstglupload.c | 2 ++ | ||
21 | 2 files changed, 13 insertions(+), 21 deletions(-) | ||
22 | |||
23 | diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c | ||
24 | index bc6db7e0a..67ec4f4e9 100644 | ||
25 | --- a/gst-libs/gst/gl/gstglupload.c | ||
26 | +++ b/gst-libs/gst/gl/gstglupload.c | ||
27 | @@ -1293,33 +1293,23 @@ _raw_data_upload_perform (gpointer impl, GstBuffer * buffer, | ||
28 | (raw->upload->context)); | ||
29 | |||
30 | /* FIXME Use a buffer pool to cache the generated textures */ | ||
31 | - /* FIXME: multiview support with separated left/right frames? */ | ||
32 | *outbuf = gst_buffer_new (); | ||
33 | - for (i = 0; i < n_mem; i++) { | ||
34 | - GstGLBaseMemory *tex; | ||
35 | - | ||
36 | - raw->params->parent.wrapped_data = raw->in_frame->frame.data[i]; | ||
37 | - raw->params->plane = i; | ||
38 | - raw->params->tex_format = | ||
39 | - gst_gl_format_from_video_info (raw->upload->context, in_info, i); | ||
40 | - | ||
41 | - tex = | ||
42 | - gst_gl_base_memory_alloc (allocator, | ||
43 | - (GstGLAllocationParams *) raw->params); | ||
44 | - if (!tex) { | ||
45 | - gst_buffer_unref (*outbuf); | ||
46 | - *outbuf = NULL; | ||
47 | - GST_ERROR_OBJECT (raw->upload, "Failed to allocate wrapped texture"); | ||
48 | - return GST_GL_UPLOAD_ERROR; | ||
49 | - } | ||
50 | + raw->params->parent.context = raw->upload->context; | ||
51 | + if (gst_gl_memory_setup_buffer ((GstGLMemoryAllocator *) allocator, *outbuf, | ||
52 | + raw->params, NULL, raw->in_frame->frame.data, n_mem)) { | ||
53 | |||
54 | - _raw_upload_frame_ref (raw->in_frame); | ||
55 | - gst_buffer_append_memory (*outbuf, (GstMemory *) tex); | ||
56 | + for (i = 0; i < n_mem; i++) | ||
57 | + _raw_upload_frame_ref (raw->in_frame); | ||
58 | + gst_buffer_add_gl_sync_meta (raw->upload->context, *outbuf); | ||
59 | + } else { | ||
60 | + GST_ERROR_OBJECT (raw->upload, "Failed to allocate wrapped texture"); | ||
61 | + gst_buffer_unref (*outbuf); | ||
62 | + return GST_GL_UPLOAD_ERROR; | ||
63 | } | ||
64 | gst_object_unref (allocator); | ||
65 | - | ||
66 | _raw_upload_frame_unref (raw->in_frame); | ||
67 | raw->in_frame = NULL; | ||
68 | + | ||
69 | return GST_GL_UPLOAD_DONE; | ||
70 | } | ||
71 | |||
72 | diff --git a/tests/check/libs/gstglupload.c b/tests/check/libs/gstglupload.c | ||
73 | index 74bff2b83..eff2f18ba 100644 | ||
74 | --- a/tests/check/libs/gstglupload.c | ||
75 | +++ b/tests/check/libs/gstglupload.c | ||
76 | @@ -281,6 +281,8 @@ GST_START_TEST (test_upload_data) | ||
77 | res = gst_gl_upload_perform_with_buffer (upload, inbuf, &outbuf); | ||
78 | fail_unless (res == GST_GL_UPLOAD_DONE, "Failed to upload buffer"); | ||
79 | fail_unless (GST_IS_BUFFER (outbuf)); | ||
80 | + fail_unless (gst_buffer_get_video_meta (outbuf)); | ||
81 | + fail_unless (gst_buffer_get_gl_sync_meta (outbuf)); | ||
82 | |||
83 | res = gst_buffer_map (outbuf, &map_info, GST_MAP_READ | GST_MAP_GL); | ||
84 | fail_if (res == FALSE, "Failed to map gl memory"); | ||
85 | -- | ||
86 | 2.28.0 | ||
87 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-meson-viv-fb-code-must-link-against-libg2d.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-meson-viv-fb-code-must-link-against-libg2d.patch new file mode 100644 index 00000000..c761619f --- /dev/null +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-meson-viv-fb-code-must-link-against-libg2d.patch | |||
@@ -0,0 +1,44 @@ | |||
1 | From 8153e86dac04076fb80fc272c8374d4ba019fa3c Mon Sep 17 00:00:00 2001 | ||
2 | From: Zan Dobersek <zdobersek@igalia.com> | ||
3 | Date: Wed, 4 Nov 2020 14:02:10 +0100 | ||
4 | Subject: [PATCH] meson: viv-fb code must link against libg2d | ||
5 | |||
6 | Find the libg2d library and link against it, if necessary, avoiding | ||
7 | linking errors for couple of libg2d symbols. | ||
8 | |||
9 | Upstream-Status: Pending | ||
10 | |||
11 | Signed-off-by: Zan Dobersek <zdobersek@igalia.com> | ||
12 | --- | ||
13 | gst-libs/gst/gl/meson.build | 6 +++++- | ||
14 | 1 file changed, 5 insertions(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/gst-libs/gst/gl/meson.build b/gst-libs/gst/gl/meson.build | ||
17 | index 6f6c6866d..fb6a9aabf 100644 | ||
18 | --- a/gst-libs/gst/gl/meson.build | ||
19 | +++ b/gst-libs/gst/gl/meson.build | ||
20 | @@ -818,9 +818,11 @@ if need_win_gbm != 'no' | ||
21 | endif | ||
22 | |||
23 | if need_platform_egl != 'no' and need_win_viv_fb != 'no' | ||
24 | - if egl_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep) | ||
25 | + g2d_dep = cc.find_library('g2d', required : false) | ||
26 | + if egl_dep.found() and g2d_dep.found() and cc.has_function ('fbGetDisplay', dependencies : egl_dep) | ||
27 | if cc.has_function ('glTexDirectVIV', dependencies : gles2_dep) | ||
28 | enabled_gl_winsys += 'viv-fb' | ||
29 | + gl_winsys_deps += [g2d_dep] | ||
30 | glconf.set10('GST_GL_HAVE_WINDOW_VIV_FB', 1) | ||
31 | glconf.set10('GST_GL_HAVE_VIV_DIRECTVIV', 1) | ||
32 | glconf.set10('GST_GL_HAVE_PHYMEM', 1) | ||
33 | @@ -834,6 +836,8 @@ if need_platform_egl != 'no' and need_win_viv_fb != 'no' | ||
34 | ] | ||
35 | gl_cpp_args += ['-DEGL_API_FB'] | ||
36 | endif | ||
37 | + else | ||
38 | + g2d_dep = unneeded_dep | ||
39 | endif | ||
40 | endif | ||
41 | |||
42 | -- | ||
43 | 2.28.0 | ||
44 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.imx.bb b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.imx.bb index 1d7a4609..f8fc08fa 100644 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.imx.bb +++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.16.imx.bb | |||
@@ -14,6 +14,8 @@ SRC_URI = "${GST1.0-PLUGINS-BASE_SRC};branch=${SRCBRANCH} \ | |||
14 | file://0005-viv-fb-Make-sure-config.h-is-included.patch \ | 14 | file://0005-viv-fb-Make-sure-config.h-is-included.patch \ |
15 | file://0009-glimagesink-Downrank-to-marginal.patch \ | 15 | file://0009-glimagesink-Downrank-to-marginal.patch \ |
16 | file://0001-gst-libs-gst-gl-wayland-fix-meson-build.patch \ | 16 | file://0001-gst-libs-gst-gl-wayland-fix-meson-build.patch \ |
17 | file://0001-glupload-Add-VideoMetas-and-GLSyncMeta-to-the-raw-up.patch \ | ||
18 | file://0001-meson-viv-fb-code-must-link-against-libg2d.patch \ | ||
17 | " | 19 | " |
18 | 20 | ||
19 | S = "${WORKDIR}/git" | 21 | S = "${WORKDIR}/git" |