summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia
diff options
context:
space:
mode:
authorYuqing Zhu <carol.zhu@nxp.com>2016-12-21 18:40:38 +0800
committerOtavio Salvador <otavio@ossystems.com.br>2017-01-11 10:56:36 -0200
commit2612cc0cccf892e48f170a9f6678beb4cc6f785e (patch)
tree99d5a8ffae8813411a604225d9dffb7bde5f47ef /recipes-multimedia
parentcc0262afdcc0d9a9ea4d3b0783fc123cfa39f6f1 (diff)
downloadmeta-freescale-2612cc0cccf892e48f170a9f6678beb4cc6f785e.tar.gz
gstreamer1.0-plugins-bad: Remove the conflicted patches
These patches are for GST 1.8, need to do refine for GST 1.10 Signed-off-by: Yuqing Zhu <carol.zhu@nxp.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-multimedia')
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch758
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch438
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch729
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-Fix-dependence-issue-between-gst-plugin-.patch74
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch170
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glwindow-work-around-for-no-frame-when-imxplayer-use.patch63
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch168
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0009-MMFMWK-7308-Fix-build-issue-on-non-GPU-soc.patch454
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend8
9 files changed, 0 insertions, 2862 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch
deleted file mode 100755
index b5b8d644..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch
+++ /dev/null
@@ -1,758 +0,0 @@
1From 230873df6cfd43ce70d9dc763d6f47415f846059 Mon Sep 17 00:00:00 2001
2From: Haihua Hu <b55597@freescale.com>
3Date: Mon, 16 Nov 2015 17:41:57 +0800
4Subject: [PATCH] Support fb backend for gl plugins
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
91.Add fb support in glimagesink
102.override set_render_rectangle() to support resize
11
12Upstream-Status: Inappropriate [i.MX specific]
13
14Signed-off-by: Haihua Hu <b55597@freescale.com>
15---
16 configure.ac | 25 ++-
17 gst-libs/gst/gl/Makefile.am | 5 +
18 gst-libs/gst/gl/fb/Makefile.am | 25 +++
19 gst-libs/gst/gl/fb/gstgldisplay_fb.c | 109 +++++++++++++
20 gst-libs/gst/gl/fb/gstgldisplay_fb.h | 67 ++++++++
21 gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | 265 ++++++++++++++++++++++++++++++++
22 gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | 65 ++++++++
23 gst-libs/gst/gl/gstgldisplay.c | 8 +
24 gst-libs/gst/gl/gstgldisplay.h | 1 +
25 gst-libs/gst/gl/gstglwindow.c | 5 +
26 10 files changed, 574 insertions(+), 1 deletion(-)
27 create mode 100644 gst-libs/gst/gl/fb/Makefile.am
28 create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.c
29 create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.h
30 create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
31 create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
32
33diff --git a/configure.ac b/configure.ac
34index 8d82850..537ee33 100644
35--- a/configure.ac
36+++ b/configure.ac
37@@ -682,6 +682,7 @@ save_LIBS="$LIBS"
38 HAVE_GL=no
39 HAVE_GLES2=no
40 HAVE_WAYLAND_EGL=no
41+HAV_FB_EGL=no
42
43 HAVE_EGL_RPI=no
44
45@@ -718,6 +719,9 @@ case $host in
46 old_LIBS=$LIBS
47 old_CFLAGS=$CFLAGS
48
49+ dnl check for imx fbbackend support
50+ AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no)
51+
52 dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
53 AC_CHECK_HEADER([EGL/fbdev_window.h],
54 [
55@@ -1003,6 +1007,16 @@ case $host in
56 fi
57 fi
58
59+ if test "x$HAVE_FB_EGL" = "xyes"; then
60+ if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
61+ AC_MSG_WARN([EGL is required by the fb backend for OpenGL support])
62+ else
63+ HAVE_WINDOW_FB=yes
64+ GL_LIBS="$GL_LIBS"
65+ GL_CFLAGS="$GL_CFLAGS"
66+ fi
67+ fi
68+
69 if test "x$HAVE_EGL_RPI" = "xyes"; then
70 if test "x$NEED_DISPMANX" != "xno"; then
71 HAVE_WINDOW_DISPMANX=yes
72@@ -1017,7 +1031,7 @@ case $host in
73 fi
74 else
75 if test "x$NEED_EGL" != "xno"; then
76- if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
77+ if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes" -o "x$HAVE_WINDOW_FB" = "xyes"; then
78 GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
79 GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
80 USE_EGL=yes
81@@ -1166,6 +1180,7 @@ GST_GL_HAVE_WINDOW_WAYLAND=0
82 GST_GL_HAVE_WINDOW_ANDROID=0
83 GST_GL_HAVE_WINDOW_DISPMANX=0
84 GST_GL_HAVE_WINDOW_EAGL=0
85+GST_GL_HAVE_WINDOW_FB=0
86
87 if test "x$HAVE_WINDOW_X11" = "xyes"; then
88 GL_WINDOWS="x11 $GL_WINDOWS"
89@@ -1195,6 +1210,10 @@ if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
90 GL_WINDOWS="eagl $GL_WINDOWS"
91 GST_GL_HAVE_WINDOW_EAGL=1
92 fi
93+if test "x$HAVE_WINDOW_FB" = "xyes"; then
94+ GL_WINDOWS="fb $GL_WINDOWS"
95+ GST_GL_HAVE_WINDOW_FB=1
96+fi
97
98 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
99 #define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
100@@ -1204,6 +1223,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
101 #define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID
102 #define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX
103 #define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL
104+#define GST_GL_HAVE_WINDOW_FB $GST_GL_HAVE_WINDOW_FB
105 "
106
107 dnl PLATFORM's
108@@ -1279,6 +1299,7 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
109 HAVE_WINDOW_ANDROID=no
110 HAVE_WINDOW_COCOA=no
111 HAVE_WINDOW_EAGL=no
112+ HAVE_WINDOW_FB=no
113 fi
114
115 AC_SUBST(GL_LIBS)
116@@ -1294,6 +1315,7 @@ AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes")
117 AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
118 AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
119 AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
120+AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes")
121
122 AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
123 AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
124@@ -3580,6 +3602,7 @@ gst-libs/gst/gl/egl/Makefile
125 gst-libs/gst/gl/wayland/Makefile
126 gst-libs/gst/gl/win32/Makefile
127 gst-libs/gst/gl/x11/Makefile
128+gst-libs/gst/gl/fb/Makefile
129 gst-libs/gst/insertbin/Makefile
130 gst-libs/gst/interfaces/Makefile
131 gst-libs/gst/codecparsers/Makefile
132diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
133index f1cb9e1..4bd6511 100644
134--- a/gst-libs/gst/gl/Makefile.am
135+++ b/gst-libs/gst/gl/Makefile.am
136@@ -117,6 +117,11 @@ SUBDIRS += eagl
137 libgstgl_@GST_API_VERSION@_la_LIBADD += eagl/libgstgl-eagl.la
138 endif
139
140+if HAVE_WINDOW_FB
141+SUBDIRS += fb
142+libgstgl_@GST_API_VERSION@_la_LIBADD += fb/libgstgl-fb.la
143+endif
144+
145 if USE_EGL
146 SUBDIRS += egl
147 libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la
148diff --git a/gst-libs/gst/gl/fb/Makefile.am b/gst-libs/gst/gl/fb/Makefile.am
149new file mode 100644
150index 0000000..8e4656c
151--- /dev/null
152+++ b/gst-libs/gst/gl/fb/Makefile.am
153@@ -0,0 +1,25 @@
154+## Process this file with automake to produce Makefile.in
155+
156+noinst_LTLIBRARIES = libgstgl-fb.la
157+
158+libgstgl_fb_la_SOURCES = \
159+ gstgldisplay_fb.c \
160+ gstglwindow_fb_egl.c
161+
162+noinst_HEADERS = \
163+ gstgldisplay_fb.h \
164+ gstglwindow_fb_egl.h
165+
166+libgstgl_fbincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/fb
167+
168+libgstgl_fb_la_CFLAGS = \
169+ -I$(top_srcdir)/gst-libs \
170+ -I$(top_builddir)/gst-libs \
171+ $(GL_CFLAGS) \
172+ $(GST_PLUGINS_BASE_CFLAGS) \
173+ $(GST_BASE_CFLAGS) \
174+ $(GST_CFLAGS)
175+
176+libgstgl_fb_la_LDFLAGS = \
177+ $(GST_LIB_LDFLAGS) \
178+ $(GST_ALL_LDFLAGS)
179diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.c b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
180new file mode 100644
181index 0000000..3be9756
182--- /dev/null
183+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
184@@ -0,0 +1,109 @@
185+/*
186+ * GStreamer
187+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
188+ *
189+ * This library is free software; you can redistribute it and/or
190+ * modify it under the terms of the GNU Library General Public
191+ * License as published by the Free Software Foundation; either
192+ * version 2 of the License, or (at your option) any later version.
193+ *
194+ * This library is distributed in the hope that it will be useful,
195+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
196+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
197+ * Library General Public License for more details.
198+ *
199+ * You should have received a copy of the GNU Library General Public
200+ * License along with this library; if not, write to the
201+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
202+ * Boston, MA 02110-1301, USA.
203+ */
204+
205+#ifdef HAVE_CONFIG_H
206+#include "config.h"
207+#endif
208+
209+#include <gst/gl/fb/gstgldisplay_fb.h>
210+
211+GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
212+#define GST_CAT_DEFAULT gst_gl_display_debug
213+
214+G_DEFINE_TYPE (GstGLDisplayFB, gst_gl_display_fb, GST_TYPE_GL_DISPLAY);
215+
216+static void gst_gl_display_fb_finalize (GObject * object);
217+static guintptr gst_gl_display_fb_get_handle (GstGLDisplay * display);
218+
219+static void
220+gst_gl_display_fb_class_init (GstGLDisplayFBClass * klass)
221+{
222+ GST_GL_DISPLAY_CLASS (klass)->get_handle =
223+ GST_DEBUG_FUNCPTR (gst_gl_display_fb_get_handle);
224+
225+ G_OBJECT_CLASS (klass)->finalize = gst_gl_display_fb_finalize;
226+}
227+
228+static void
229+gst_gl_display_fb_init (GstGLDisplayFB * display_fb)
230+{
231+ GstGLDisplay *display = (GstGLDisplay *) display_fb;
232+
233+ display->type = GST_GL_DISPLAY_TYPE_FB;
234+ display_fb->name = NULL;
235+ display_fb->disp_idx = 0;
236+ display_fb->display = NULL;
237+}
238+
239+static void
240+gst_gl_display_fb_finalize (GObject * object)
241+{
242+ GstGLDisplayFB *display_fb = GST_GL_DISPLAY_FB (object);
243+
244+ if (display_fb->name)
245+ g_free (display_fb->name);
246+
247+ if (display_fb->display)
248+ fbDestroyDisplay (display_fb->display);
249+
250+ G_OBJECT_CLASS (gst_gl_display_fb_parent_class)->finalize (object);
251+}
252+
253+/**
254+ * gst_gl_display_fb_new:
255+ * @name: (allow-none): a display name
256+ *
257+ * Create a new #GstGLDisplayFB from the x11 display name. See XOpenDisplay()
258+ * for details on what is a valid name.
259+ *
260+ * Returns: (transfer full): a new #GstGLDisplayFB or %NULL
261+ */
262+GstGLDisplayFB *
263+gst_gl_display_fb_new (gchar *name)
264+{
265+ GstGLDisplayFB *display;
266+ const gchar *fb_name = NULL;
267+
268+ GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
269+ GST_DEBUG ("creating Fb EGL display");
270+
271+ fb_name = name;
272+ if (!fb_name) fb_name = "fb0";
273+
274+ display = g_object_new (GST_TYPE_GL_DISPLAY_FB, NULL);
275+ display->name = g_strdup (fb_name);
276+ sscanf (display->name, "fb%d", &display->disp_idx);
277+ display->display = fbGetDisplayByIndex (display->disp_idx);
278+ if (!display->display) {
279+ GST_ERROR ("Failed to open FB display, \'%s\'", fb_name);
280+ return NULL;
281+ }
282+
283+ GST_DEBUG ("Created fb EGL display %d", display->display);
284+
285+ return display;
286+}
287+
288+static guintptr
289+gst_gl_display_fb_get_handle (GstGLDisplay * display)
290+{
291+ GST_DEBUG ("Get fb EGL display %d", GST_GL_DISPLAY_FB (display)->display);
292+ return (guintptr) GST_GL_DISPLAY_FB (display)->display;
293+}
294diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.h b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
295new file mode 100644
296index 0000000..62987c1
297--- /dev/null
298+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
299@@ -0,0 +1,67 @@
300+/*
301+ * GStreamer
302+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
303+ *
304+ * This library is free software; you can redistribute it and/or
305+ * modify it under the terms of the GNU Library General Public
306+ * License as published by the Free Software Foundation; either
307+ * version 2 of the License, or (at your option) any later version.
308+ *
309+ * This library is distributed in the hope that it will be useful,
310+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
311+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
312+ * Library General Public License for more details.
313+ *
314+ * You should have received a copy of the GNU Library General Public
315+ * License along with this library; if not, write to the
316+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
317+ * Boston, MA 02110-1301, USA.
318+ */
319+
320+#ifndef __GST_GL_DISPLAY_FB_H__
321+#define __GST_GL_DISPLAY_FB_H__
322+
323+#include <EGL/egl.h>
324+#include <gst/gst.h>
325+#include <gst/gl/gstgldisplay.h>
326+
327+G_BEGIN_DECLS
328+
329+GType gst_gl_display_fb_get_type (void);
330+
331+#define GST_TYPE_GL_DISPLAY_FB (gst_gl_display_fb_get_type())
332+#define GST_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFB))
333+#define GST_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFBClass))
334+#define GST_IS_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_FB))
335+#define GST_IS_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_FB))
336+#define GST_GL_DISPLAY_FB_CAST(obj) ((GstGLDisplayFB*)(obj))
337+
338+typedef struct _GstGLDisplayFB GstGLDisplayFB;
339+typedef struct _GstGLDisplayFBClass GstGLDisplayFBClass;
340+
341+/**
342+ * GstGLDisplayFB:
343+ *
344+ * the contents of a #GstGLDisplayFB are private and should only be accessed
345+ * through the provided API
346+ */
347+struct _GstGLDisplayFB
348+{
349+ GstGLDisplay parent;
350+
351+ /* <private> */
352+ gchar *name;
353+ gint disp_idx;
354+ EGLNativeDisplayType display;
355+};
356+
357+struct _GstGLDisplayFBClass
358+{
359+ GstGLDisplayClass object_class;
360+};
361+
362+GstGLDisplayFB *gst_gl_display_fb_new (gchar *name);
363+
364+G_END_DECLS
365+
366+#endif /* __GST_GL_DISPLAY_FB_H__ */
367diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
368new file mode 100644
369index 0000000..a068e30
370--- /dev/null
371+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
372@@ -0,0 +1,265 @@
373+/*
374+ * GStreamer
375+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
376+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
377+ *
378+ * This library is free software; you can redistribute it and/or
379+ * modify it under the terms of the GNU Library General Public
380+ * License as published by the Free Software Foundation; either
381+ * version 2 of the License, or (at your option) any later version.
382+ *
383+ * This library is distributed in the hope that it will be useful,
384+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
385+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
386+ * Library General Public License for more details.
387+ *
388+ * You should have received a copy of the GNU Library General Public
389+ * License along with this library; if not, write to the
390+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
391+ * Boston, MA 02110-1301, USA.
392+ */
393+
394+#include "../gstgl_fwd.h"
395+#include <gst/gl/gstglcontext.h>
396+
397+#include "gstglwindow_fb_egl.h"
398+
399+#define GST_CAT_DEFAULT gst_gl_window_debug
400+
401+#define gst_gl_window_fb_egl_parent_class parent_class
402+G_DEFINE_TYPE (GstGLWindowFbEGL, gst_gl_window_fb_egl,
403+ GST_GL_TYPE_WINDOW);
404+
405+static guintptr gst_gl_window_fb_egl_get_window_handle (GstGLWindow *
406+ window);
407+static void gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
408+ guintptr handle);
409+static void gst_gl_window_fb_egl_draw (GstGLWindow * window);
410+static void gst_gl_window_fb_egl_close (GstGLWindow * window);
411+static gboolean gst_gl_window_fb_egl_open (GstGLWindow * window,
412+ GError ** error);
413+static gboolean
414+gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window,
415+ guint x, guint y, guint width, guint height);
416+
417+static void
418+gst_gl_window_fb_egl_class_init (GstGLWindowFbEGLClass * klass)
419+{
420+ GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
421+
422+ window_class->get_window_handle =
423+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_get_window_handle);
424+ window_class->set_window_handle =
425+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_window_handle);
426+ window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_draw);
427+ window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_close);
428+ window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_open);
429+ window_class->set_render_rectangle =
430+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_render_rectangle);
431+}
432+
433+static void
434+gst_gl_window_fb_egl_init (GstGLWindowFbEGL * window)
435+{
436+ GstGLWindowFbEGL *window_egl;
437+
438+ window_egl = GST_GL_WINDOW_FB_EGL (window);
439+
440+ window_egl->width = 0;
441+ window_egl->height = 0;
442+ window_egl->default_fullscreen = TRUE;
443+ window_egl->display = 0;
444+}
445+
446+/* Must be called in the gl thread */
447+GstGLWindowFbEGL *
448+gst_gl_window_fb_egl_new (GstGLDisplay * display)
449+{
450+ GstGLWindowFbEGL *window;
451+ const gchar *fb_name = NULL;
452+
453+ if (!display)
454+ return NULL;
455+
456+ window = g_object_new (GST_GL_TYPE_WINDOW_FB_EGL, NULL);
457+ window->display = gst_gl_display_get_handle (display);
458+ if (!window->display) {
459+ GST_ERROR ("failed to get display for egl window");
460+ return NULL;
461+ }
462+
463+ return window;
464+}
465+
466+static void
467+gst_gl_window_fb_egl_close (GstGLWindow * window)
468+{
469+ GstGLWindowFbEGL *window_egl;
470+
471+ window_egl = GST_GL_WINDOW_FB_EGL (window);
472+
473+ if (window_egl->win_id) {
474+ fbDestroyWindow (window_egl->win_id);
475+ }
476+
477+ GST_GL_WINDOW_CLASS (parent_class)->close (window);
478+}
479+
480+static gboolean
481+gst_gl_window_fb_egl_open (GstGLWindow * window, GError ** error)
482+{
483+ GstGLWindowFbEGL *window_egl;
484+
485+ window_egl = GST_GL_WINDOW_FB_EGL (window);
486+
487+ if (!window_egl->display) {
488+ GST_ERROR ("No display for window_egl.");
489+ return FALSE;
490+ }
491+
492+ window_egl->win_id = fbCreateWindow (window_egl->display, -1, -1, 0, 0);
493+ if (!window_egl->win_id) {
494+ GST_ERROR ("Failed to create window_egl");
495+ return FALSE;
496+ }
497+
498+ fbGetDisplayGeometry (window_egl->display, &window_egl->width, &window_egl->height);
499+ window_egl->req_width = window_egl->width;
500+ window_egl->req_height = window_egl->height;
501+ GST_DEBUG ("Open FB display succesfully, resolution is (%dx%d),display %d, window %d.",
502+ window_egl->width, window_egl->height, window_egl->display, window_egl->win_id);
503+
504+ if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error))
505+ return FALSE;
506+
507+ return TRUE;
508+}
509+static guintptr
510+gst_gl_window_fb_egl_get_window_handle (GstGLWindow * window)
511+{
512+ GST_DEBUG ("fb egl get window: %d", GST_GL_WINDOW_FB_EGL (window)->win_id);
513+ return (guintptr) GST_GL_WINDOW_FB_EGL (window)->win_id;
514+}
515+
516+static void
517+gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
518+ guintptr handle)
519+{
520+}
521+
522+static void
523+draw_cb (gpointer data)
524+{
525+ GstGLWindowFbEGL *window_egl = (GstGLWindowFbEGL *)data;
526+ GstGLWindow *window = GST_GL_WINDOW (window_egl);
527+ GstGLContext *context = gst_gl_window_get_context (window);
528+ GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
529+
530+ /* default full screen */
531+ if (window_egl->default_fullscreen && window->resize) {
532+ window->resize (window->resize_data, window_egl->width, window_egl->height);
533+ window_egl->default_fullscreen = FALSE;
534+ }
535+
536+ if (window->draw)
537+ window->draw (window->draw_data);
538+
539+ GST_DEBUG ("####### draw data");
540+ context_class->swap_buffers (context);
541+
542+ gst_object_unref (context);
543+}
544+
545+static void
546+gst_gl_window_fb_egl_draw (GstGLWindow * window)
547+{
548+ gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
549+}
550+
551+static gboolean
552+_calculate_viewport_coordinates(GstVideoRectangle *req, GstVideoRectangle *result,
553+ guint display_width, guint display_height)
554+{
555+ if(!req || !result || req->w < 1 || req->h < 1)
556+ return FALSE;
557+
558+ result->x = req->x;
559+ result->y = display_height - (req->y + req->h);
560+ result->w = req->w;
561+ result->h = req->h;
562+
563+ return TRUE;
564+}
565+
566+struct SetRenderRectangle
567+{
568+ GstGLWindowFbEGL *window_egl;
569+ GstVideoRectangle rect;
570+};
571+
572+static void
573+_free_set_render_rectangle (struct SetRenderRectangle *render)
574+{
575+ if (render) {
576+ if (render->window_egl)
577+ gst_object_unref (render->window_egl);
578+ g_free (render);
579+ }
580+}
581+
582+static void
583+_set_render_rectangle (gpointer data)
584+{
585+ const GstGLFuncs *gl;
586+ GstGLContext *context;
587+ GstVideoRectangle result, video_rect, tmp_res;
588+ struct SetRenderRectangle *render = data;
589+ GstGLWindow *window = GST_GL_WINDOW (render->window_egl);
590+
591+ context = gst_gl_window_get_context(window);
592+ gl = context->gl_vtable;
593+
594+ GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i",
595+ render->rect.x, render->rect.y, render->rect.w, render->rect.h);
596+
597+ video_rect.x = render->rect.x;
598+ video_rect.y = render->rect.y;
599+ video_rect.w = GST_VIDEO_SINK_WIDTH(window->resize_data);
600+ video_rect.h = GST_VIDEO_SINK_HEIGHT(window->resize_data);
601+
602+ gst_video_sink_center_rect(video_rect, render->rect, &tmp_res, TRUE);
603+
604+ GST_LOG_OBJECT (render->window_egl, "set center render rectangle %i,%i+%ix%i",
605+ tmp_res.x, tmp_res.y, tmp_res.w, tmp_res.h);
606+
607+ /* need to transform screen coordinate to viewport coordinate */
608+ if( _calculate_viewport_coordinates(&tmp_res, &result,
609+ render->window_egl->width, render->window_egl->height)){
610+ GST_LOG_OBJECT (render->window_egl, "viewport render rectangle %i,%i+%ix%i",
611+ result.x, result.y, result.w, result.h);
612+ gl->Viewport(result.x, result.y, result.w, result.h);
613+ }
614+
615+ if(context)
616+ gst_object_unref(context);
617+}
618+
619+static gboolean
620+gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window,
621+ guint x, guint y, guint width, guint height)
622+{
623+ GstGLWindowFbEGL *window_egl = GST_GL_WINDOW_FB_EGL (window);
624+ struct SetRenderRectangle *render;
625+
626+ render = g_new0 (struct SetRenderRectangle, 1);
627+ render->window_egl = gst_object_ref (window_egl);
628+ render->rect.x = x;
629+ render->rect.y = y;
630+ render->rect.w = width;
631+ render->rect.h = height;
632+
633+ gst_gl_window_send_message_async (window,
634+ (GstGLWindowCB) _set_render_rectangle, render,
635+ (GDestroyNotify) _free_set_render_rectangle);
636+ return TRUE;
637+}
638diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
639new file mode 100644
640index 0000000..216e421
641--- /dev/null
642+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
643@@ -0,0 +1,65 @@
644+/*
645+ * GStreamer
646+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
647+ *
648+ * This library is free software; you can redistribute it and/or
649+ * modify it under the terms of the GNU Library General Public
650+ * License as published by the Free Software Foundation; either
651+ * version 2 of the License, or (at your option) any later version.
652+ *
653+ * This library is distributed in the hope that it will be useful,
654+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
655+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
656+ * Library General Public License for more details.
657+ *
658+ * You should have received a copy of the GNU Library General Public
659+ * License along with this library; if not, write to the
660+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
661+ * Boston, MA 02110-1301, USA.
662+ */
663+
664+#ifndef __GST_GL_WINDOW_FB_EGL_H__
665+#define __GST_GL_WINDOW_FB_EGL_H__
666+
667+#include <gst/gl/gl.h>
668+#include "EGL/eglplatform.h"
669+
670+G_BEGIN_DECLS
671+
672+#define GST_GL_TYPE_WINDOW_FB_EGL (gst_gl_window_fb_egl_get_type())
673+#define GST_GL_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL))
674+#define GST_GL_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGLClass))
675+#define GST_GL_IS_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_FB_EGL))
676+#define GST_GL_IS_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_FB_EGL))
677+#define GST_GL_WINDOW_FB_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL_Class))
678+
679+typedef struct _GstGLWindowFbEGL GstGLWindowFbEGL;
680+typedef struct _GstGLWindowFbEGLClass GstGLWindowFbEGLClass;
681+
682+struct _GstGLWindowFbEGL {
683+ /*< private >*/
684+ GstGLWindow parent;
685+
686+ /* <private> */
687+ gint width, req_width;
688+ gint height, req_height;
689+ gboolean default_fullscreen;
690+ EGLNativeDisplayType display;
691+ EGLNativeWindowType win_id;
692+};
693+
694+struct _GstGLWindowFbEGLClass {
695+ /*< private >*/
696+ GstGLWindowClass parent_class;
697+
698+ /*< private >*/
699+ gpointer _reserved[GST_PADDING];
700+};
701+
702+GType gst_gl_window_fb_egl_get_type (void);
703+
704+GstGLWindowFbEGL * gst_gl_window_fb_egl_new (GstGLDisplay * display);
705+
706+G_END_DECLS
707+
708+#endif /* __GST_GL_WINDOW_FB_EGL_H__ */
709diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
710index 5cae2f4..0213d60 100644
711--- a/gst-libs/gst/gl/gstgldisplay.c
712+++ b/gst-libs/gst/gl/gstgldisplay.c
713@@ -205,6 +205,14 @@ gst_gl_display_new (void)
714 if (!display && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
715 display = GST_GL_DISPLAY (gst_gl_display_wayland_new (NULL));
716 #endif
717+#if GST_GL_HAVE_WINDOW_FB
718+ if (!display && (!user_choice || g_strstr_len (user_choice, 2, "fb"))) {
719+ const gchar *fb_name = NULL;
720+ fb_name = g_getenv ("GST_GL_FB");
721+ if (!fb_name) fb_name = "fb0";
722+ display = GST_GL_DISPLAY (gst_gl_display_fb_new (fb_name));
723+ }
724+#endif
725 #if GST_GL_HAVE_PLATFORM_EGL
726 if (!display && (!platform_choice
727 || g_strstr_len (platform_choice, 3, "egl")))
728diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h
729index 7f49a44..c5bc985 100644
730--- a/gst-libs/gst/gl/gstgldisplay.h
731+++ b/gst-libs/gst/gl/gstgldisplay.h
732@@ -60,6 +60,7 @@ typedef enum
733 GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3),
734 GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4),
735 GST_GL_DISPLAY_TYPE_EGL = (1 << 5),
736+ GST_GL_DISPLAY_TYPE_FB = (1 << 6),
737
738 GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32
739 } GstGLDisplayType;
740diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
741index 695f4c4..7b20ff4 100644
742--- a/gst-libs/gst/gl/gstglwindow.c
743+++ b/gst-libs/gst/gl/gstglwindow.c
744@@ -302,6 +302,11 @@ gst_gl_window_new (GstGLDisplay * display)
745 if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl")))
746 window = GST_GL_WINDOW (gst_gl_window_eagl_new (display));
747 #endif
748+#if GST_GL_HAVE_WINDOW_FB
749+ if (!window && (!user_choice || g_strstr_len (user_choice, 2, "fb")))
750+ window = GST_GL_WINDOW (gst_gl_window_fb_egl_new (display));
751+#endif
752+
753 if (!window) {
754 /* subclass returned a NULL window */
755 GST_WARNING ("Could not create window. user specified %s, creating dummy"
756--
7571.9.1
758
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch
deleted file mode 100644
index 43d89060..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch
+++ /dev/null
@@ -1,438 +0,0 @@
1From 94e6bb069cb5207761f2e4234137f2a748f984db Mon Sep 17 00:00:00 2001
2From: Haihua Hu <b55597@freescale.com>
3Date: Tue, 13 Oct 2015 09:33:54 +0800
4Subject: [PATCH 13/18] Add directviv to glimagesink to improve playback
5 performance
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
101.Add a physical buffer uploader in glupload plugin and using viv direct
11 texture to bind physical continious buffer with texture to avoid memory
12 copy from videobuffer to texture to gain good performance.
132.Reduce glimagesink load latency by override glimagesink ALLOCATION query to
14 avoid memory copy.
15
16Upstream-Status: Inappropriate [i.MX specific]
17
18Signed-off-by: Haihua Hu <b55597@freescale.com>
19Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
20---
21 ext/gl/gstglimagesink.c | 5 ++
22 gst-libs/gst/gl/Makefile.am | 2 +
23 gst-libs/gst/gl/gstglupload.c | 141 ++++++++++++++++++++++++++++++-
24 gst-libs/gst/gl/gstglvivdirecttexture.c | 143 ++++++++++++++++++++++++++++++++
25 gst-libs/gst/gl/gstglvivdirecttexture.h | 35 ++++++++
26 5 files changed, 323 insertions(+), 3 deletions(-)
27 create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.c
28 create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.h
29
30diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
31index 3b5e3b5..532ea6a 100644
32--- a/ext/gl/gstglimagesink.c
33+++ b/ext/gl/gstglimagesink.c
34@@ -911,6 +911,11 @@ gst_glimage_sink_query (GstBaseSink * bsink, GstQuery * query)
35 res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
36 break;
37 }
38+ case GST_QUERY_ALLOCATION:
39+ {
40+ gst_glimage_sink_propose_allocation(bsink, query);
41+ break;
42+ }
43 default:
44 res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
45 break;
46diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
47index 4bd6511..c396603 100644
48--- a/gst-libs/gst/gl/Makefile.am
49+++ b/gst-libs/gst/gl/Makefile.am
50@@ -33,6 +33,7 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \
51 gstglviewconvert.c \
52 gstgloverlaycompositor.c \
53 gstglquery.c \
54+ gstglvivdirecttexture.c \
55 gstglcontrolbindingproxy.c
56
57 libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
58@@ -66,6 +67,7 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
59 gstglcontrolbindingproxy.h \
60 gstgl_fwd.h \
61 gstgl_enums.h \
62+ gstglvivdirecttexture.h \
63 gl.h
64
65 noinst_HEADERS = \
66diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
67index 32e6150..99cc68a 100644
68--- a/gst-libs/gst/gl/gstglupload.c
69+++ b/gst-libs/gst/gl/gstglupload.c
70@@ -23,6 +23,7 @@
71 #endif
72
73 #include <stdio.h>
74+#include <gst/gl/gstglvivdirecttexture.h>
75
76 #include "gl.h"
77 #include "gstglupload.h"
78@@ -51,7 +52,7 @@
79 #define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
80 #define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
81
82-GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
83+GST_DEBUG_CATEGORY (gst_gl_upload_debug);
84 #define GST_CAT_DEFAULT gst_gl_upload_debug
85
86 #define DEBUG_INIT \
87@@ -1169,6 +1170,140 @@ static const UploadMethod _upload_meta_upload = {
88 &_upload_meta_upload_free
89 };
90
91+struct PhyBufferUpload
92+{
93+ GstGLUpload *upload;
94+ GstGLVideoAllocationParams *params;
95+};
96+
97+static gpointer
98+_physical_buffer_upload_new(GstGLUpload *upload)
99+{
100+ struct PhyBufferUpload *phybuffer = g_new0 (struct PhyBufferUpload, 1);
101+
102+ phybuffer->upload = upload;
103+
104+ return phybuffer;
105+}
106+
107+static GstCaps *
108+_physical_buffer_upload_transform_caps(GstGLContext *context,
109+ GstPadDirection direction, GstCaps *caps)
110+{
111+ GstCapsFeatures *passthrough =
112+ gst_caps_features_from_string
113+ (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
114+ GstCaps *ret;
115+
116+ if (direction == GST_PAD_SINK) {
117+ GstCaps *tmp;
118+
119+ ret =
120+ _set_caps_features_with_passthrough (caps,
121+ GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
122+
123+ gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
124+ tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D);
125+ gst_caps_unref (ret);
126+ ret = tmp;
127+ } else {
128+ ret = gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
129+ (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY,GST_GL_DIRECTVIV_FORMAT));
130+ }
131+
132+ gst_caps_features_free (passthrough);
133+ return ret;
134+}
135+
136+static gboolean
137+_physical_buffer_upload_accept(gpointer impl, GstBuffer *buffer,
138+ GstCaps *in_caps, GstCaps *out_caps)
139+{
140+ struct PhyBufferUpload *upload = impl;
141+ GstCapsFeatures *features;
142+
143+ features = gst_caps_get_features (out_caps, 0);
144+ if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
145+ return FALSE;
146+
147+ if (upload->params)
148+ gst_gl_allocation_params_free ((GstGLAllocationParams *) upload->params);
149+ if (!(upload->params =
150+ gst_gl_video_allocation_params_new (upload->upload->context, NULL,
151+ &upload->upload->priv->in_info, -1, NULL,
152+ GST_GL_TEXTURE_TARGET_2D)))
153+ return FALSE;
154+
155+ return gst_is_physical_buffer(buffer);
156+}
157+
158+static void
159+_physical_buffer_upload_propose_allocation(gpointer impl, GstQuery *decide_query,
160+ GstQuery *query)
161+{
162+ gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
163+}
164+
165+static GstGLUploadReturn
166+_physical_buffer_upload_perform(gpointer impl, GstBuffer *buffer, GstBuffer **outbuf)
167+{
168+ struct PhyBufferUpload *phyBuffer = impl;
169+ GstGLMemoryAllocator *allocator;
170+ GstVideoInfo *info;
171+ gint n_mem;
172+
173+ info = &phyBuffer->upload->priv->out_info;
174+ n_mem = GST_VIDEO_INFO_N_PLANES (info);
175+ GST_LOG_OBJECT (phyBuffer->upload, "Attempting viv direct upload");
176+
177+ allocator =
178+ GST_GL_MEMORY_ALLOCATOR (gst_allocator_find
179+ (GST_GL_MEMORY_PBO_ALLOCATOR_NAME));
180+
181+ /* FIXME: buffer pool */
182+ *outbuf = gst_buffer_new ();
183+ gst_gl_memory_setup_buffer (allocator, *outbuf, phyBuffer->params);
184+ gst_object_unref (allocator);
185+
186+ GstGLMemory *out_gl_mem =
187+ (GstGLMemory *) gst_buffer_peek_memory (*outbuf, 0);
188+
189+ gst_gl_viv_direct_bind_gstbuffer(phyBuffer->upload->context, out_gl_mem->tex_id,
190+ &phyBuffer->upload->priv->in_info, buffer);
191+
192+ gst_buffer_add_video_meta_full (*outbuf, 0,
193+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
194+ GST_VIDEO_INFO_HEIGHT (info), n_mem, info->offset, info->stride);
195+
196+ return GST_GL_UPLOAD_DONE;
197+}
198+
199+static void
200+_physical_buffer_upload_free(gpointer impl)
201+{
202+ struct PhyBufferUpload *phyBuffer = impl;
203+
204+ if (phyBuffer->params)
205+ gst_gl_allocation_params_free ((GstGLAllocationParams *) phyBuffer->params);
206+
207+ g_free(phyBuffer);
208+}
209+
210+static GstStaticCaps _physical_buffer_upload_caps =
211+GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_DIRECTVIV_FORMAT));
212+
213+static const UploadMethod _physical_buffer_upload = {
214+ "Physical buffer",
215+ 0,
216+ &_physical_buffer_upload_caps,
217+ &_physical_buffer_upload_new,
218+ &_physical_buffer_upload_transform_caps,
219+ &_physical_buffer_upload_accept,
220+ &_physical_buffer_upload_propose_allocation,
221+ &_physical_buffer_upload_perform,
222+ &_physical_buffer_upload_free
223+};
224+
225 struct RawUploadFrame
226 {
227 gint ref_count;
228@@ -1391,7 +1526,7 @@ static const UploadMethod *upload_methods[] = { &_gl_memory_upload,
229 #if GST_GL_HAVE_DMABUF
230 &_dma_buf_upload,
231 #endif
232- &_upload_meta_upload, &_raw_data_upload
233+ &_upload_meta_upload, &_physical_buffer_upload, &_raw_data_upload
234 };
235
236 static GMutex upload_global_lock;
237@@ -1514,7 +1649,7 @@ gst_gl_upload_transform_caps (GstGLContext * context, GstPadDirection direction,
238 }
239
240 if (filter) {
241- result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
242+ result = gst_caps_intersect_full (tmp, filter, GST_CAPS_INTERSECT_FIRST);
243 gst_caps_unref (tmp);
244 } else {
245 result = tmp;
246diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
247new file mode 100644
248index 0000000..c19b617
249--- /dev/null
250+++ b/gst-libs/gst/gl/gstglvivdirecttexture.c
251@@ -0,0 +1,143 @@
252+/*
253+ * GStreamer
254+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
255+ *
256+ * This library is free software; you can redistribute it and/or
257+ * modify it under the terms of the GNU Library General Public
258+ * License as published by the Free Software Foundation; either
259+ * version 2 of the License, or (at your option) any later version.
260+ *
261+ * This library is distributed in the hope that it will be useful,
262+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
263+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
264+ * Library General Public License for more details.
265+ *
266+ * You should have received a copy of the GNU Library General Public
267+ * License along with this library; if not, write to the
268+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
269+ * Boston, MA 02110-1301, USA.
270+ */
271+
272+#ifdef HAVE_CONFIG_H
273+#include "config.h"
274+#endif
275+
276+#include "gl.h"
277+
278+GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug);
279+#define GST_CAT_DEFAULT gst_gl_upload_debug
280+
281+typedef struct {
282+ guint tex_id;
283+ guint w;
284+ guint h;
285+ guint fmt;
286+ void *vaddr;
287+ guint paddr;
288+ gboolean ret;
289+} GstVivDirectTexture;
290+
291+gboolean
292+gst_is_physical_buffer (GstBuffer *buffer)
293+{
294+
295+ GstMemory *mem;
296+
297+ mem = gst_buffer_peek_memory (buffer, 0);
298+ if (!mem->allocator)
299+ return FALSE;
300+
301+ return g_type_check_instance_is_a (mem->allocator, g_type_from_name("GstAllocatorPhyMem"));
302+}
303+
304+static void
305+_do_viv_direct_tex_bind_mem (GstGLContext * context, GstVivDirectTexture * viv_tex)
306+{
307+ GST_DEBUG ("viv direct upload, tex_id %d, fmt: %d, res: (%dx%d)", viv_tex->tex_id, viv_tex->fmt, viv_tex->w, viv_tex->h);
308+ GST_DEBUG ("Physical memory buffer, vaddr: %p, paddr: %p", viv_tex->vaddr, viv_tex->paddr);
309+
310+ glBindTexture (GL_TEXTURE_2D, viv_tex->tex_id);
311+ glTexDirectVIVMap (GL_TEXTURE_2D, viv_tex->w, viv_tex->h, viv_tex->fmt, &viv_tex->vaddr, &viv_tex->paddr);
312+ glTexDirectInvalidateVIV (GL_TEXTURE_2D);
313+ viv_tex->ret = TRUE;
314+
315+ return;
316+}
317+
318+gboolean
319+gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer)
320+{
321+ typedef struct {
322+ guint8 *vaddr;
323+ guint8 *paddr;
324+ guint8 *caddr;
325+ gsize size;
326+ gpointer *user_data;
327+ } PhyMemBlock;
328+ //Note: structure PhyMemBlock is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.h
329+
330+ typedef struct {
331+ GstMemory mem;
332+ guint8 *vaddr;
333+ guint8 *paddr;
334+ PhyMemBlock block;
335+ } GstMemoryPhy;
336+ //Note: structure GstMemoryPhy is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.c
337+
338+ GstMemory *mem = gst_buffer_peek_memory (buffer, 0);
339+ GstMemoryPhy *memphy = (GstMemoryPhy*) mem;
340+ PhyMemBlock *memblk = &memphy->block;
341+
342+ GstVideoFormat fmt = GST_VIDEO_INFO_FORMAT (info);
343+ gint width, height;
344+ GstVideoMeta *vmeta = gst_buffer_get_video_meta (buffer);
345+ if (vmeta && (fmt == GST_VIDEO_FORMAT_I420 || fmt == GST_VIDEO_FORMAT_NV12)) {
346+ width = vmeta->stride[0];
347+ height = vmeta->offset[1] / width;
348+ }
349+ else {
350+ width = GST_VIDEO_INFO_WIDTH (info);
351+ height = GST_VIDEO_INFO_HEIGHT (info);
352+ }
353+
354+ guint viv_fmt;
355+ switch (fmt) {
356+ case GST_VIDEO_FORMAT_I420:
357+ viv_fmt = GL_VIV_I420;
358+ break;
359+ case GST_VIDEO_FORMAT_YV12:
360+ viv_fmt = GL_VIV_YV12;
361+ break;
362+ case GST_VIDEO_FORMAT_NV12:
363+ viv_fmt = GL_VIV_NV12;
364+ break;
365+ case GST_VIDEO_FORMAT_NV21:
366+ viv_fmt = GL_VIV_NV21;
367+ break;
368+ case GST_VIDEO_FORMAT_YUY2:
369+ viv_fmt = GL_VIV_YUY2;
370+ break;
371+ case GST_VIDEO_FORMAT_UYVY:
372+ viv_fmt = GL_VIV_UYVY;
373+ break;
374+ case GST_VIDEO_FORMAT_RGBA:
375+ viv_fmt = GL_RGBA;
376+ break;
377+ case GST_VIDEO_FORMAT_BGRA:
378+ viv_fmt = GL_BGRA_EXT;
379+ break;
380+ case GST_VIDEO_FORMAT_RGB16:
381+ viv_fmt = GL_RGB565_OES;
382+ break;
383+ default:
384+ GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt);
385+ viv_fmt = GL_NONE;
386+ return FALSE;
387+ }
388+
389+ GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, memblk->vaddr, memblk->paddr, FALSE};
390+ gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex);
391+
392+ return viv_tex.ret;
393+}
394+
395diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.h b/gst-libs/gst/gl/gstglvivdirecttexture.h
396new file mode 100644
397index 0000000..fa88e1a
398--- /dev/null
399+++ b/gst-libs/gst/gl/gstglvivdirecttexture.h
400@@ -0,0 +1,35 @@
401+/*
402+ * GStreamer
403+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
404+ *
405+ * This library is free software; you can redistribute it and/or
406+ * modify it under the terms of the GNU Library General Public
407+ * License as published by the Free Software Foundation; either
408+ * version 2 of the License, or (at your option) any later version.
409+ *
410+ * This library is distributed in the hope that it will be useful,
411+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
412+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
413+ * Library General Public License for more details.
414+ *
415+ * You should have received a copy of the GNU Library General Public
416+ * License along with this library; if not, write to the
417+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
418+ * Boston, MA 02110-1301, USA.
419+ */
420+
421+#ifndef __GST_GL_VIVDIRECT_H__
422+#define __GST_GL_VIVDIRECT_H__
423+
424+#include <gst/video/video.h>
425+#include <gst/gl/gstgl_fwd.h>
426+
427+#define GST_GL_DIRECTVIV_FORMAT "{RGBA, I420, YV12, NV12, NV21, YUY2, UYVY, BGRA, RGB16}"
428+G_BEGIN_DECLS
429+
430+gboolean gst_is_physical_buffer (GstBuffer *buffer);
431+gboolean gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer);
432+
433+G_END_DECLS
434+
435+#endif /* __GST_GL_VIVDIRECT_H__ */
436--
4371.9.1
438
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch
deleted file mode 100644
index 1cead36d..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch
+++ /dev/null
@@ -1,729 +0,0 @@
1From 05bbd82dd527afa44d6b403b02a0dbd198c96859 Mon Sep 17 00:00:00 2001
2From: Jian Li <jian.li@freescale.com>
3Date: Fri, 6 Nov 2015 15:00:19 +0800
4Subject: [PATCH 14/18] MMFMWK-6930 [glplugin] Accelerate gldownload with
5 directviv API
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
101) Propose a physical buffer pool to upstream in gldownload
112) Bind the physical buffer with texture via dirctviv
123) In gldownload, wrap the physical buffer to gstbuffer, pass to
13 downstream plugins.
14
15Upstream-Status: Inappropriate [i.MX specific]
16
17Signed-off-by: Jian Li <jian.li@freescale.com>
18Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
19---
20 ext/gl/gstgldownloadelement.c | 91 ++++++++++++
21 gst-libs/gst/gl/Makefile.am | 4 +
22 gst-libs/gst/gl/gstglbufferpool.c | 12 ++
23 gst-libs/gst/gl/gstglphymemory.c | 254 ++++++++++++++++++++++++++++++++
24 gst-libs/gst/gl/gstglphymemory.h | 43 ++++++
25 gst-libs/gst/gl/gstglvivdirecttexture.c | 147 +++++++++---------
26 gst-libs/gst/gl/gstglvivdirecttexture.h | 3 +
27 7 files changed, 484 insertions(+), 70 deletions(-)
28 create mode 100644 gst-libs/gst/gl/gstglphymemory.c
29 create mode 100644 gst-libs/gst/gl/gstglphymemory.h
30
31diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c
32index ff931fa..9ea0146 100644
33--- a/ext/gl/gstgldownloadelement.c
34+++ b/ext/gl/gstgldownloadelement.c
35@@ -23,6 +23,7 @@
36 #endif
37
38 #include <gst/gl/gl.h>
39+#include <gst/gl/gstglphymemory.h>
40 #include "gstgldownloadelement.h"
41
42 GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug);
43@@ -45,6 +46,8 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
44 GstBuffer * buffer, GstBuffer ** outbuf);
45 static GstFlowReturn gst_gl_download_element_transform (GstBaseTransform * bt,
46 GstBuffer * buffer, GstBuffer * outbuf);
47+static gboolean gst_gl_download_element_propose_allocation (GstBaseTransform *
48+ bt, GstQuery * decide_query, GstQuery * query);
49
50 static GstStaticPadTemplate gst_gl_download_element_src_pad_template =
51 GST_STATIC_PAD_TEMPLATE ("src",
52@@ -70,6 +73,7 @@ gst_gl_download_element_class_init (GstGLDownloadElementClass * klass)
53 bt_class->prepare_output_buffer =
54 gst_gl_download_element_prepare_output_buffer;
55 bt_class->transform = gst_gl_download_element_transform;
56+ bt_class->propose_allocation = gst_gl_download_element_propose_allocation;
57
58 bt_class->passthrough_on_same_caps = TRUE;
59
60@@ -160,9 +164,24 @@ static GstFlowReturn
61 gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
62 GstBuffer * inbuf, GstBuffer ** outbuf)
63 {
64+ GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt);
65 GstCaps *src_caps = gst_pad_get_current_caps (bt->srcpad);
66 GstCapsFeatures *features = NULL;
67 gint i, n;
68+ GstGLMemory *glmem;
69+
70+ glmem = gst_buffer_peek_memory (inbuf, 0);
71+ if (gst_is_gl_physical_memory (glmem)) {
72+ GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
73+ GstVideoInfo info;
74+
75+ gst_video_info_from_caps (&info, src_caps);
76+ *outbuf = gst_gl_phymem_buffer_to_gstbuffer (context, &info, inbuf);
77+
78+ GST_DEBUG_OBJECT (download, "gl download with direct viv.");
79+
80+ return GST_FLOW_OK;
81+ }
82
83 *outbuf = inbuf;
84
85@@ -194,3 +213,75 @@ gst_gl_download_element_transform (GstBaseTransform * bt,
86 {
87 return GST_FLOW_OK;
88 }
89+
90+static gboolean
91+gst_gl_download_element_propose_allocation (GstBaseTransform * bt,
92+ GstQuery * decide_query, GstQuery * query)
93+{
94+ GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
95+ GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt);
96+ GstAllocationParams params;
97+ GstAllocator *allocator = NULL;
98+ GstBufferPool *pool = NULL;
99+ guint n_pools, i;
100+ GstVideoInfo info;
101+ GstCaps *caps;
102+ GstStructure *config;
103+ gsize size;
104+
105+ gst_query_parse_allocation (query, &caps, NULL);
106+ if (!gst_video_info_from_caps (&info, caps)) {
107+ GST_WARNING_OBJECT (bt, "invalid caps specified");
108+ return FALSE;
109+ }
110+
111+ GST_DEBUG_OBJECT (bt, "video format is %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&info)));
112+
113+ gst_allocation_params_init (&params);
114+ if (gst_is_gl_physical_memory_supported_fmt (&info)) {
115+ allocator = gst_phy_mem_allocator_obtain ();
116+ GST_DEBUG_OBJECT (bt, "obtain physical memory allocator %p.", allocator);
117+ }
118+
119+ if (!allocator)
120+ allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
121+
122+ if (!allocator) {
123+ GST_ERROR_OBJECT (bt, "Can't obtain physical memory allocator.");
124+ return FALSE;
125+ }
126+
127+ gst_query_add_allocation_param (query, allocator, &params);
128+ gst_object_unref (allocator);
129+
130+ n_pools = gst_query_get_n_allocation_pools (query);
131+ for (i = 0; i < n_pools; i++) {
132+ gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL);
133+ gst_object_unref (pool);
134+ pool = NULL;
135+ }
136+
137+ //new buffer pool
138+ pool = gst_gl_buffer_pool_new (context);
139+ config = gst_buffer_pool_get_config (pool);
140+
141+ /* the normal size of a frame */
142+ size = info.size;
143+ gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
144+ gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_GL_SYNC_META);
145+
146+ if (!gst_buffer_pool_set_config (pool, config)) {
147+ gst_object_unref (pool);
148+ GST_WARNING_OBJECT (bt, "failed setting config");
149+ return FALSE;
150+ }
151+
152+ GST_DEBUG_OBJECT (download, "create pool %p", pool);
153+
154+ //propose 3 buffers for better performance
155+ gst_query_add_allocation_pool (query, pool, size, 3, 0);
156+
157+ gst_object_unref (pool);
158+
159+ return TRUE;
160+}
161diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
162index c396603..5c05230 100644
163--- a/gst-libs/gst/gl/Makefile.am
164+++ b/gst-libs/gst/gl/Makefile.am
165@@ -34,6 +34,7 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \
166 gstgloverlaycompositor.c \
167 gstglquery.c \
168 gstglvivdirecttexture.c \
169+ gstglphymemory.c \
170 gstglcontrolbindingproxy.c
171
172 libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
173@@ -68,6 +69,7 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
174 gstgl_fwd.h \
175 gstgl_enums.h \
176 gstglvivdirecttexture.h \
177+ gstglphymemory.h \
178 gl.h
179
180 noinst_HEADERS = \
181@@ -84,6 +86,8 @@ libgstgl_@GST_API_VERSION@_la_LIBADD = \
182 $(GST_LIBS) \
183 $(GL_LIBS)
184
185+libgstgl_@GST_API_VERSION@_la_LIBADD += -lgstfsl-$(GST_API_VERSION)
186+
187 if HAVE_WINDOW_WIN32
188 SUBDIRS += win32
189 libgstgl_@GST_API_VERSION@_la_LIBADD += win32/libgstgl-win32.la
190diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c
191index 90536b0..71c726a 100644
192--- a/gst-libs/gst/gl/gstglbufferpool.c
193+++ b/gst-libs/gst/gl/gstglbufferpool.c
194@@ -30,6 +30,8 @@
195 #include <gst/gl/egl/gsteglimagememory.h>
196 #endif
197
198+#include <gst/gl/gstglphymemory.h>
199+
200 /**
201 * SECTION:gstglbufferpool
202 * @short_description: buffer pool for #GstGLMemory objects
203@@ -290,6 +292,16 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
204 }
205 #endif
206
207+ if ((g_strcmp0 (priv->allocator->mem_type, GST_GL_PHY_MEM_ALLOCATOR) == 0)) {
208+ GstAllocator* allocator = (GstAllocator*) gst_phy_mem_allocator_obtain ();
209+ if (!gst_gl_physical_memory_setup_buffer (allocator, buf, priv->gl_params)) {
210+ GST_ERROR_OBJECT (pool, "Can't create physcial buffer.");
211+ return GST_FLOW_ERROR;
212+ }
213+ *buffer = buf;
214+ return GST_FLOW_OK;
215+ }
216+
217 alloc = GST_GL_MEMORY_ALLOCATOR (priv->allocator);
218 if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params))
219 goto mem_create_failed;
220diff --git a/gst-libs/gst/gl/gstglphymemory.c b/gst-libs/gst/gl/gstglphymemory.c
221new file mode 100644
222index 0000000..52ae41f
223--- /dev/null
224+++ b/gst-libs/gst/gl/gstglphymemory.c
225@@ -0,0 +1,254 @@
226+/*
227+ * GStreamer
228+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
229+ *
230+ * This library is free software; you can redistribute it and/or
231+ * modify it under the terms of the GNU Library General Public
232+ * License as published by the Free Software Foundation; either
233+ * version 2 of the License, or (at your option) any later version.
234+ *
235+ * This library is distributed in the hope that it will be useful,
236+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
237+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
238+ * Library General Public License for more details.
239+ *
240+ * You should have received a copy of the GNU Library General Public
241+ * License along with this library; if not, write to the
242+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
243+ * Boston, MA 02110-1301, USA.
244+ */
245+
246+#ifdef HAVE_CONFIG_H
247+#include "config.h"
248+#endif
249+
250+#include "gstglvivdirecttexture.h"
251+#include "gstglphymemory.h"
252+#include "g2d.h"
253+
254+GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_PHY_MEMORY);
255+#define GST_CAT_DEFAULT GST_CAT_GL_PHY_MEMORY
256+
257+typedef struct _GstPhyMemAllocator GstPhyMemAllocator;
258+typedef struct _GstPhyMemAllocatorClass GstPhyMemAllocatorClass;
259+
260+struct _GstPhyMemAllocator
261+{
262+ GstAllocatorPhyMem parent;
263+};
264+
265+struct _GstPhyMemAllocatorClass
266+{
267+ GstAllocatorPhyMemClass parent_class;
268+};
269+
270+GType gst_phy_mem_allocator_get_type (void);
271+G_DEFINE_TYPE (GstPhyMemAllocator, gst_phy_mem_allocator, GST_TYPE_ALLOCATOR_PHYMEM);
272+
273+static int
274+alloc_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk)
275+{
276+ struct g2d_buf *pbuf = NULL;
277+
278+ memblk->size = PAGE_ALIGN(memblk->size);
279+
280+ pbuf = g2d_alloc (memblk->size, 0);
281+ if (!pbuf) {
282+ GST_ERROR("G2D allocate %u bytes memory failed: %s",
283+ memblk->size, strerror(errno));
284+ return -1;
285+ }
286+
287+ memblk->vaddr = (guchar*) pbuf->buf_vaddr;
288+ memblk->paddr = (guchar*) pbuf->buf_paddr;
289+ memblk->user_data = (gpointer) pbuf;
290+ GST_DEBUG("G2D allocated memory (%p)", memblk->paddr);
291+
292+ return 1;
293+}
294+
295+static int
296+free_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk)
297+{
298+ GST_DEBUG("G2D free memory (%p)", memblk->paddr);
299+ gint ret = g2d_free ((struct g2d_buf*)(memblk->user_data));
300+ memblk->user_data = NULL;
301+ memblk->vaddr = NULL;
302+ memblk->paddr = NULL;
303+ memblk->size = 0;
304+
305+ return ret;
306+}
307+
308+static void
309+gst_phy_mem_allocator_class_init (GstPhyMemAllocatorClass * klass)
310+{
311+ GstAllocatorPhyMemClass *phy_allocator_klass = (GstAllocatorPhyMemClass *) klass;
312+
313+ phy_allocator_klass->alloc_phymem = alloc_phymem;
314+ phy_allocator_klass->free_phymem = free_phymem;
315+}
316+
317+static void
318+gst_phy_mem_allocator_init (GstPhyMemAllocator * allocator)
319+{
320+ GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
321+
322+ alloc->mem_type = GST_GL_PHY_MEM_ALLOCATOR;
323+}
324+
325+
326+static gpointer
327+gst_phy_mem_allocator_init_instance (gpointer data)
328+{
329+ GstAllocator *allocator =
330+ g_object_new (gst_phy_mem_allocator_get_type (), NULL);
331+
332+ GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_PHY_MEMORY, "glphymemory", 0,
333+ "GLPhysical Memory");
334+
335+ gst_allocator_register (GST_GL_PHY_MEM_ALLOCATOR, gst_object_ref (allocator));
336+
337+ return allocator;
338+}
339+
340+static void
341+_finish_texture (GstGLContext * ctx, gpointer *data)
342+{
343+ GstGLFuncs *gl = ctx->gl_vtable;
344+
345+ gl->Finish ();
346+}
347+
348+static void
349+gst_gl_phy_mem_destroy (GstMemory *mem)
350+{
351+ gst_memory_unref (mem);
352+}
353+
354+
355+GstAllocator *
356+gst_phy_mem_allocator_obtain (void)
357+{
358+ static GOnce once = G_ONCE_INIT;
359+
360+ g_once (&once, gst_phy_mem_allocator_init_instance, NULL);
361+
362+ g_return_val_if_fail (once.retval != NULL, NULL);
363+
364+ return (GstAllocator *) (g_object_ref (once.retval));
365+}
366+
367+gboolean
368+gst_is_gl_physical_memory (GstMemory * mem)
369+{
370+ GstGLBaseMemory *glmem;
371+ g_return_val_if_fail (gst_is_gl_memory (mem), FALSE);
372+
373+ glmem = (GstGLBaseMemory*) mem;
374+
375+ if (glmem->user_data
376+ && GST_IS_MINI_OBJECT_TYPE(glmem->user_data, GST_TYPE_MEMORY))
377+ return gst_memory_is_type ((GstMemory*)glmem->user_data, GST_GL_PHY_MEM_ALLOCATOR);
378+ else
379+ return FALSE;
380+}
381+
382+gboolean
383+gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info)
384+{
385+ if (GST_VIDEO_INFO_IS_RGB(info)
386+ && gst_gl_is_directviv_supported_format (GST_VIDEO_INFO_FORMAT (info))) {
387+ return TRUE;
388+ }
389+ else
390+ return FALSE;
391+}
392+
393+gboolean
394+gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer,
395+ GstGLVideoAllocationParams * params)
396+{
397+ GstGLBaseMemoryAllocator *gl_alloc;
398+ GstMemory *mem = NULL;
399+ PhyMemBlock *memblk = NULL;
400+ GstGLMemory *glmem = NULL;
401+ gsize size;
402+
403+ GstVideoInfo * info = params->v_info;
404+ GstVideoAlignment * valign = params->valign;
405+
406+ GST_DEBUG ("glphymemory setup buffer format %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (info)));
407+
408+ if (!gst_is_gl_physical_memory_supported_fmt (info)) {
409+ GST_DEBUG ("Not support format.");
410+ return FALSE;
411+ }
412+
413+ //allocator = (GstAllocator*) gst_phy_mem_allocator_obtain ();
414+ size = gst_gl_get_plane_data_size (info, valign, 0);
415+ mem = gst_allocator_alloc (allocator, size, params->parent.alloc_params);
416+ if (!mem) {
417+ GST_DEBUG ("Can't allocate physical memory size %d", size);
418+ return FALSE;
419+ }
420+
421+ memblk = gst_memory_query_phymem_block (mem);
422+ if (!memblk) {
423+ GST_ERROR("Can't find physic memory block.");
424+ return FALSE;
425+ }
426+
427+ gl_alloc =
428+ GST_GL_BASE_MEMORY_ALLOCATOR (gst_gl_memory_allocator_get_default
429+ (params->parent.context));
430+
431+ params->plane = 0;
432+ params->parent.user_data = mem;
433+ params->parent.notify = gst_gl_phy_mem_destroy;
434+
435+ glmem = (GstGLMemory *)gst_gl_base_memory_alloc (gl_alloc, (GstGLAllocationParams *) params);
436+ if (!glmem) {
437+ GST_ERROR("Can't get gl memory.");
438+ return FALSE;
439+ }
440+
441+ gst_buffer_append_memory (buffer, (GstMemory *) glmem);
442+
443+ gst_buffer_add_video_meta_full (buffer, 0,
444+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
445+ GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride);
446+
447+ gst_gl_viv_direct_bind_data(params->parent.context, glmem->tex_id,
448+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
449+ GST_VIDEO_INFO_HEIGHT (info), memblk->vaddr, memblk->paddr);
450+
451+ return TRUE;
452+}
453+
454+GstBuffer *
455+gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx,
456+ GstVideoInfo * info, GstBuffer *glbuf)
457+{
458+ GstBuffer *buf;
459+ GstGLBaseMemory *glmem;
460+
461+ gst_gl_context_thread_add (ctx, (GstGLContextThreadFunc) _finish_texture, NULL);
462+
463+ glmem = gst_buffer_peek_memory (glbuf, 0);
464+
465+ buf = gst_buffer_new ();
466+ gst_buffer_append_memory (buf, (GstMemory *) glmem->user_data);
467+ gst_memory_ref ((GstMemory *)glmem->user_data);
468+
469+ gst_buffer_add_video_meta_full (buf, 0,
470+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
471+ GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride);
472+ GST_BUFFER_FLAGS (buf) = GST_BUFFER_FLAGS (glbuf);
473+ GST_BUFFER_PTS (buf) = GST_BUFFER_PTS (glbuf);
474+ GST_BUFFER_DTS (buf) = GST_BUFFER_DTS (glbuf);
475+ GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (glbuf);
476+
477+ return buf;
478+}
479+
480diff --git a/gst-libs/gst/gl/gstglphymemory.h b/gst-libs/gst/gl/gstglphymemory.h
481new file mode 100644
482index 0000000..b1a69e7
483--- /dev/null
484+++ b/gst-libs/gst/gl/gstglphymemory.h
485@@ -0,0 +1,43 @@
486+/*
487+ * GStreamer
488+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
489+ *
490+ * This library is free software; you can redistribute it and/or
491+ * modify it under the terms of the GNU Library General Public
492+ * License as published by the Free Software Foundation; either
493+ * version 2 of the License, or (at your option) any later version.
494+ *
495+ * This library is distributed in the hope that it will be useful,
496+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
497+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
498+ * Library General Public License for more details.
499+ *
500+ * You should have received a copy of the GNU Library General Public
501+ * License along with this library; if not, write to the
502+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
503+ * Boston, MA 02110-1301, USA.
504+ */
505+
506+#ifndef _GST_GL_PHY_MEMORY_H_
507+#define _GST_GL_PHY_MEMORY_H_
508+
509+#include <gst/gst.h>
510+#include <gst/gstmemory.h>
511+#include <gst/video/video.h>
512+#include <gst/imx-mm/gstallocatorphymem.h>
513+
514+#include <gst/gl/gl.h>
515+
516+G_BEGIN_DECLS
517+
518+#define GST_GL_PHY_MEM_ALLOCATOR "GLPhyMemory"
519+
520+GstAllocator *gst_phy_mem_allocator_obtain (void);
521+gboolean gst_is_gl_physical_memory (GstMemory * mem);
522+gboolean gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info);
523+gboolean gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer, GstGLVideoAllocationParams * params);
524+GstBuffer * gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx, GstVideoInfo * info, GstBuffer *glbuf);
525+
526+G_END_DECLS
527+
528+#endif /* _GST_GL_PHY_MEMORY_H_ */
529diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
530index c19b617..e8e0b82 100644
531--- a/gst-libs/gst/gl/gstglvivdirecttexture.c
532+++ b/gst-libs/gst/gl/gstglvivdirecttexture.c
533@@ -22,6 +22,7 @@
534 #include "config.h"
535 #endif
536
537+#include <gst/imx-mm/gstallocatorphymem.h>
538 #include "gl.h"
539
540 GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug);
541@@ -37,17 +38,28 @@ typedef struct {
542 gboolean ret;
543 } GstVivDirectTexture;
544
545+typedef struct {
546+ GstVideoFormat gst_fmt;
547+ guint viv_fmt;
548+} VIV_FMT_MAP;
549+
550+static VIV_FMT_MAP viv_fmt_map_table[] = {
551+ {GST_VIDEO_FORMAT_I420, GL_VIV_I420},
552+ {GST_VIDEO_FORMAT_YV12, GL_VIV_YV12},
553+ {GST_VIDEO_FORMAT_NV12, GL_VIV_NV12},
554+ {GST_VIDEO_FORMAT_NV21, GL_VIV_NV21},
555+ {GST_VIDEO_FORMAT_YUY2, GL_VIV_YUY2},
556+ {GST_VIDEO_FORMAT_UYVY, GL_VIV_UYVY},
557+ {GST_VIDEO_FORMAT_RGBA, GL_RGBA},
558+ {GST_VIDEO_FORMAT_RGBx, GL_RGBA},
559+ {GST_VIDEO_FORMAT_BGRA, GL_BGRA_EXT},
560+ {GST_VIDEO_FORMAT_RGB16, GL_RGB565_OES}
561+};
562+
563 gboolean
564 gst_is_physical_buffer (GstBuffer *buffer)
565 {
566-
567- GstMemory *mem;
568-
569- mem = gst_buffer_peek_memory (buffer, 0);
570- if (!mem->allocator)
571- return FALSE;
572-
573- return g_type_check_instance_is_a (mem->allocator, g_type_from_name("GstAllocatorPhyMem"));
574+ return gst_buffer_is_phymem (buffer);
575 }
576
577 static void
578@@ -65,32 +77,64 @@ _do_viv_direct_tex_bind_mem (GstGLContext * context, GstVivDirectTexture * viv_t
579 }
580
581 gboolean
582+gst_gl_is_directviv_supported_format (GstVideoFormat fmt)
583+{
584+ gint i;
585+ gboolean ret = FALSE;
586+
587+ for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) {
588+ if (fmt == viv_fmt_map_table[i].gst_fmt) {
589+ ret = TRUE;
590+ break;
591+ }
592+ }
593+
594+ return ret;
595+}
596+
597+gboolean
598+gst_gl_viv_direct_bind_data (GstGLContext * context,
599+ guint tex_id, GstVideoFormat fmt, gint width, gint height,
600+ gpointer * vaddr, gpointer *paddr)
601+{
602+ guint viv_fmt = GL_NONE;
603+ gint i;
604+
605+ for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) {
606+ if (fmt == viv_fmt_map_table[i].gst_fmt) {
607+ viv_fmt = viv_fmt_map_table[i].viv_fmt;
608+ break;
609+ }
610+ }
611+
612+ if (viv_fmt == GL_NONE) {
613+ GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt);
614+ return FALSE;
615+ }
616+
617+ GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, vaddr, paddr, FALSE};
618+ gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex);
619+
620+ return viv_tex.ret;
621+}
622+
623+gboolean
624 gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer)
625 {
626- typedef struct {
627- guint8 *vaddr;
628- guint8 *paddr;
629- guint8 *caddr;
630- gsize size;
631- gpointer *user_data;
632- } PhyMemBlock;
633- //Note: structure PhyMemBlock is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.h
634-
635- typedef struct {
636- GstMemory mem;
637- guint8 *vaddr;
638- guint8 *paddr;
639- PhyMemBlock block;
640- } GstMemoryPhy;
641- //Note: structure GstMemoryPhy is copied from gst1.0-fsl-plugin/libs/allocator/gstallocatorphymem.c
642-
643- GstMemory *mem = gst_buffer_peek_memory (buffer, 0);
644- GstMemoryPhy *memphy = (GstMemoryPhy*) mem;
645- PhyMemBlock *memblk = &memphy->block;
646-
647- GstVideoFormat fmt = GST_VIDEO_INFO_FORMAT (info);
648+ PhyMemBlock *memblk;
649+ GstVideoMeta *vmeta;
650+ GstVideoFormat fmt;
651 gint width, height;
652- GstVideoMeta *vmeta = gst_buffer_get_video_meta (buffer);
653+
654+ memblk = gst_buffer_query_phymem_block (buffer);
655+ if (!memblk)
656+ return FALSE;
657+
658+ width = GST_VIDEO_INFO_WIDTH (info);
659+ height = GST_VIDEO_INFO_HEIGHT (info);
660+
661+ vmeta = gst_buffer_get_video_meta (buffer);
662+ fmt = GST_VIDEO_INFO_FORMAT (info);
663 if (vmeta && (fmt == GST_VIDEO_FORMAT_I420 || fmt == GST_VIDEO_FORMAT_NV12)) {
664 width = vmeta->stride[0];
665 height = vmeta->offset[1] / width;
666@@ -100,44 +144,7 @@ gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideo
667 height = GST_VIDEO_INFO_HEIGHT (info);
668 }
669
670- guint viv_fmt;
671- switch (fmt) {
672- case GST_VIDEO_FORMAT_I420:
673- viv_fmt = GL_VIV_I420;
674- break;
675- case GST_VIDEO_FORMAT_YV12:
676- viv_fmt = GL_VIV_YV12;
677- break;
678- case GST_VIDEO_FORMAT_NV12:
679- viv_fmt = GL_VIV_NV12;
680- break;
681- case GST_VIDEO_FORMAT_NV21:
682- viv_fmt = GL_VIV_NV21;
683- break;
684- case GST_VIDEO_FORMAT_YUY2:
685- viv_fmt = GL_VIV_YUY2;
686- break;
687- case GST_VIDEO_FORMAT_UYVY:
688- viv_fmt = GL_VIV_UYVY;
689- break;
690- case GST_VIDEO_FORMAT_RGBA:
691- viv_fmt = GL_RGBA;
692- break;
693- case GST_VIDEO_FORMAT_BGRA:
694- viv_fmt = GL_BGRA_EXT;
695- break;
696- case GST_VIDEO_FORMAT_RGB16:
697- viv_fmt = GL_RGB565_OES;
698- break;
699- default:
700- GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt);
701- viv_fmt = GL_NONE;
702- return FALSE;
703- }
704-
705- GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, memblk->vaddr, memblk->paddr, FALSE};
706- gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex);
707-
708- return viv_tex.ret;
709+ return gst_gl_viv_direct_bind_data (context, tex_id, fmt, width, height, memblk->vaddr, memblk->paddr);
710 }
711
712+
713diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.h b/gst-libs/gst/gl/gstglvivdirecttexture.h
714index fa88e1a..9a2d123 100644
715--- a/gst-libs/gst/gl/gstglvivdirecttexture.h
716+++ b/gst-libs/gst/gl/gstglvivdirecttexture.h
717@@ -28,6 +28,9 @@
718 G_BEGIN_DECLS
719
720 gboolean gst_is_physical_buffer (GstBuffer *buffer);
721+gboolean gst_gl_is_directviv_supported_format (GstVideoFormat fmt);
722+gboolean gst_gl_viv_direct_bind_data (GstGLContext * context, guint tex_id, GstVideoFormat fmt, gint width, gint height,
723+ gpointer * vaddr, gpointer *paddr);
724 gboolean gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer);
725
726 G_END_DECLS
727--
7281.9.1
729
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-Fix-dependence-issue-between-gst-plugin-.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-Fix-dependence-issue-between-gst-plugin-.patch
deleted file mode 100755
index 44633cf9..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-Fix-dependence-issue-between-gst-plugin-.patch
+++ /dev/null
@@ -1,74 +0,0 @@
1From 4f73ba8dde190b0e2d3a7a16b394762f7459ca31 Mon Sep 17 00:00:00 2001
2From: Haihua Hu <jared.hu@nxp.com>
3Date: Fri, 5 Aug 2016 17:04:02 +0800
4Subject: [PATCH] [MMFMWK-7259]Fix dependence issue between gst-plugin-bad and
5 imx-gst1.0-plugin
6
7Change dependence to gst-plugin-base since we have move physical memory allocator
8to gst-plugin-base
9
10Upstream-Status: Inappropriate [i.MX specific]
11
12Signed-off-by: Haihua Hu <jared.hu@nxp.com>
13---
14 gst-libs/gst/gl/Makefile.am | 2 +-
15 gst-libs/gst/gl/gstglphymemory.c | 2 +-
16 gst-libs/gst/gl/gstglphymemory.h | 2 +-
17 gst-libs/gst/gl/gstglvivdirecttexture.c | 2 +-
18 4 files changed, 4 insertions(+), 4 deletions(-)
19
20diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
21index 5c05230..55f8a20 100644
22--- a/gst-libs/gst/gl/Makefile.am
23+++ b/gst-libs/gst/gl/Makefile.am
24@@ -86,7 +86,7 @@ libgstgl_@GST_API_VERSION@_la_LIBADD = \
25 $(GST_LIBS) \
26 $(GL_LIBS)
27
28-libgstgl_@GST_API_VERSION@_la_LIBADD += -lgstfsl-$(GST_API_VERSION)
29+libgstgl_@GST_API_VERSION@_la_LIBADD += -lg2d
30
31 if HAVE_WINDOW_WIN32
32 SUBDIRS += win32
33diff --git a/gst-libs/gst/gl/gstglphymemory.c b/gst-libs/gst/gl/gstglphymemory.c
34index 52ae41f..e28546c 100644
35--- a/gst-libs/gst/gl/gstglphymemory.c
36+++ b/gst-libs/gst/gl/gstglphymemory.c
37@@ -24,7 +24,7 @@
38
39 #include "gstglvivdirecttexture.h"
40 #include "gstglphymemory.h"
41-#include "g2d.h"
42+#include <g2d.h>
43
44 GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_PHY_MEMORY);
45 #define GST_CAT_DEFAULT GST_CAT_GL_PHY_MEMORY
46diff --git a/gst-libs/gst/gl/gstglphymemory.h b/gst-libs/gst/gl/gstglphymemory.h
47index b1a69e7..ebb9911 100644
48--- a/gst-libs/gst/gl/gstglphymemory.h
49+++ b/gst-libs/gst/gl/gstglphymemory.h
50@@ -24,7 +24,7 @@
51 #include <gst/gst.h>
52 #include <gst/gstmemory.h>
53 #include <gst/video/video.h>
54-#include <gst/imx-mm/gstallocatorphymem.h>
55+#include <gst/allocators/gstallocatorphymem.h>
56
57 #include <gst/gl/gl.h>
58
59diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
60index e8e0b82..242b7c0 100644
61--- a/gst-libs/gst/gl/gstglvivdirecttexture.c
62+++ b/gst-libs/gst/gl/gstglvivdirecttexture.c
63@@ -22,7 +22,7 @@
64 #include "config.h"
65 #endif
66
67-#include <gst/imx-mm/gstallocatorphymem.h>
68+#include <gst/allocators/gstallocatorphymem.h>
69 #include "gl.h"
70
71 GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug);
72--
731.9.1
74
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch
deleted file mode 100644
index aac204d1..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch
+++ /dev/null
@@ -1,170 +0,0 @@
1From 67d11594e693b60797c2bae1bcfa4e8bafcf4c9a Mon Sep 17 00:00:00 2001
2From: Haihua Hu <b55597@freescale.com>
3Date: Thu, 25 Feb 2016 13:53:20 +0800
4Subject: [PATCH 17/18] glcolorconvert: convert YUV to RGB use directviv
5
6Add a property "disable_passthrough" in glcolorconvert for enable/disable passthrough.
7When need convert YUV to RGB with directviv, set it to be TRUE.
8
9Upstream-Status: Inappropriate [i.MX specific]
10
11Signed-off-by: Haihua Hu <b55597@freescale.com>
12
13Conflicts:
14 gst-libs/gst/gl/gstglcolorconvert.c
15
16Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
17---
18 ext/gl/gstglcolorconvertelement.c | 70 +++++++++++++++++++++++++++++++++++++
19 ext/gl/gstglcolorconvertelement.h | 1 +
20 gst-libs/gst/gl/gstglcolorconvert.c | 6 +++-
21 3 files changed, 76 insertions(+), 1 deletion(-)
22
23diff --git a/ext/gl/gstglcolorconvertelement.c b/ext/gl/gstglcolorconvertelement.c
24index bd4fbeb..9108b0a 100644
25--- a/ext/gl/gstglcolorconvertelement.c
26+++ b/ext/gl/gstglcolorconvertelement.c
27@@ -35,6 +35,14 @@ G_DEFINE_TYPE_WITH_CODE (GstGLColorConvertElement, gst_gl_color_convert_element,
28 "glconvertelement", 0, "convert");
29 );
30
31+enum
32+{
33+ GL_COLOR_CONVERT_PROP_0,
34+ GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH
35+};
36+
37+#define DISABLE_PASSTHROUGH_DAFAULT FALSE
38+
39 static gboolean gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
40 GstCaps * in_caps, GstCaps * out_caps);
41 static GstCaps *gst_gl_color_convert_element_transform_caps (GstBaseTransform *
42@@ -54,6 +62,15 @@ static GstFlowReturn gst_gl_color_convert_element_transform (GstBaseTransform *
43 static GstCaps *gst_gl_color_convert_element_fixate_caps (GstBaseTransform *
44 bt, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
45
46+static void gst_gl_color_convert_set_property (GObject *object,
47+ guint prop_id,
48+ const GValue *value,
49+ GParamSpec *pspec);
50+static void gst_gl_color_convert_get_property (GObject *object,
51+ guint prop_id,
52+ GValue *value,
53+ GParamSpec *pspec);
54+
55 static GstStaticPadTemplate gst_gl_color_convert_element_src_pad_template =
56 GST_STATIC_PAD_TEMPLATE ("src",
57 GST_PAD_SRC,
58@@ -89,6 +106,10 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass)
59 {
60 GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
61 GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
62+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
63+
64+ object_class->set_property = gst_gl_color_convert_set_property;
65+ object_class->get_property = gst_gl_color_convert_get_property;
66
67 bt_class->transform_caps = gst_gl_color_convert_element_transform_caps;
68 bt_class->set_caps = gst_gl_color_convert_element_set_caps;
69@@ -110,6 +131,13 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass)
70 gst_static_pad_template_get
71 (&gst_gl_color_convert_element_sink_pad_template));
72
73+ g_object_class_install_property (object_class, GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH,
74+ g_param_spec_boolean ("disable_passthrough",
75+ "Disable passthrough",
76+ "Disable passthrough mode",
77+ DISABLE_PASSTHROUGH_DAFAULT,
78+ G_PARAM_READWRITE));
79+
80 gst_element_class_set_metadata (element_class,
81 "OpenGL color converter", "Filter/Converter/Video",
82 "Converts between color spaces using OpenGL shaders",
83@@ -121,6 +149,41 @@ gst_gl_color_convert_element_init (GstGLColorConvertElement * convert)
84 {
85 gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (convert),
86 TRUE);
87+ convert->disable_passthrough = FALSE;
88+}
89+
90+static void
91+gst_gl_color_convert_set_property (GObject *object,
92+ guint prop_id,
93+ const GValue *value,
94+ GParamSpec *pspec)
95+{
96+ GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object);
97+ switch (prop_id) {
98+ case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH:
99+ convert->disable_passthrough = g_value_get_boolean (value);
100+ break;
101+ default:
102+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
103+ break;
104+ }
105+}
106+
107+static void
108+gst_gl_color_convert_get_property (GObject *object,
109+ guint prop_id,
110+ GValue *value,
111+ GParamSpec *pspec)
112+{
113+ GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object);
114+ switch (prop_id) {
115+ case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH:
116+ g_value_set_boolean (value, convert->disable_passthrough);
117+ break;
118+ default:
119+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
120+ break;
121+ }
122 }
123
124 static gboolean
125@@ -135,6 +198,13 @@ gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
126 if (convert->convert)
127 gst_gl_color_convert_set_caps (convert->convert, in_caps, out_caps);
128
129+ if(gst_base_transform_is_passthrough (bt) && convert->disable_passthrough){
130+ /* if in passthrough mode and disable_passthrough is set to true,
131+ * set passthrough to FALSE*/
132+ GST_DEBUG_OBJECT(convert, "Disable passthrough mode");
133+ gst_base_transform_set_passthrough(bt, FALSE);
134+ }
135+
136 return TRUE;
137 }
138
139diff --git a/ext/gl/gstglcolorconvertelement.h b/ext/gl/gstglcolorconvertelement.h
140index 2a0dd1d..5cdbd3a 100644
141--- a/ext/gl/gstglcolorconvertelement.h
142+++ b/ext/gl/gstglcolorconvertelement.h
143@@ -47,6 +47,7 @@ struct _GstGLColorConvertElement
144 GstGLColorConvert *convert;
145 GstCaps *in_caps;
146 GstCaps *out_caps;
147+ gboolean disable_passthrough;
148 };
149
150 struct _GstGLColorConvertElementClass
151diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
152index eb3b4a8..4ed947e 100644
153--- a/gst-libs/gst/gl/gstglcolorconvert.c
154+++ b/gst-libs/gst/gl/gstglcolorconvert.c
155@@ -700,7 +700,11 @@ _gst_gl_color_convert_set_caps_unlocked (GstGLColorConvert * convert,
156 convert->priv->to_texture_target = to_target;
157 convert->initted = FALSE;
158
159- convert->passthrough = passthrough;
160+ /* We may disable passthrough via an external property
161+ * By the way, when glconvertelement is in passthrough mode,
162+ * the plugin will not call gst_gl_color_convert_perform().*/
163+
164+ //convert->passthrough = passthrough;
165 #ifndef GST_DISABLE_GST_DEBUG
166 if (G_UNLIKELY (convert->passthrough))
167 GST_DEBUG_OBJECT (convert,
168--
1691.9.1
170
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glwindow-work-around-for-no-frame-when-imxplayer-use.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glwindow-work-around-for-no-frame-when-imxplayer-use.patch
deleted file mode 100644
index de53df42..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glwindow-work-around-for-no-frame-when-imxplayer-use.patch
+++ /dev/null
@@ -1,63 +0,0 @@
1From 61b6bc77cb939a778e2ddfee68d0378680f69f71 Mon Sep 17 00:00:00 2001
2From: Haihua Hu <b55597@freescale.com>
3Date: Wed, 9 Mar 2016 13:00:39 +0800
4Subject: [PATCH 18/18] glwindow: work around for no frame when imxplayer use
5 glimagesink
6
7change parent window of internal_window in window_show function.
8
9Upstream-Status: Inappropriate [i.MX specific]
10
11Signed-off-by: Haihua Hu <b55597@freescale.com>
12Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
13---
14 gst-libs/gst/gl/x11/gstglwindow_x11.c | 14 +++++++++++---
15 1 file changed, 11 insertions(+), 3 deletions(-)
16
17diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c
18index a330825..67160f6 100644
19--- a/gst-libs/gst/gl/x11/gstglwindow_x11.c
20+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c
21@@ -322,13 +322,13 @@ gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id)
22 g_main_context_get_thread_default ());
23 }
24
25- XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
26+ /*XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
27
28 XResizeWindow (window_x11->device, window_x11->internal_win_id,
29 attr.width, attr.height);
30
31 XReparentWindow (window_x11->device, window_x11->internal_win_id,
32- window_x11->parent_win, 0, 0);
33+ window_x11->parent_win, 0, 0);*/
34
35 XSync (window_x11->device, FALSE);
36 }
37@@ -359,7 +359,7 @@ _show_window (GstGLWindow * window)
38 GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
39 guint width = window_x11->priv->preferred_width;
40 guint height = window_x11->priv->preferred_height;
41- XWindowAttributes attr;
42+ XWindowAttributes attr, parent_attr;
43
44 XGetWindowAttributes (window_x11->device, window_x11->internal_win_id, &attr);
45
46@@ -371,6 +371,14 @@ _show_window (GstGLWindow * window)
47 XResizeWindow (window_x11->device, window_x11->internal_win_id,
48 attr.width, attr.height);
49 XSync (window_x11->device, FALSE);
50+ }else{
51+ XGetWindowAttributes (window_x11->device, window_x11->parent_win, &parent_attr);
52+
53+ XResizeWindow (window_x11->device, window_x11->internal_win_id,
54+ parent_attr.width, parent_attr.height);
55+
56+ XReparentWindow (window_x11->device, window_x11->internal_win_id,
57+ window_x11->parent_win, 0, 0);
58 }
59
60 XMapWindow (window_x11->device, window_x11->internal_win_id);
61--
621.9.1
63
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch
deleted file mode 100755
index d4858328..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch
+++ /dev/null
@@ -1,168 +0,0 @@
1From 5b4e2d726602b0c92b789fce0dc85a1f0c860bbc Mon Sep 17 00:00:00 2001
2From: Haihua Hu <jared.hu@nxp.com>
3Date: Wed, 20 Apr 2016 16:38:31 +0800
4Subject: [PATCH 3/6] [glplugin] glcolorconvert: fix MRT cannot work in GLES3.0
5
61. Add #ifdefine Marco to avoid redefinition of GL_COLOR_ATTACHMENT(1,2).
72. Change to use glBlitFramebuffer for textures copy. glCopyTexImage2D
8 cannot work because we cannot get texture internal format.
9
10Upstream-Status: Inappropriate [i.MX specific]
11
12Signed-off-by: Haihua Hu <jared.hu@nxp.com>
13---
14 gst-libs/gst/gl/glprototypes/fbo.h | 6 +--
15 gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h | 7 +--
16 gst-libs/gst/gl/gstglcolorconvert.c | 2 +-
17 gst-libs/gst/gl/gstglmemory.c | 54 +++++++++++++++++++++---
18 4 files changed, 55 insertions(+), 14 deletions(-)
19
20diff --git a/gst-libs/gst/gl/glprototypes/fbo.h b/gst-libs/gst/gl/glprototypes/fbo.h
21index d142483..789f289 100644
22--- a/gst-libs/gst/gl/glprototypes/fbo.h
23+++ b/gst-libs/gst/gl/glprototypes/fbo.h
24@@ -102,9 +102,9 @@ GST_GL_EXT_FUNCTION (GLboolean, IsFramebuffer,
25 GST_GL_EXT_END ()
26
27 GST_GL_EXT_BEGIN (offscreen_blit,
28- GST_GL_API_NONE,
29- 255, 255,
30- 255, 255, /* not in either GLES */
31+ GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
32+ 3, 0,
33+ 3, 0,/* enable to avoid using glCopyTexImage2D for texture copying */
34 "EXT\0ANGLE\0",
35 "framebuffer_blit\0")
36 GST_GL_EXT_FUNCTION (void, BlitFramebuffer,
37diff --git a/gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h b/gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h
38index d282990..1980476 100644
39--- a/gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h
40+++ b/gst-libs/gst/gl/glprototypes/gstgl_gles2compat.h
41@@ -34,9 +34,10 @@ G_BEGIN_DECLS
42 //END FIXME
43
44 /* UNSUPPORTED */
45-
46-#define GL_COLOR_ATTACHMENT1 0
47-#define GL_COLOR_ATTACHMENT2 0
48+#ifndef GL_COLOR_ATTACHMENT1
49+#define GL_COLOR_ATTACHMENT1 0x8CE1
50+#define GL_COLOR_ATTACHMENT2 0x8CE2
51+#endif
52 #ifndef GL_TEXTURE_ENV
53 #define GL_TEXTURE_ENV 0
54 #endif
55diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
56index 4ed947e..490ec54 100644
57--- a/gst-libs/gst/gl/gstglcolorconvert.c
58+++ b/gst-libs/gst/gl/gstglcolorconvert.c
59@@ -2075,7 +2075,7 @@ _init_convert (GstGLColorConvert * convert)
60 }
61
62 /* Requires reading from a RG/LA framebuffer... */
63- if (USING_GLES2 (convert->context) &&
64+ if (!USING_GLES3 (convert->context) &&
65 (GST_VIDEO_INFO_FORMAT (&convert->out_info) == GST_VIDEO_FORMAT_YUY2 ||
66 GST_VIDEO_INFO_FORMAT (&convert->out_info) ==
67 GST_VIDEO_FORMAT_UYVY)) {
68diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c
69index 402fd4d..f2706ea 100644
70--- a/gst-libs/gst/gl/gstglmemory.c
71+++ b/gst-libs/gst/gl/gstglmemory.c
72@@ -69,6 +69,12 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
73 #ifndef GL_TEXTURE_EXTERNAL_OES
74 #define GL_TEXTURE_EXTERNAL_OES 0x8D65
75 #endif
76+#ifndef GL_READ_FRAMEBUFFER
77+#define GL_READ_FRAMEBUFFER 0x8CA8
78+#endif
79+#ifndef GL_DRAW_FRAMEBUFFER
80+#define GL_DRAW_FRAMEBUFFER 0x8CA9
81+#endif
82
83 G_DEFINE_TYPE (GstGLMemoryAllocator, gst_gl_memory_allocator,
84 GST_TYPE_GL_BASE_MEMORY_ALLOCATOR);
85@@ -608,7 +614,7 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
86 guint out_gl_format, out_tex_target;
87 GstMapInfo sinfo;
88 guint src_tex_id;
89- guint fbo;
90+ guint fbo[2];
91
92 gl = src->mem.context->gl_vtable;
93 out_tex_target = gst_gl_texture_target_to_gl (out_target);
94@@ -632,31 +638,65 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
95
96 /* FIXME: try and avoid creating and destroying fbo's every copy... */
97 /* create a framebuffer object */
98- gl->GenFramebuffers (1, &fbo);
99- gl->BindFramebuffer (GL_FRAMEBUFFER, fbo);
100+ gl->GenFramebuffers (2, &fbo[0]);
101+ gl->BindFramebuffer (GL_READ_FRAMEBUFFER, fbo[0]);
102
103- gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
104+ gl->FramebufferTexture2D (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
105 gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0);
106
107-// if (!gst_gl_context_check_framebuffer_status (src->context))
108-// goto fbo_error;
109+ if (!gst_gl_context_check_framebuffer_status (src->mem.context))
110+ goto fbo_error;
111+
112+ gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[1]);
113+
114+ gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
115+ gst_gl_texture_target_to_gl (src->tex_target), tex_id, 0);
116
117+ if (!gst_gl_context_check_framebuffer_status (src->mem.context))
118+ goto fbo_error;
119+
120+ /*
121 gl->BindTexture (out_tex_target, tex_id);
122 gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
123 GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "CopyTexImage2D took");
124 gl->CopyTexImage2D (out_tex_target, 0, out_gl_format, 0, 0, out_width,
125 out_height, 0);
126 gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
127+ */
128+
129+ /*
130+ * glCopyTexImage2D cannot work without internal_format
131+ * we cannot get the internal_format in this function
132+ * so use glBlitFramebuffer for texture copy
133+ */
134+ GST_CAT_LOG(GST_CAT_GL_MEMORY,"Use BlitFramebuffer copy texture %d into %d",
135+ src_tex_id, tex_id);
136+ gl->ReadBuffer ( GL_COLOR_ATTACHMENT0 );
137+ gl->BlitFramebuffer ( 0, 0, out_width, out_height,
138+ 0, 0, out_width, out_height,
139+ GL_COLOR_BUFFER_BIT, GL_LINEAR );
140
141 gl->BindTexture (out_tex_target, 0);
142 gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
143
144- gl->DeleteFramebuffers (1, &fbo);
145+ gl->DeleteFramebuffers (2, &fbo[0]);
146
147 gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
148
149 return TRUE;
150
151+fbo_error:
152+ {
153+ gl->BindTexture (out_tex_target, 0);
154+ gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
155+
156+ gl->DeleteFramebuffers (2, &fbo[0]);
157+
158+ gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
159+
160+ return FALSE;
161+ }
162+
163 error:
164 return FALSE;
165 }
166--
1671.9.1
168
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0009-MMFMWK-7308-Fix-build-issue-on-non-GPU-soc.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0009-MMFMWK-7308-Fix-build-issue-on-non-GPU-soc.patch
deleted file mode 100755
index 44bb7b0e..00000000
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0009-MMFMWK-7308-Fix-build-issue-on-non-GPU-soc.patch
+++ /dev/null
@@ -1,454 +0,0 @@
1From 506dd50401d4f702d92540db9cb90a752e6817aa Mon Sep 17 00:00:00 2001
2From: Haihua Hu <jared.hu@nxp.com>
3Date: Mon, 31 Oct 2016 15:22:01 +0800
4Subject: [PATCH] [MMFMWK-7308] Fix build issue on non-GPU soc.
5
61.Add directviv and g2d check in configure.ac
72.Add compile marcos in glupload and gldownload
8
9Upstream-Status: Inappropriate [i.MX specific]
10
11Signed-off-by: Haihua Hu <jared.hu@nxp.com>
12---
13 configure.ac | 27 +++++++++++++++-
14 ext/gl/gstgldownloadelement.c | 21 ++++++++++---
15 gst-libs/gst/gl/Makefile.am | 22 ++++++++++---
16 gst-libs/gst/gl/gstglbufferpool.c | 4 ++-
17 gst-libs/gst/gl/gstglupload.c | 66 ++++++++++++++++++++++-----------------
18 5 files changed, 100 insertions(+), 40 deletions(-)
19
20diff --git a/configure.ac b/configure.ac
21index 9d007f1..655e019 100644
22--- a/configure.ac
23+++ b/configure.ac
24@@ -682,7 +682,9 @@ save_LIBS="$LIBS"
25 HAVE_GL=no
26 HAVE_GLES2=no
27 HAVE_WAYLAND_EGL=no
28-HAV_FB_EGL=no
29+HAVE_FB_EGL=no
30+HAVE_DIRECTVIV=no
31+HAVE_G2D=no
32
33 HAVE_EGL_RPI=no
34
35@@ -722,6 +724,10 @@ case $host in
36 dnl check for imx fbbackend support
37 AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no)
38
39+ dnl specific check for imx soc
40+ AC_CHECK_LIB(GLESv2, glTexDirectVIV, HAVE_DIRECTVIV=yes, HAVE_DIRECTVIV=no)
41+ AC_CHECK_HEADER(g2d.h, HAVE_G2D=yes, HAVE_G2D=no)
42+
43 dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
44 AC_CHECK_HEADER([EGL/fbdev_window.h],
45 [
46@@ -820,6 +826,18 @@ if test "x$HAVE_GLES2" = "xno"; then
47 fi
48 fi
49
50+dnl specific for imx soc
51+GST_GL_HAVE_DIRECTVIV=0
52+GST_GL_HAVE_PHYMEM=0
53+if test "x$HAVE_DIRECTVIV" = "xyes"; then
54+ GST_GL_HAVE_DIRECTVIV=1
55+ if test "x$HAVE_G2D" = "xyes"; then
56+ GST_GL_HAVE_PHYMEM=1
57+ else
58+ AC_MSG_WARN([Physical memory do not support])
59+ fi
60+fi
61+
62 dnl X, GLX and OpenGL
63 if test "x$HAVE_X" = "xno"; then
64 if test "x$NEED_GLX" = "xyes"; then
65@@ -1265,6 +1283,8 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
66
67 GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
68 #define GST_GL_HAVE_DMABUF $GST_GL_HAVE_DMABUF
69+#define GST_GL_HAVE_DIRECTVIV $GST_GL_HAVE_DIRECTVIV
70+#define GST_GL_HAVE_PHYMEM $GST_GL_HAVE_PHYMEM
71 "
72
73 dnl Check for no platforms/window systems
74@@ -1300,6 +1320,9 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
75 HAVE_WINDOW_COCOA=no
76 HAVE_WINDOW_EAGL=no
77 HAVE_WINDOW_FB=no
78+
79+ HAVE_DIRECTVIV=no
80+ HAVE_G2D=no
81 fi
82
83 AC_SUBST(GL_LIBS)
84@@ -1316,6 +1339,8 @@ AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
85 AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
86 AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
87 AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes")
88+AM_CONDITIONAL(HAVE_DIRECTVIV, test "x$HAVE_DIRECTVIV" = "xyes")
89+AM_CONDITIONAL(HAVE_PHYMEM, test "x$HAVE_DIRECTVIV" = "xyes" -a "x$HAVE_G2D" = "xyes")
90
91 AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
92 AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
93diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c
94index 9ea0146..e89c36e 100644
95--- a/ext/gl/gstgldownloadelement.c
96+++ b/ext/gl/gstgldownloadelement.c
97@@ -23,9 +23,12 @@
98 #endif
99
100 #include <gst/gl/gl.h>
101-#include <gst/gl/gstglphymemory.h>
102 #include "gstgldownloadelement.h"
103
104+#if GST_GL_HAVE_PHYMEM
105+#include <gst/gl/gstglphymemory.h>
106+#endif
107+
108 GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug);
109 #define GST_CAT_DEFAULT gst_gl_download_element_debug
110
111@@ -33,7 +36,8 @@ GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug);
112 G_DEFINE_TYPE_WITH_CODE (GstGLDownloadElement, gst_gl_download_element,
113 GST_TYPE_GL_BASE_FILTER,
114 GST_DEBUG_CATEGORY_INIT (gst_gl_download_element_debug, "gldownloadelement",
115- 0, "download element"););
116+ 0, "download element");
117+ );
118
119 static gboolean gst_gl_download_element_get_unit_size (GstBaseTransform * trans,
120 GstCaps * caps, gsize * size);
121@@ -170,6 +174,7 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
122 gint i, n;
123 GstGLMemory *glmem;
124
125+#if GST_GL_HAVE_PHYMEM
126 glmem = gst_buffer_peek_memory (inbuf, 0);
127 if (gst_is_gl_physical_memory (glmem)) {
128 GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
129@@ -182,6 +187,7 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
130
131 return GST_FLOW_OK;
132 }
133+#endif /* GST_GL_HAVE_PHYMEM */
134
135 *outbuf = inbuf;
136
137@@ -235,19 +241,23 @@ gst_gl_download_element_propose_allocation (GstBaseTransform * bt,
138 return FALSE;
139 }
140
141- GST_DEBUG_OBJECT (bt, "video format is %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&info)));
142+ GST_DEBUG_OBJECT (bt, "video format is %s",
143+ gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&info)));
144
145 gst_allocation_params_init (&params);
146+
147+#if GST_GL_HAVE_PHYMEM
148 if (gst_is_gl_physical_memory_supported_fmt (&info)) {
149 allocator = gst_phy_mem_allocator_obtain ();
150 GST_DEBUG_OBJECT (bt, "obtain physical memory allocator %p.", allocator);
151 }
152+#endif /* GST_GL_HAVE_PHYMEM */
153
154 if (!allocator)
155 allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
156
157 if (!allocator) {
158- GST_ERROR_OBJECT (bt, "Can't obtain physical memory allocator.");
159+ GST_ERROR_OBJECT (bt, "Can't obtain gl memory allocator.");
160 return FALSE;
161 }
162
163@@ -268,7 +278,8 @@ gst_gl_download_element_propose_allocation (GstBaseTransform * bt,
164 /* the normal size of a frame */
165 size = info.size;
166 gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
167- gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_GL_SYNC_META);
168+ gst_buffer_pool_config_add_option (config,
169+ GST_BUFFER_POOL_OPTION_GL_SYNC_META);
170
171 if (!gst_buffer_pool_set_config (pool, config)) {
172 gst_object_unref (pool);
173diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
174index 55f8a20..c52bba5 100644
175--- a/gst-libs/gst/gl/Makefile.am
176+++ b/gst-libs/gst/gl/Makefile.am
177@@ -33,10 +33,16 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \
178 gstglviewconvert.c \
179 gstgloverlaycompositor.c \
180 gstglquery.c \
181- gstglvivdirecttexture.c \
182- gstglphymemory.c \
183 gstglcontrolbindingproxy.c
184
185+if HAVE_DIRECTVIV
186+libgstgl_@GST_API_VERSION@_la_SOURCES += gstglvivdirecttexture.c
187+endif
188+
189+if HAVE_PHYMEM
190+libgstgl_@GST_API_VERSION@_la_SOURCES += gstglphymemory.c
191+endif
192+
193 libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
194 libgstgl_@GST_API_VERSION@include_HEADERS = \
195 gstglwindow.h \
196@@ -68,10 +74,16 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
197 gstglcontrolbindingproxy.h \
198 gstgl_fwd.h \
199 gstgl_enums.h \
200- gstglvivdirecttexture.h \
201- gstglphymemory.h \
202 gl.h
203
204+if HAVE_DIRECTVIV
205+libgstgl_@GST_API_VERSION@include_HEADERS += gstglvivdirecttexture.h
206+endif
207+
208+if HAVE_PHYMEM
209+libgstgl_@GST_API_VERSION@include_HEADERS += gstglphymemory.h
210+endif
211+
212 noinst_HEADERS = \
213 gstglsl_private.h \
214 utils/opengl_versions.h \
215@@ -86,7 +98,9 @@ libgstgl_@GST_API_VERSION@_la_LIBADD = \
216 $(GST_LIBS) \
217 $(GL_LIBS)
218
219+if HAVE_PHYMEM
220 libgstgl_@GST_API_VERSION@_la_LIBADD += -lg2d
221+endif
222
223 if HAVE_WINDOW_WIN32
224 SUBDIRS += win32
225diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c
226index 71c726a..77452be 100644
227--- a/gst-libs/gst/gl/gstglbufferpool.c
228+++ b/gst-libs/gst/gl/gstglbufferpool.c
229@@ -292,8 +292,9 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
230 }
231 #endif
232
233+#if GST_GL_HAVE_PHYMEM
234 if ((g_strcmp0 (priv->allocator->mem_type, GST_GL_PHY_MEM_ALLOCATOR) == 0)) {
235- GstAllocator* allocator = (GstAllocator*) gst_phy_mem_allocator_obtain ();
236+ GstAllocator *allocator = (GstAllocator *) gst_phy_mem_allocator_obtain ();
237 if (!gst_gl_physical_memory_setup_buffer (allocator, buf, priv->gl_params)) {
238 GST_ERROR_OBJECT (pool, "Can't create physcial buffer.");
239 return GST_FLOW_ERROR;
240@@ -301,6 +302,7 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
241 *buffer = buf;
242 return GST_FLOW_OK;
243 }
244+#endif
245
246 alloc = GST_GL_MEMORY_ALLOCATOR (priv->allocator);
247 if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params))
248diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
249index 99cc68a..d17fab3 100644
250--- a/gst-libs/gst/gl/gstglupload.c
251+++ b/gst-libs/gst/gl/gstglupload.c
252@@ -23,7 +23,6 @@
253 #endif
254
255 #include <stdio.h>
256-#include <gst/gl/gstglvivdirecttexture.h>
257
258 #include "gl.h"
259 #include "gstglupload.h"
260@@ -36,6 +35,9 @@
261 #include <gst/allocators/gstdmabuf.h>
262 #endif
263
264+#if GST_GL_HAVE_DIRECTVIV
265+#include <gst/gl/gstglvivdirecttexture.h>
266+#endif
267 /**
268 * SECTION:gstglupload
269 * @short_description: an object that uploads to GL textures
270@@ -316,8 +318,8 @@ _gl_memory_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
271 gst_allocation_params_init (&params);
272
273 allocator =
274- GST_ALLOCATOR (gst_gl_memory_allocator_get_default (upload->
275- upload->context));
276+ GST_ALLOCATOR (gst_gl_memory_allocator_get_default (upload->upload->
277+ context));
278 gst_query_add_allocation_param (query, allocator, &params);
279 gst_object_unref (allocator);
280 }
281@@ -603,8 +605,8 @@ _egl_image_upload_perform_gl_thread (GstGLContext * context,
282 }
283
284 if (GST_IS_GL_BUFFER_POOL (image->buffer->pool))
285- gst_gl_buffer_pool_replace_last_buffer (GST_GL_BUFFER_POOL (image->
286- buffer->pool), image->buffer);
287+ gst_gl_buffer_pool_replace_last_buffer (GST_GL_BUFFER_POOL (image->buffer->
288+ pool), image->buffer);
289 }
290
291 static GstGLUploadReturn
292@@ -1045,11 +1047,11 @@ _upload_meta_upload_propose_allocation (gpointer impl, GstQuery * decide_query,
293 gpointer handle;
294
295 gl_apis =
296- gst_gl_api_to_string (gst_gl_context_get_gl_api (upload->upload->
297- context));
298- platform =
299- gst_gl_platform_to_string (gst_gl_context_get_gl_platform (upload->
300+ gst_gl_api_to_string (gst_gl_context_get_gl_api (upload->
301 upload->context));
302+ platform =
303+ gst_gl_platform_to_string (gst_gl_context_get_gl_platform
304+ (upload->upload->context));
305 handle = (gpointer) gst_gl_context_get_gl_context (upload->upload->context);
306
307 gl_context =
308@@ -1170,6 +1172,7 @@ static const UploadMethod _upload_meta_upload = {
309 &_upload_meta_upload_free
310 };
311
312+#if GST_GL_HAVE_DIRECTVIV
313 struct PhyBufferUpload
314 {
315 GstGLUpload *upload;
316@@ -1177,7 +1180,7 @@ struct PhyBufferUpload
317 };
318
319 static gpointer
320-_physical_buffer_upload_new(GstGLUpload *upload)
321+_physical_buffer_upload_new (GstGLUpload * upload)
322 {
323 struct PhyBufferUpload *phybuffer = g_new0 (struct PhyBufferUpload, 1);
324
325@@ -1187,8 +1190,8 @@ _physical_buffer_upload_new(GstGLUpload *upload)
326 }
327
328 static GstCaps *
329-_physical_buffer_upload_transform_caps(GstGLContext *context,
330- GstPadDirection direction, GstCaps *caps)
331+_physical_buffer_upload_transform_caps (GstGLContext * context,
332+ GstPadDirection direction, GstCaps * caps)
333 {
334 GstCapsFeatures *passthrough =
335 gst_caps_features_from_string
336@@ -1208,7 +1211,7 @@ _physical_buffer_upload_transform_caps(GstGLContext *context,
337 ret = tmp;
338 } else {
339 ret = gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
340- (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY,GST_GL_DIRECTVIV_FORMAT));
341+ (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY, GST_GL_DIRECTVIV_FORMAT));
342 }
343
344 gst_caps_features_free (passthrough);
345@@ -1216,16 +1219,16 @@ _physical_buffer_upload_transform_caps(GstGLContext *context,
346 }
347
348 static gboolean
349-_physical_buffer_upload_accept(gpointer impl, GstBuffer *buffer,
350- GstCaps *in_caps, GstCaps *out_caps)
351+_physical_buffer_upload_accept (gpointer impl, GstBuffer * buffer,
352+ GstCaps * in_caps, GstCaps * out_caps)
353 {
354- struct PhyBufferUpload *upload = impl;
355+ struct PhyBufferUpload *upload = impl;
356 GstCapsFeatures *features;
357
358 features = gst_caps_get_features (out_caps, 0);
359 if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
360 return FALSE;
361-
362+
363 if (upload->params)
364 gst_gl_allocation_params_free ((GstGLAllocationParams *) upload->params);
365 if (!(upload->params =
366@@ -1234,18 +1237,19 @@ _physical_buffer_upload_accept(gpointer impl, GstBuffer *buffer,
367 GST_GL_TEXTURE_TARGET_2D)))
368 return FALSE;
369
370- return gst_is_physical_buffer(buffer);
371+ return gst_is_physical_buffer (buffer);
372 }
373
374 static void
375-_physical_buffer_upload_propose_allocation(gpointer impl, GstQuery *decide_query,
376- GstQuery *query)
377+_physical_buffer_upload_propose_allocation (gpointer impl,
378+ GstQuery * decide_query, GstQuery * query)
379 {
380 gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
381 }
382
383 static GstGLUploadReturn
384-_physical_buffer_upload_perform(gpointer impl, GstBuffer *buffer, GstBuffer **outbuf)
385+_physical_buffer_upload_perform (gpointer impl, GstBuffer * buffer,
386+ GstBuffer ** outbuf)
387 {
388 struct PhyBufferUpload *phyBuffer = impl;
389 GstGLMemoryAllocator *allocator;
390@@ -1255,7 +1259,7 @@ _physical_buffer_upload_perform(gpointer impl, GstBuffer *buffer, GstBuffer **ou
391 info = &phyBuffer->upload->priv->out_info;
392 n_mem = GST_VIDEO_INFO_N_PLANES (info);
393 GST_LOG_OBJECT (phyBuffer->upload, "Attempting viv direct upload");
394-
395+
396 allocator =
397 GST_GL_MEMORY_ALLOCATOR (gst_allocator_find
398 (GST_GL_MEMORY_PBO_ALLOCATOR_NAME));
399@@ -1265,11 +1269,10 @@ _physical_buffer_upload_perform(gpointer impl, GstBuffer *buffer, GstBuffer **ou
400 gst_gl_memory_setup_buffer (allocator, *outbuf, phyBuffer->params);
401 gst_object_unref (allocator);
402
403- GstGLMemory *out_gl_mem =
404- (GstGLMemory *) gst_buffer_peek_memory (*outbuf, 0);
405+ GstGLMemory *out_gl_mem = (GstGLMemory *) gst_buffer_peek_memory (*outbuf, 0);
406
407- gst_gl_viv_direct_bind_gstbuffer(phyBuffer->upload->context, out_gl_mem->tex_id,
408- &phyBuffer->upload->priv->in_info, buffer);
409+ gst_gl_viv_direct_bind_gstbuffer (phyBuffer->upload->context,
410+ out_gl_mem->tex_id, &phyBuffer->upload->priv->in_info, buffer);
411
412 gst_buffer_add_video_meta_full (*outbuf, 0,
413 GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
414@@ -1279,14 +1282,14 @@ _physical_buffer_upload_perform(gpointer impl, GstBuffer *buffer, GstBuffer **ou
415 }
416
417 static void
418-_physical_buffer_upload_free(gpointer impl)
419+_physical_buffer_upload_free (gpointer impl)
420 {
421 struct PhyBufferUpload *phyBuffer = impl;
422
423 if (phyBuffer->params)
424 gst_gl_allocation_params_free ((GstGLAllocationParams *) phyBuffer->params);
425
426- g_free(phyBuffer);
427+ g_free (phyBuffer);
428 }
429
430 static GstStaticCaps _physical_buffer_upload_caps =
431@@ -1303,6 +1306,7 @@ static const UploadMethod _physical_buffer_upload = {
432 &_physical_buffer_upload_perform,
433 &_physical_buffer_upload_free
434 };
435+#endif /* GST_GL_HAVE_DIRECTVIV */
436
437 struct RawUploadFrame
438 {
439@@ -1526,7 +1530,11 @@ static const UploadMethod *upload_methods[] = { &_gl_memory_upload,
440 #if GST_GL_HAVE_DMABUF
441 &_dma_buf_upload,
442 #endif
443- &_upload_meta_upload, &_physical_buffer_upload, &_raw_data_upload
444+ &_upload_meta_upload,
445+#if GST_GL_HAVE_DIRECTVIV
446+ &_physical_buffer_upload,
447+#endif
448+ &_raw_data_upload
449 };
450
451 static GMutex upload_global_lock;
452--
4531.9.1
454
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
index 4743c4f9..e9f0cc3f 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend
@@ -9,14 +9,6 @@ PACKAGECONFIG_GL_imxgpu3d = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '
9 9
10SRC_URI_append_imxgpu2d = " \ 10SRC_URI_append_imxgpu2d = " \
11 file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \ 11 file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \
12 file://0002-Support-fb-backend-for-gl-plugins.patch \
13 file://0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch \
14 file://0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch \
15 file://0005-Fix-dependence-issue-between-gst-plugin-.patch \
16 file://0006-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \
17 file://0007-glwindow-work-around-for-no-frame-when-imxplayer-use.patch \
18 file://0008-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch \
19 file://0009-MMFMWK-7308-Fix-build-issue-on-non-GPU-soc.patch \
20" 12"
21 13
22 14