summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuqing Zhu <carol.zhu@nxp.com>2016-11-01 16:09:54 +0800
committerOtavio Salvador <otavio@ossystems.com.br>2016-11-05 10:42:45 -0200
commitb87dbd9ade314e6c6575b19f01e7ae60c821af9c (patch)
tree6f793dc40739788fadbf567af98a770d058a13fc
parenta5656e55e2a39a20767e939710165841f7f53e03 (diff)
downloadmeta-freescale-b87dbd9ade314e6c6575b19f01e7ae60c821af9c.tar.gz
gstreamer1.0-plugins-bad: Support fb backend for gl plugins
1. Add fb support in glimagesink 2. Override set_render_rectangle() to support resize Signed-off-by: Yuqing Zhu <carol.zhu@nxp.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
-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.patch (renamed from recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Add-directviv-to-glimagesink-to-improve-playback-per.patch)0
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch (renamed from recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch)0
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-Fix-dependence-issue-between-gst-plugin-.patch (renamed from recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-Fix-dependence-issue-between-gst-plugin-.patch)0
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch (renamed from recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch)0
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glwindow-work-around-for-no-frame-when-imxplayer-use.patch (renamed from recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch)0
-rwxr-xr-xrecipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch (renamed from recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch)0
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend13
8 files changed, 765 insertions, 6 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
new file mode 100755
index 00000000..b5b8d644
--- /dev/null
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch
@@ -0,0 +1,758 @@
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/0002-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
index 43d89060..43d89060 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-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
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-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
index 1cead36d..1cead36d 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-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
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-Fix-dependence-issue-between-gst-plugin-.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-Fix-dependence-issue-between-gst-plugin-.patch
index 44633cf9..44633cf9 100755
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-Fix-dependence-issue-between-gst-plugin-.patch
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-Fix-dependence-issue-between-gst-plugin-.patch
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-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
index aac204d1..aac204d1 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-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
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-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
index de53df42..de53df42 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-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
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-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
index d4858328..d4858328 100755
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-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
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
index c663d94b..9ee82a85 100644
--- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_%.bbappend
@@ -12,12 +12,13 @@ PACKAGECONFIG_GL_imxgpu3d = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', '
12 12
13SRC_URI_append_imxgpu3d = " \ 13SRC_URI_append_imxgpu3d = " \
14 file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \ 14 file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \
15 file://0002-Add-directviv-to-glimagesink-to-improve-playback-per.patch \ 15 file://0002-Support-fb-backend-for-gl-plugins.patch \
16 file://0003-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch \ 16 file://0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch \
17 file://0004-Fix-dependence-issue-between-gst-plugin-.patch \ 17 file://0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with-dire.patch \
18 file://0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \ 18 file://0005-Fix-dependence-issue-between-gst-plugin-.patch \
19 file://0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch \ 19 file://0006-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \
20 file://0007-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch \ 20 file://0007-glwindow-work-around-for-no-frame-when-imxplayer-use.patch \
21 file://0008-glplugin-glcolorconvert-fix-MRT-cannot-work-in-GLES3.patch \
21" 22"
22 23
23 24