+++ /dev/null
-From bb2db3bb88e1f72b611c1ae1cc4854bf570daac8 Mon Sep 17 00:00:00 2001
-From: Jian <Jian.Li@freescale.com>
-Date: Tue, 17 Nov 2015 14:39:07 +0800
-Subject: [PATCH 10/18] [glplugin] Change wayland default res to 1024x768
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-Change wayland backend default window resolution
-from 320x240 to 1024x768
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Jian <Jian.Li@freescale.com>
-Signed-off-by: Lyon Wang <lyon.wang@freescale.com>
----
- gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
-index 6e1f0c5..48b37a2 100644
---- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
-+++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c
-@@ -305,13 +305,13 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl)
- if (window_egl->window.window_width > 0)
- width = window_egl->window.window_width;
- else
-- width = 320;
-+ width = 1024;
- window_egl->window.window_width = width;
-
- if (window_egl->window.window_height > 0)
- height = window_egl->window.window_height;
- else
-- height = 240;
-+ height = 768;
- window_egl->window.window_height = height;
-
- if (!window_egl->window.native) {
---
-1.9.1
-
+++ /dev/null
-From d0179e89c294f775a7ebb6ccb0ad539433f3c22e Mon Sep 17 00:00:00 2001
-From: Haihua Hu <b55597@freescale.com>
-Date: Mon, 16 Nov 2015 17:41:57 +0800
-Subject: [PATCH 08/26] Support fb backend for gl plugins
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-1.Add fb support in glimagesink
-2.override set_render_rectangle() to support resize
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Haihua Hu <b55597@freescale.com>
-
-Conflicts:
- configure.ac
----
- configure.ac | 25 ++-
- gst-libs/gst/gl/Makefile.am | 5 +
- gst-libs/gst/gl/fb/Makefile.am | 25 +++
- gst-libs/gst/gl/fb/gstgldisplay_fb.c | 109 +++++++++++++
- gst-libs/gst/gl/fb/gstgldisplay_fb.h | 67 ++++++++
- gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | 265 ++++++++++++++++++++++++++++++++
- gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | 65 ++++++++
- gst-libs/gst/gl/gstgldisplay.c | 11 ++
- gst-libs/gst/gl/gstgldisplay.h | 1 +
- gst-libs/gst/gl/gstglwindow.c | 8 +
- 11 files changed, 580 insertions(+), 1 deletions(-)
- create mode 100644 gst-libs/gst/gl/fb/Makefile.am
- create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.c
- create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.h
- create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
- create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
-
-diff --git a/configure.ac b/configure.ac
-index f135648..991e7d0 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -700,6 +700,7 @@ HAVE_GL=no
- HAVE_GLES2=no
- HAVE_GLES3_H=no
- HAVE_WAYLAND_EGL=no
-+HAVE_FB_EGL=no
-
- HAVE_EGL_RPI=no
-
-@@ -737,6 +738,9 @@ case $host in
- old_LIBS=$LIBS
- old_CFLAGS=$CFLAGS
-
-+ dnl check fb backend for imx soc
-+ AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no)
-+
- dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
- AC_CHECK_HEADER([EGL/fbdev_window.h],
- [
-@@ -1043,6 +1047,16 @@ case $host in
- fi
- fi
-
-+ if test "x$HAVE_FB_EGL" = "xyes"; then
-+ if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then
-+ AC_MSG_WARN([EGL is required by the fb backend for OpenGL support])
-+ else
-+ HAVE_WINDOW_FB=yes
-+ GL_LIBS="$GL_LIBS"
-+ GL_CFLAGS="$GL_CFLAGS"
-+ fi
-+ fi
-+
- if test "x$HAVE_EGL_RPI" = "xyes"; then
- if test "x$NEED_DISPMANX" != "xno"; then
- HAVE_WINDOW_DISPMANX=yes
-@@ -1057,7 +1071,7 @@ case $host in
- fi
- else
- if test "x$NEED_EGL" != "xno"; then
-- if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes"; then
-+ 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
- GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS"
- GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS"
- USE_EGL=yes
-@@ -1209,6 +1223,7 @@ GST_GL_HAVE_WINDOW_WAYLAND=0
- GST_GL_HAVE_WINDOW_ANDROID=0
- GST_GL_HAVE_WINDOW_DISPMANX=0
- GST_GL_HAVE_WINDOW_EAGL=0
-+GST_GL_HAVE_WINDOW_FB=0
-
- if test "x$HAVE_WINDOW_X11" = "xyes"; then
- GL_WINDOWS="x11 $GL_WINDOWS"
-@@ -1238,6 +1253,10 @@ if test "x$HAVE_WINDOW_EAGL" = "xyes"; then
- GL_WINDOWS="eagl $GL_WINDOWS"
- GST_GL_HAVE_WINDOW_EAGL=1
- fi
-+if test "x$HAVE_WINDOW_FB" = "xyes"; then
-+ GL_WINDOWS="fb $GL_WINDOWS"
-+ GST_GL_HAVE_WINDOW_FB=1
-+fi
-
- GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
- #define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11
-@@ -1247,6 +1266,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
- #define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID
- #define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX
- #define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL
-+#define GST_GL_HAVE_WINDOW_FB $GST_GL_HAVE_WINDOW_FB
- "
-
- dnl PLATFORM's
-@@ -1322,6 +1342,7 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
- HAVE_WINDOW_ANDROID=no
- HAVE_WINDOW_COCOA=no
- HAVE_WINDOW_EAGL=no
-+ HAVE_WINDOW_FB=no
- fi
-
- AC_SUBST(GL_LIBS)
-@@ -1337,6 +1358,7 @@ AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
-+AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes")
-
- AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
- AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
-@@ -3700,6 +3722,7 @@ gst-libs/gst/gl/egl/Makefile
- gst-libs/gst/gl/wayland/Makefile
- gst-libs/gst/gl/win32/Makefile
- gst-libs/gst/gl/x11/Makefile
-+gst-libs/gst/gl/fb/Makefile
- gst-libs/gst/insertbin/Makefile
- gst-libs/gst/interfaces/Makefile
- gst-libs/gst/codecparsers/Makefile
-diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
-index 5ceb622..01498e0 100644
---- a/gst-libs/gst/gl/Makefile.am
-+++ b/gst-libs/gst/gl/Makefile.am
-@@ -119,6 +119,11 @@ SUBDIRS += eagl
- libgstgl_@GST_API_VERSION@_la_LIBADD += eagl/libgstgl-eagl.la
- endif
-
-+if HAVE_WINDOW_FB
-+SUBDIRS += fb
-+libgstgl_@GST_API_VERSION@_la_LIBADD += fb/libgstgl-fb.la
-+endif
-+
- if USE_EGL
- SUBDIRS += egl
- libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la
-diff --git a/gst-libs/gst/gl/fb/Makefile.am b/gst-libs/gst/gl/fb/Makefile.am
-new file mode 100644
-index 0000000..8e4656c
---- /dev/null
-+++ b/gst-libs/gst/gl/fb/Makefile.am
-@@ -0,0 +1,25 @@
-+## Process this file with automake to produce Makefile.in
-+
-+noinst_LTLIBRARIES = libgstgl-fb.la
-+
-+libgstgl_fb_la_SOURCES = \
-+ gstgldisplay_fb.c \
-+ gstglwindow_fb_egl.c
-+
-+noinst_HEADERS = \
-+ gstgldisplay_fb.h \
-+ gstglwindow_fb_egl.h
-+
-+libgstgl_fbincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/fb
-+
-+libgstgl_fb_la_CFLAGS = \
-+ -I$(top_srcdir)/gst-libs \
-+ -I$(top_builddir)/gst-libs \
-+ $(GL_CFLAGS) \
-+ $(GST_PLUGINS_BASE_CFLAGS) \
-+ $(GST_BASE_CFLAGS) \
-+ $(GST_CFLAGS)
-+
-+libgstgl_fb_la_LDFLAGS = \
-+ $(GST_LIB_LDFLAGS) \
-+ $(GST_ALL_LDFLAGS)
-diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.c b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
-new file mode 100644
-index 0000000..3be9756
---- /dev/null
-+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.c
-@@ -0,0 +1,109 @@
-+/*
-+ * GStreamer
-+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#include <gst/gl/fb/gstgldisplay_fb.h>
-+
-+GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-+#define GST_CAT_DEFAULT gst_gl_display_debug
-+
-+G_DEFINE_TYPE (GstGLDisplayFB, gst_gl_display_fb, GST_TYPE_GL_DISPLAY);
-+
-+static void gst_gl_display_fb_finalize (GObject * object);
-+static guintptr gst_gl_display_fb_get_handle (GstGLDisplay * display);
-+
-+static void
-+gst_gl_display_fb_class_init (GstGLDisplayFBClass * klass)
-+{
-+ GST_GL_DISPLAY_CLASS (klass)->get_handle =
-+ GST_DEBUG_FUNCPTR (gst_gl_display_fb_get_handle);
-+
-+ G_OBJECT_CLASS (klass)->finalize = gst_gl_display_fb_finalize;
-+}
-+
-+static void
-+gst_gl_display_fb_init (GstGLDisplayFB * display_fb)
-+{
-+ GstGLDisplay *display = (GstGLDisplay *) display_fb;
-+
-+ display->type = GST_GL_DISPLAY_TYPE_FB;
-+ display_fb->name = NULL;
-+ display_fb->disp_idx = 0;
-+ display_fb->display = NULL;
-+}
-+
-+static void
-+gst_gl_display_fb_finalize (GObject * object)
-+{
-+ GstGLDisplayFB *display_fb = GST_GL_DISPLAY_FB (object);
-+
-+ if (display_fb->name)
-+ g_free (display_fb->name);
-+
-+ if (display_fb->display)
-+ fbDestroyDisplay (display_fb->display);
-+
-+ G_OBJECT_CLASS (gst_gl_display_fb_parent_class)->finalize (object);
-+}
-+
-+/**
-+ * gst_gl_display_fb_new:
-+ * @name: (allow-none): a display name
-+ *
-+ * Create a new #GstGLDisplayFB from the x11 display name. See XOpenDisplay()
-+ * for details on what is a valid name.
-+ *
-+ * Returns: (transfer full): a new #GstGLDisplayFB or %NULL
-+ */
-+GstGLDisplayFB *
-+gst_gl_display_fb_new (gchar *name)
-+{
-+ GstGLDisplayFB *display;
-+ const gchar *fb_name = NULL;
-+
-+ GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay");
-+ GST_DEBUG ("creating Fb EGL display");
-+
-+ fb_name = name;
-+ if (!fb_name) fb_name = "fb0";
-+
-+ display = g_object_new (GST_TYPE_GL_DISPLAY_FB, NULL);
-+ display->name = g_strdup (fb_name);
-+ sscanf (display->name, "fb%d", &display->disp_idx);
-+ display->display = fbGetDisplayByIndex (display->disp_idx);
-+ if (!display->display) {
-+ GST_ERROR ("Failed to open FB display, \'%s\'", fb_name);
-+ return NULL;
-+ }
-+
-+ GST_DEBUG ("Created fb EGL display %d", display->display);
-+
-+ return display;
-+}
-+
-+static guintptr
-+gst_gl_display_fb_get_handle (GstGLDisplay * display)
-+{
-+ GST_DEBUG ("Get fb EGL display %d", GST_GL_DISPLAY_FB (display)->display);
-+ return (guintptr) GST_GL_DISPLAY_FB (display)->display;
-+}
-diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.h b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
-new file mode 100644
-index 0000000..62987c1
---- /dev/null
-+++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.h
-@@ -0,0 +1,67 @@
-+/*
-+ * GStreamer
-+ * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#ifndef __GST_GL_DISPLAY_FB_H__
-+#define __GST_GL_DISPLAY_FB_H__
-+
-+#include <EGL/egl.h>
-+#include <gst/gst.h>
-+#include <gst/gl/gstgldisplay.h>
-+
-+G_BEGIN_DECLS
-+
-+GType gst_gl_display_fb_get_type (void);
-+
-+#define GST_TYPE_GL_DISPLAY_FB (gst_gl_display_fb_get_type())
-+#define GST_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFB))
-+#define GST_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFBClass))
-+#define GST_IS_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_FB))
-+#define GST_IS_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_FB))
-+#define GST_GL_DISPLAY_FB_CAST(obj) ((GstGLDisplayFB*)(obj))
-+
-+typedef struct _GstGLDisplayFB GstGLDisplayFB;
-+typedef struct _GstGLDisplayFBClass GstGLDisplayFBClass;
-+
-+/**
-+ * GstGLDisplayFB:
-+ *
-+ * the contents of a #GstGLDisplayFB are private and should only be accessed
-+ * through the provided API
-+ */
-+struct _GstGLDisplayFB
-+{
-+ GstGLDisplay parent;
-+
-+ /* <private> */
-+ gchar *name;
-+ gint disp_idx;
-+ EGLNativeDisplayType display;
-+};
-+
-+struct _GstGLDisplayFBClass
-+{
-+ GstGLDisplayClass object_class;
-+};
-+
-+GstGLDisplayFB *gst_gl_display_fb_new (gchar *name);
-+
-+G_END_DECLS
-+
-+#endif /* __GST_GL_DISPLAY_FB_H__ */
-diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
-new file mode 100644
-index 0000000..a068e30
---- /dev/null
-+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c
-@@ -0,0 +1,265 @@
-+/*
-+ * GStreamer
-+ * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com>
-+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#include "../gstgl_fwd.h"
-+#include <gst/gl/gstglcontext.h>
-+
-+#include "gstglwindow_fb_egl.h"
-+
-+#define GST_CAT_DEFAULT gst_gl_window_debug
-+
-+#define gst_gl_window_fb_egl_parent_class parent_class
-+G_DEFINE_TYPE (GstGLWindowFbEGL, gst_gl_window_fb_egl,
-+ GST_GL_TYPE_WINDOW);
-+
-+static guintptr gst_gl_window_fb_egl_get_window_handle (GstGLWindow *
-+ window);
-+static void gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
-+ guintptr handle);
-+static void gst_gl_window_fb_egl_draw (GstGLWindow * window);
-+static void gst_gl_window_fb_egl_close (GstGLWindow * window);
-+static gboolean gst_gl_window_fb_egl_open (GstGLWindow * window,
-+ GError ** error);
-+static gboolean
-+gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window,
-+ guint x, guint y, guint width, guint height);
-+
-+static void
-+gst_gl_window_fb_egl_class_init (GstGLWindowFbEGLClass * klass)
-+{
-+ GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
-+
-+ window_class->get_window_handle =
-+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_get_window_handle);
-+ window_class->set_window_handle =
-+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_window_handle);
-+ window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_draw);
-+ window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_close);
-+ window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_open);
-+ window_class->set_render_rectangle =
-+ GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_render_rectangle);
-+}
-+
-+static void
-+gst_gl_window_fb_egl_init (GstGLWindowFbEGL * window)
-+{
-+ GstGLWindowFbEGL *window_egl;
-+
-+ window_egl = GST_GL_WINDOW_FB_EGL (window);
-+
-+ window_egl->width = 0;
-+ window_egl->height = 0;
-+ window_egl->default_fullscreen = TRUE;
-+ window_egl->display = 0;
-+}
-+
-+/* Must be called in the gl thread */
-+GstGLWindowFbEGL *
-+gst_gl_window_fb_egl_new (GstGLDisplay * display)
-+{
-+ GstGLWindowFbEGL *window;
-+ const gchar *fb_name = NULL;
-+
-+ if (!display)
-+ return NULL;
-+
-+ window = g_object_new (GST_GL_TYPE_WINDOW_FB_EGL, NULL);
-+ window->display = gst_gl_display_get_handle (display);
-+ if (!window->display) {
-+ GST_ERROR ("failed to get display for egl window");
-+ return NULL;
-+ }
-+
-+ return window;
-+}
-+
-+static void
-+gst_gl_window_fb_egl_close (GstGLWindow * window)
-+{
-+ GstGLWindowFbEGL *window_egl;
-+
-+ window_egl = GST_GL_WINDOW_FB_EGL (window);
-+
-+ if (window_egl->win_id) {
-+ fbDestroyWindow (window_egl->win_id);
-+ }
-+
-+ GST_GL_WINDOW_CLASS (parent_class)->close (window);
-+}
-+
-+static gboolean
-+gst_gl_window_fb_egl_open (GstGLWindow * window, GError ** error)
-+{
-+ GstGLWindowFbEGL *window_egl;
-+
-+ window_egl = GST_GL_WINDOW_FB_EGL (window);
-+
-+ if (!window_egl->display) {
-+ GST_ERROR ("No display for window_egl.");
-+ return FALSE;
-+ }
-+
-+ window_egl->win_id = fbCreateWindow (window_egl->display, -1, -1, 0, 0);
-+ if (!window_egl->win_id) {
-+ GST_ERROR ("Failed to create window_egl");
-+ return FALSE;
-+ }
-+
-+ fbGetDisplayGeometry (window_egl->display, &window_egl->width, &window_egl->height);
-+ window_egl->req_width = window_egl->width;
-+ window_egl->req_height = window_egl->height;
-+ GST_DEBUG ("Open FB display succesfully, resolution is (%dx%d),display %d, window %d.",
-+ window_egl->width, window_egl->height, window_egl->display, window_egl->win_id);
-+
-+ if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error))
-+ return FALSE;
-+
-+ return TRUE;
-+}
-+static guintptr
-+gst_gl_window_fb_egl_get_window_handle (GstGLWindow * window)
-+{
-+ GST_DEBUG ("fb egl get window: %d", GST_GL_WINDOW_FB_EGL (window)->win_id);
-+ return (guintptr) GST_GL_WINDOW_FB_EGL (window)->win_id;
-+}
-+
-+static void
-+gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window,
-+ guintptr handle)
-+{
-+}
-+
-+static void
-+draw_cb (gpointer data)
-+{
-+ GstGLWindowFbEGL *window_egl = (GstGLWindowFbEGL *)data;
-+ GstGLWindow *window = GST_GL_WINDOW (window_egl);
-+ GstGLContext *context = gst_gl_window_get_context (window);
-+ GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
-+
-+ /* default full screen */
-+ if (window_egl->default_fullscreen && window->resize) {
-+ window->resize (window->resize_data, window_egl->width, window_egl->height);
-+ window_egl->default_fullscreen = FALSE;
-+ }
-+
-+ if (window->draw)
-+ window->draw (window->draw_data);
-+
-+ GST_DEBUG ("####### draw data");
-+ context_class->swap_buffers (context);
-+
-+ gst_object_unref (context);
-+}
-+
-+static void
-+gst_gl_window_fb_egl_draw (GstGLWindow * window)
-+{
-+ gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window);
-+}
-+
-+static gboolean
-+_calculate_viewport_coordinates(GstVideoRectangle *req, GstVideoRectangle *result,
-+ guint display_width, guint display_height)
-+{
-+ if(!req || !result || req->w < 1 || req->h < 1)
-+ return FALSE;
-+
-+ result->x = req->x;
-+ result->y = display_height - (req->y + req->h);
-+ result->w = req->w;
-+ result->h = req->h;
-+
-+ return TRUE;
-+}
-+
-+struct SetRenderRectangle
-+{
-+ GstGLWindowFbEGL *window_egl;
-+ GstVideoRectangle rect;
-+};
-+
-+static void
-+_free_set_render_rectangle (struct SetRenderRectangle *render)
-+{
-+ if (render) {
-+ if (render->window_egl)
-+ gst_object_unref (render->window_egl);
-+ g_free (render);
-+ }
-+}
-+
-+static void
-+_set_render_rectangle (gpointer data)
-+{
-+ const GstGLFuncs *gl;
-+ GstGLContext *context;
-+ GstVideoRectangle result, video_rect, tmp_res;
-+ struct SetRenderRectangle *render = data;
-+ GstGLWindow *window = GST_GL_WINDOW (render->window_egl);
-+
-+ context = gst_gl_window_get_context(window);
-+ gl = context->gl_vtable;
-+
-+ GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i",
-+ render->rect.x, render->rect.y, render->rect.w, render->rect.h);
-+
-+ video_rect.x = render->rect.x;
-+ video_rect.y = render->rect.y;
-+ video_rect.w = GST_VIDEO_SINK_WIDTH(window->resize_data);
-+ video_rect.h = GST_VIDEO_SINK_HEIGHT(window->resize_data);
-+
-+ gst_video_sink_center_rect(video_rect, render->rect, &tmp_res, TRUE);
-+
-+ GST_LOG_OBJECT (render->window_egl, "set center render rectangle %i,%i+%ix%i",
-+ tmp_res.x, tmp_res.y, tmp_res.w, tmp_res.h);
-+
-+ /* need to transform screen coordinate to viewport coordinate */
-+ if( _calculate_viewport_coordinates(&tmp_res, &result,
-+ render->window_egl->width, render->window_egl->height)){
-+ GST_LOG_OBJECT (render->window_egl, "viewport render rectangle %i,%i+%ix%i",
-+ result.x, result.y, result.w, result.h);
-+ gl->Viewport(result.x, result.y, result.w, result.h);
-+ }
-+
-+ if(context)
-+ gst_object_unref(context);
-+}
-+
-+static gboolean
-+gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window,
-+ guint x, guint y, guint width, guint height)
-+{
-+ GstGLWindowFbEGL *window_egl = GST_GL_WINDOW_FB_EGL (window);
-+ struct SetRenderRectangle *render;
-+
-+ render = g_new0 (struct SetRenderRectangle, 1);
-+ render->window_egl = gst_object_ref (window_egl);
-+ render->rect.x = x;
-+ render->rect.y = y;
-+ render->rect.w = width;
-+ render->rect.h = height;
-+
-+ gst_gl_window_send_message_async (window,
-+ (GstGLWindowCB) _set_render_rectangle, render,
-+ (GDestroyNotify) _free_set_render_rectangle);
-+ return TRUE;
-+}
-diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
-new file mode 100644
-index 0000000..216e421
---- /dev/null
-+++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h
-@@ -0,0 +1,65 @@
-+/*
-+ * GStreamer
-+ * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com>
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#ifndef __GST_GL_WINDOW_FB_EGL_H__
-+#define __GST_GL_WINDOW_FB_EGL_H__
-+
-+#include <gst/gl/gl.h>
-+#include "EGL/eglplatform.h"
-+
-+G_BEGIN_DECLS
-+
-+#define GST_GL_TYPE_WINDOW_FB_EGL (gst_gl_window_fb_egl_get_type())
-+#define GST_GL_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL))
-+#define GST_GL_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGLClass))
-+#define GST_GL_IS_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_FB_EGL))
-+#define GST_GL_IS_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_FB_EGL))
-+#define GST_GL_WINDOW_FB_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL_Class))
-+
-+typedef struct _GstGLWindowFbEGL GstGLWindowFbEGL;
-+typedef struct _GstGLWindowFbEGLClass GstGLWindowFbEGLClass;
-+
-+struct _GstGLWindowFbEGL {
-+ /*< private >*/
-+ GstGLWindow parent;
-+
-+ /* <private> */
-+ gint width, req_width;
-+ gint height, req_height;
-+ gboolean default_fullscreen;
-+ EGLNativeDisplayType display;
-+ EGLNativeWindowType win_id;
-+};
-+
-+struct _GstGLWindowFbEGLClass {
-+ /*< private >*/
-+ GstGLWindowClass parent_class;
-+
-+ /*< private >*/
-+ gpointer _reserved[GST_PADDING];
-+};
-+
-+GType gst_gl_window_fb_egl_get_type (void);
-+
-+GstGLWindowFbEGL * gst_gl_window_fb_egl_new (GstGLDisplay * display);
-+
-+G_END_DECLS
-+
-+#endif /* __GST_GL_WINDOW_FB_EGL_H__ */
-diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c
-index 3ffc906..7b0b5bf 100644
---- a/gst-libs/gst/gl/gstgldisplay.c
-+++ b/gst-libs/gst/gl/gstgldisplay.c
-@@ -70,6 +70,9 @@
- #include <gst/gl/egl/gsteglimage.h>
- #include <gst/gl/egl/gstglmemoryegl.h>
- #endif
-+#if GST_GL_HAVE_WINDOW_FB
-+#include <gst/gl/fb/gstgldisplay_fb.h>
-+#endif
-
- GST_DEBUG_CATEGORY_STATIC (gst_context);
- GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug);
-@@ -207,6 +210,14 @@ gst_gl_display_new (void)
- if (!display && (!user_choice || g_strstr_len (user_choice, 7, "wayland")))
- display = GST_GL_DISPLAY (gst_gl_display_wayland_new (NULL));
- #endif
-+#if GST_GL_HAVE_WINDOW_FB
-+ if (!display && (!user_choice || g_strstr_len (user_choice, 2, "fb"))) {
-+ const gchar *fb_name = NULL;
-+ fb_name = g_getenv ("GST_GL_FB");
-+ if (!fb_name) fb_name = "fb0";
-+ display = GST_GL_DISPLAY (gst_gl_display_fb_new (fb_name));
-+ }
-+#endif
- #if GST_GL_HAVE_PLATFORM_EGL
- if (!display && (!platform_choice
- || g_strstr_len (platform_choice, 3, "egl")))
-diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h
-index a02e904..2f896bb 100644
---- a/gst-libs/gst/gl/gstgldisplay.h
-+++ b/gst-libs/gst/gl/gstgldisplay.h
-@@ -61,6 +61,7 @@ typedef enum
- GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3),
- GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4),
- GST_GL_DISPLAY_TYPE_EGL = (1 << 5),
-+ GST_GL_DISPLAY_TYPE_FB = (1 << 6),
-
- GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32
- } GstGLDisplayType;
-diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c
-index 0588f1d..834d927 100644
---- a/gst-libs/gst/gl/gstglwindow.c
-+++ b/gst-libs/gst/gl/gstglwindow.c
-@@ -58,6 +58,9 @@
- #if GST_GL_HAVE_WINDOW_EAGL
- #include "eagl/gstglwindow_eagl.h"
- #endif
-+#if GST_GL_HAVE_WINDOW_FB
-+#include "fb/gstglwindow_fb_egl.h"
-+#endif
- #if GST_GL_HAVE_WINDOW_DISPMANX
- #include "dispmanx/gstglwindow_dispmanx_egl.h"
- #endif
-@@ -308,6 +311,11 @@ gst_gl_window_new (GstGLDisplay * display)
- if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl")))
- window = GST_GL_WINDOW (gst_gl_window_eagl_new (display));
- #endif
-+#if GST_GL_HAVE_WINDOW_FB
-+ if (!window && (!user_choice || g_strstr_len (user_choice, 2, "fb")))
-+ window = GST_GL_WINDOW (gst_gl_window_fb_egl_new (display));
-+#endif
-+
- if (!window) {
- /* subclass returned a NULL window */
- GST_WARNING ("Could not create window. user specified %s, creating dummy"
---
-1.9.1
-
+++ /dev/null
-From 989d63bdf9397ba3630a3d6b9fc934b78ef62823 Mon Sep 17 00:00:00 2001
-From: Haihua Hu <b55597@freescale.com>
-Date: Tue, 13 Oct 2015 09:33:54 +0800
-Subject: [PATCH 12/26] Add directviv to glimagesink to improve playback
- performance
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-1.Add a physical buffer uploader in glupload plugin and using viv direct
- texture to bind physical continious buffer with texture to avoid memory
- copy from videobuffer to texture to gain good performance.
-2.Reduce glimagesink load latency by override glimagesink ALLOCATION query to
- avoid memory copy.
-3.Add configure check for directviv feature
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Haihua Hu <b55597@freescale.com>
----
- configure.ac | 12 +++
- ext/gl/gstglimagesink.c | 5 ++
- gst-libs/gst/gl/Makefile.am | 8 ++
- gst-libs/gst/gl/gstglapi.h | 1 +
- gst-libs/gst/gl/gstglupload.c | 151 +++++++++++++++++++++++++++++++-
- gst-libs/gst/gl/gstglvivdirecttexture.c | 149 +++++++++++++++++++++++++++++++
- gst-libs/gst/gl/gstglvivdirecttexture.h | 38 ++++++++
- 7 files changed, 361 insertions(+), 3 deletions(-)
- create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.c
- create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.h
-
-diff --git a/configure.ac b/configure.ac
-index 991e7d0..3dc2b75 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -701,6 +701,7 @@ HAVE_GLES2=no
- HAVE_GLES3_H=no
- HAVE_WAYLAND_EGL=no
- HAVE_FB_EGL=no
-+HAVE_DIRECTVIV=no
-
- HAVE_EGL_RPI=no
-
-@@ -740,6 +741,7 @@ case $host in
-
- dnl check fb backend for imx soc
- AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no)
-+ AC_CHECK_LIB(GLESv2, glTexDirectVIV, HAVE_DIRECTVIV=yes, HAVE_DIRECTVIV=no)
-
- dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
- AC_CHECK_HEADER([EGL/fbdev_window.h],
-@@ -850,6 +852,12 @@ if test "x$HAVE_GLES2" = "xno"; then
- fi
- fi
-
-+dnl specific for imx soc
-+GST_GL_HAVE_DIRECTVIV=0
-+if test "x$HAVE_DIRECTVIV" = "xyes"; then
-+ GST_GL_HAVE_DIRECTVIV=1
-+fi
-+
- dnl X, GLX and OpenGL
- if test "x$HAVE_X" = "xno"; then
- if test "x$NEED_GLX" = "xyes"; then
-@@ -1308,6 +1316,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
-
- GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
- #define GST_GL_HAVE_DMABUF $GST_GL_HAVE_DMABUF
-+#define GST_GL_HAVE_DIRECTVIV $GST_GL_HAVE_DIRECTVIV
- "
-
- dnl Check for no platforms/window systems
-@@ -1343,6 +1352,8 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
- HAVE_WINDOW_COCOA=no
- HAVE_WINDOW_EAGL=no
- HAVE_WINDOW_FB=no
-+
-+ HAVE_DIRECTVIV=no
- fi
-
- AC_SUBST(GL_LIBS)
-@@ -1359,6 +1370,7 @@ AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes")
-+AM_CONDITIONAL(HAVE_DIRECTVIV, test "x$HAVE_DIRECTVIV" = "xyes")
-
- AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
- AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
-diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
-index 385e3e4..5da1012 100644
---- a/ext/gl/gstglimagesink.c
-+++ b/ext/gl/gstglimagesink.c
-@@ -1139,6 +1139,11 @@ gst_glimage_sink_query (GstBaseSink * bsink, GstQuery * query)
- res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
- break;
- }
-+ case GST_QUERY_ALLOCATION:
-+ {
-+ gst_glimage_sink_propose_allocation(bsink, query);
-+ break;
-+ }
- default:
- res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query);
- break;
-diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
-index 01498e0..a6b9755 100644
---- a/gst-libs/gst/gl/Makefile.am
-+++ b/gst-libs/gst/gl/Makefile.am
-@@ -36,6 +36,10 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \
- gstglquery.c \
- gstglcontrolbindingproxy.c
-
-+if HAVE_DIRECTVIV
-+libgstgl_@GST_API_VERSION@_la_SOURCES += gstglvivdirecttexture.c
-+endif
-+
- libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
- libgstgl_@GST_API_VERSION@include_HEADERS = \
- gstglwindow.h \
-@@ -70,6 +74,10 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \
- gstgl_enums.h \
- gl.h
-
-+if HAVE_DIRECTVIV
-+libgstgl_@GST_API_VERSION@include_HEADERS += gstglvivdirecttexture.h
-+endif
-+
- noinst_HEADERS = \
- gstglsl_private.h \
- utils/opengl_versions.h \
-diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h
-index 3088920..2e9c561 100644
---- a/gst-libs/gst/gl/gstglapi.h
-+++ b/gst-libs/gst/gl/gstglapi.h
-@@ -42,6 +42,7 @@
- # if GST_GL_HAVE_GLES3
- # include <GLES3/gl3.h>
- # include <GLES3/gl3ext.h>
-+# include <GLES2/gl2ext.h>
- # else
- # include <GLES2/gl2.h>
- # include <GLES2/gl2ext.h>
-diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
-index bfa5f22..2e52c3e 100644
---- a/gst-libs/gst/gl/gstglupload.c
-+++ b/gst-libs/gst/gl/gstglupload.c
-@@ -27,6 +27,9 @@
- #include "gl.h"
- #include "gstglupload.h"
-
-+#if GST_GL_HAVE_DIRECTVIV
-+#include <gst/gl/gstglvivdirecttexture.h>
-+#endif
- #if GST_GL_HAVE_PLATFORM_EGL
- #include "egl/gstglmemoryegl.h"
- #endif
-@@ -51,7 +54,7 @@
- #define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0))
- #define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0))
-
--GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug);
-+GST_DEBUG_CATEGORY (gst_gl_upload_debug);
- #define GST_CAT_DEFAULT gst_gl_upload_debug
-
- #define DEBUG_INIT \
-@@ -969,6 +972,144 @@ static const UploadMethod _upload_meta_upload = {
- &_upload_meta_upload_free
- };
-
-+#if GST_GL_HAVE_DIRECTVIV
-+struct PhyBufferUpload
-+{
-+ GstGLUpload *upload;
-+ GstGLVideoAllocationParams *params;
-+};
-+
-+static gpointer
-+_physical_buffer_upload_new(GstGLUpload *upload)
-+{
-+ struct PhyBufferUpload *phybuffer = g_new0 (struct PhyBufferUpload, 1);
-+
-+ phybuffer->upload = upload;
-+
-+ return phybuffer;
-+}
-+
-+static GstCaps *
-+_physical_buffer_upload_transform_caps(gpointer impl, GstGLContext *context,
-+ GstPadDirection direction, GstCaps *caps)
-+{
-+ GstCapsFeatures *passthrough =
-+ gst_caps_features_from_string
-+ (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
-+ GstCaps *ret;
-+
-+ if (direction == GST_PAD_SINK) {
-+ GstCaps *tmp;
-+
-+ ret =
-+ _set_caps_features_with_passthrough (caps,
-+ GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough);
-+
-+ gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL);
-+ tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D);
-+ gst_caps_unref (ret);
-+ ret = tmp;
-+ } else {
-+ ret = gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
-+ (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY,GST_GL_DIRECTVIV_FORMAT));
-+ }
-+
-+ gst_caps_features_free (passthrough);
-+ return ret;
-+}
-+
-+static gboolean
-+_physical_buffer_upload_accept(gpointer impl, GstBuffer *buffer,
-+ GstCaps *in_caps, GstCaps *out_caps)
-+{
-+ struct PhyBufferUpload *upload = impl;
-+ GstCapsFeatures *features;
-+
-+ features = gst_caps_get_features (out_caps, 0);
-+ if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY))
-+ return FALSE;
-+
-+ if (upload->params)
-+ gst_gl_allocation_params_free ((GstGLAllocationParams *) upload->params);
-+ if (!(upload->params =
-+ gst_gl_video_allocation_params_new (upload->upload->context, NULL,
-+ &upload->upload->priv->out_info, -1, NULL,
-+ GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA)))
-+ return FALSE;
-+
-+ return gst_is_physical_buffer(buffer);
-+}
-+
-+static void
-+_physical_buffer_upload_propose_allocation(gpointer impl, GstQuery *decide_query,
-+ GstQuery *query)
-+{
-+ gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0);
-+}
-+
-+static GstGLUploadReturn
-+_physical_buffer_upload_perform(gpointer impl, GstBuffer *buffer, GstBuffer **outbuf)
-+{
-+ struct PhyBufferUpload *phyBuffer = impl;
-+ GstGLMemoryAllocator *allocator;
-+ GstVideoInfo *info;
-+ gint n_mem;
-+
-+ info = &phyBuffer->upload->priv->out_info;
-+ n_mem = GST_VIDEO_INFO_N_PLANES (info);
-+ GST_LOG_OBJECT (phyBuffer->upload, "Attempting viv direct upload, out format %s",
-+ gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (info)));
-+
-+ allocator =
-+ GST_GL_MEMORY_ALLOCATOR (gst_allocator_find
-+ (GST_GL_MEMORY_PBO_ALLOCATOR_NAME));
-+
-+ /* FIXME: buffer pool */
-+ *outbuf = gst_buffer_new ();
-+ gst_gl_memory_setup_buffer (allocator, *outbuf, phyBuffer->params, NULL,
-+ NULL, 0);
-+ gst_object_unref (allocator);
-+
-+ GstGLMemory *out_gl_mem =
-+ (GstGLMemory *) gst_buffer_peek_memory (*outbuf, 0);
-+
-+ gst_gl_viv_direct_bind_gstbuffer(phyBuffer->upload->context, out_gl_mem->tex_id,
-+ &phyBuffer->upload->priv->in_info, buffer);
-+
-+ gst_buffer_add_video_meta_full (*outbuf, 0,
-+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
-+ GST_VIDEO_INFO_HEIGHT (info), n_mem, info->offset, info->stride);
-+
-+ return GST_GL_UPLOAD_DONE;
-+}
-+
-+static void
-+_physical_buffer_upload_free(gpointer impl)
-+{
-+ struct PhyBufferUpload *phyBuffer = impl;
-+
-+ if (phyBuffer->params)
-+ gst_gl_allocation_params_free ((GstGLAllocationParams *) phyBuffer->params);
-+
-+ g_free(phyBuffer);
-+}
-+
-+static GstStaticCaps _physical_buffer_upload_caps =
-+GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_DIRECTVIV_FORMAT));
-+
-+static const UploadMethod _physical_buffer_upload = {
-+ "Physical buffer",
-+ 0,
-+ &_physical_buffer_upload_caps,
-+ &_physical_buffer_upload_new,
-+ &_physical_buffer_upload_transform_caps,
-+ &_physical_buffer_upload_accept,
-+ &_physical_buffer_upload_propose_allocation,
-+ &_physical_buffer_upload_perform,
-+ &_physical_buffer_upload_free
-+};
-+#endif /* GST_GL_HAVE_DIRECTVIV */
-+
- struct RawUploadFrame
- {
- gint ref_count;
-@@ -1191,7 +1332,11 @@ static const UploadMethod *upload_methods[] = { &_gl_memory_upload,
- #if GST_GL_HAVE_DMABUF
- &_dma_buf_upload,
- #endif
-- &_upload_meta_upload, &_raw_data_upload
-+ &_upload_meta_upload,
-+#if GST_GL_HAVE_DIRECTVIV
-+ &_physical_buffer_upload,
-+#endif
-+ &_raw_data_upload
- };
-
- static GMutex upload_global_lock;
-@@ -1325,7 +1470,7 @@ gst_gl_upload_transform_caps (GstGLUpload * upload, GstGLContext * context,
- }
-
- if (filter) {
-- result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
-+ result = gst_caps_intersect_full (tmp, filter, GST_CAPS_INTERSECT_FIRST);
- gst_caps_unref (tmp);
- } else {
- result = tmp;
-diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
-new file mode 100644
-index 0000000..4c9dc69
---- /dev/null
-+++ b/gst-libs/gst/gl/gstglvivdirecttexture.c
-@@ -0,0 +1,149 @@
-+/*
-+ * GStreamer
-+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#include "gl.h"
-+#include "gstglvivdirecttexture.h"
-+#include <gst/allocators/gstallocatorphymem.h>
-+
-+GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug);
-+#define GST_CAT_DEFAULT gst_gl_upload_debug
-+
-+typedef struct {
-+ GstVideoFormat gst_fmt;
-+ guint viv_fmt;
-+} VIV_FMT_MAP;
-+
-+static VIV_FMT_MAP viv_fmt_map_table[] = {
-+ {GST_VIDEO_FORMAT_I420, GL_VIV_I420},
-+ {GST_VIDEO_FORMAT_YV12, GL_VIV_YV12},
-+ {GST_VIDEO_FORMAT_NV12, GL_VIV_NV12},
-+ {GST_VIDEO_FORMAT_NV21, GL_VIV_NV21},
-+ {GST_VIDEO_FORMAT_YUY2, GL_VIV_YUY2},
-+ {GST_VIDEO_FORMAT_UYVY, GL_VIV_UYVY},
-+ {GST_VIDEO_FORMAT_RGBA, GL_RGBA},
-+ {GST_VIDEO_FORMAT_RGBx, GL_RGBA},
-+ {GST_VIDEO_FORMAT_BGRA, GL_BGRA_EXT},
-+ {GST_VIDEO_FORMAT_RGB16, GL_RGB565_OES}
-+};
-+
-+typedef struct {
-+ guint tex_id;
-+ guint w;
-+ guint h;
-+ guint fmt;
-+ void *vaddr;
-+ guint paddr;
-+ gboolean ret;
-+} GstVivDirectTexture;
-+
-+gboolean
-+gst_is_physical_buffer (GstBuffer *buffer)
-+{
-+ return gst_buffer_is_phymem (buffer);
-+}
-+
-+static void
-+_do_viv_direct_tex_bind_mem (GstGLContext * context, GstVivDirectTexture * viv_tex)
-+{
-+ 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);
-+ GST_DEBUG ("Physical memory buffer, vaddr: %p, paddr: %p", viv_tex->vaddr, viv_tex->paddr);
-+
-+ glBindTexture (GL_TEXTURE_2D, viv_tex->tex_id);
-+ glTexDirectVIVMap (GL_TEXTURE_2D, viv_tex->w, viv_tex->h, viv_tex->fmt, &viv_tex->vaddr, &viv_tex->paddr);
-+ glTexDirectInvalidateVIV (GL_TEXTURE_2D);
-+ viv_tex->ret = TRUE;
-+
-+ return;
-+}
-+
-+gst_gl_is_directviv_supported_format (GstVideoFormat fmt)
-+{
-+ gint i;
-+ gboolean ret = FALSE;
-+
-+ for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) {
-+ if (fmt == viv_fmt_map_table[i].gst_fmt) {
-+ ret = TRUE;
-+ break;
-+ }
-+ }
-+
-+ return ret;
-+}
-+
-+gboolean
-+gst_gl_viv_direct_bind_data (GstGLContext * context,
-+ guint tex_id, GstVideoFormat fmt, gint width, gint height,
-+ gpointer * vaddr, gpointer *paddr)
-+{
-+ guint viv_fmt = GL_NONE;
-+ gint i;
-+
-+ for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) {
-+ if (fmt == viv_fmt_map_table[i].gst_fmt) {
-+ viv_fmt = viv_fmt_map_table[i].viv_fmt;
-+ break;
-+ }
-+ }
-+
-+ if (viv_fmt == GL_NONE) {
-+ GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt);
-+ return FALSE;
-+ }
-+
-+ GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, vaddr, paddr, FALSE};
-+ gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex);
-+
-+ return viv_tex.ret;
-+}
-+
-+gboolean
-+gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer)
-+{
-+ PhyMemBlock *memblk;
-+ GstVideoMeta *vmeta;
-+ GstVideoFormat fmt;
-+ gint width, height;
-+
-+ memblk = gst_buffer_query_phymem_block (buffer);
-+ if (!memblk)
-+ return FALSE;
-+
-+ width = GST_VIDEO_INFO_WIDTH (info);
-+ height = GST_VIDEO_INFO_HEIGHT (info);
-+
-+ vmeta = gst_buffer_get_video_meta (buffer);
-+ fmt = GST_VIDEO_INFO_FORMAT (info);
-+ if (vmeta && (fmt == GST_VIDEO_FORMAT_I420 || fmt == GST_VIDEO_FORMAT_NV12)) {
-+ width = vmeta->stride[0];
-+ height = vmeta->offset[1] / width;
-+ }
-+ else {
-+ width = GST_VIDEO_INFO_WIDTH (info);
-+ height = GST_VIDEO_INFO_HEIGHT (info);
-+ }
-+
-+ return gst_gl_viv_direct_bind_data (context, tex_id, fmt, width, height, memblk->vaddr, memblk->paddr);
-+}
-+
-diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.h b/gst-libs/gst/gl/gstglvivdirecttexture.h
-new file mode 100644
-index 0000000..9a2d123
---- /dev/null
-+++ b/gst-libs/gst/gl/gstglvivdirecttexture.h
-@@ -0,0 +1,38 @@
-+/*
-+ * GStreamer
-+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#ifndef __GST_GL_VIVDIRECT_H__
-+#define __GST_GL_VIVDIRECT_H__
-+
-+#include <gst/video/video.h>
-+#include <gst/gl/gstgl_fwd.h>
-+
-+#define GST_GL_DIRECTVIV_FORMAT "{RGBA, I420, YV12, NV12, NV21, YUY2, UYVY, BGRA, RGB16}"
-+G_BEGIN_DECLS
-+
-+gboolean gst_is_physical_buffer (GstBuffer *buffer);
-+gboolean gst_gl_is_directviv_supported_format (GstVideoFormat fmt);
-+gboolean gst_gl_viv_direct_bind_data (GstGLContext * context, guint tex_id, GstVideoFormat fmt, gint width, gint height,
-+ gpointer * vaddr, gpointer *paddr);
-+gboolean gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer);
-+
-+G_END_DECLS
-+
-+#endif /* __GST_GL_VIVDIRECT_H__ */
---
-1.9.1
-
+++ /dev/null
-From 771ef0eb163d23d172527e11ce1b587a03cfa745 Mon Sep 17 00:00:00 2001
-From: Haihua Hu <jared.hu@nxp.com>
-Date: Sun, 13 Nov 2016 00:45:29 +0800
-Subject: [PATCH] MMFMWK-6930 [glplugin] Accelerate gldownload with
-MIME-Version: 1.0
-Content-Type: text/plain; charset=UTF-8
-Content-Transfer-Encoding: 8bit
-
-1) Propose a physical buffer pool to upstream in gldownload
-2) Bind the physical buffer with texture via dirctviv
-3) In gldownload, wrap the physical buffer to gstbuffer, pass to
- downstream plugins.
-4) Add some configure check for g2d and phymem
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Haihua Hu <jared.hu@nxp.com>
----
- configure.ac | 11 ++
- ext/gl/gstgldownloadelement.c | 99 +++++++++++++++
- gst-libs/gst/gl/Makefile.am | 12 ++
- gst-libs/gst/gl/gstglbufferpool.c | 16 +++
- gst-libs/gst/gl/gstglphymemory.c | 254 ++++++++++++++++++++++++++++++++++++++
- gst-libs/gst/gl/gstglphymemory.h | 43 +++++++
- 6 files changed, 435 insertions(+)
- create mode 100644 gst-libs/gst/gl/gstglphymemory.c
- create mode 100644 gst-libs/gst/gl/gstglphymemory.h
-
-diff --git a/configure.ac b/configure.ac
-index 3dc2b75..90bf768 100644
---- a/configure.ac
-+++ b/configure.ac
-@@ -702,6 +702,7 @@ HAVE_GLES3_H=no
- HAVE_WAYLAND_EGL=no
- HAVE_FB_EGL=no
- HAVE_DIRECTVIV=no
-+HAVE_G2D=no
-
- HAVE_EGL_RPI=no
-
-@@ -742,6 +743,7 @@ case $host in
- dnl check fb backend for imx soc
- AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no)
- AC_CHECK_LIB(GLESv2, glTexDirectVIV, HAVE_DIRECTVIV=yes, HAVE_DIRECTVIV=no)
-+ AC_CHECK_HEADER(g2d.h, HAVE_G2D=yes, HAVE_G2D=no)
-
- dnl FIXME: Mali EGL depends on GLESv1 or GLESv2
- AC_CHECK_HEADER([EGL/fbdev_window.h],
-@@ -854,8 +856,14 @@ fi
-
- dnl specific for imx soc
- GST_GL_HAVE_DIRECTVIV=0
-+GST_GL_HAVE_PHYMEM=0
- if test "x$HAVE_DIRECTVIV" = "xyes"; then
- GST_GL_HAVE_DIRECTVIV=1
-+ if test "x$HAVE_G2D" = "xyes"; then
-+ GST_GL_HAVE_PHYMEM=1
-+ else
-+ AC_MSG_WARN([Physical memory do not support])
-+ fi
- fi
-
- dnl X, GLX and OpenGL
-@@ -1317,6 +1325,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
- GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES
- #define GST_GL_HAVE_DMABUF $GST_GL_HAVE_DMABUF
- #define GST_GL_HAVE_DIRECTVIV $GST_GL_HAVE_DIRECTVIV
-+#define GST_GL_HAVE_PHYMEM $GST_GL_HAVE_PHYMEM
- "
-
- dnl Check for no platforms/window systems
-@@ -1354,6 +1363,7 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the
- HAVE_WINDOW_FB=no
-
- HAVE_DIRECTVIV=no
-+ HAVE_G2D=no
- fi
-
- AC_SUBST(GL_LIBS)
-@@ -1371,6 +1381,7 @@ AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes")
- AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes")
- AM_CONDITIONAL(HAVE_DIRECTVIV, test "x$HAVE_DIRECTVIV" = "xyes")
-+AM_CONDITIONAL(HAVE_PHYMEM, test "x$HAVE_DIRECTVIV" = "xyes" -a "x$HAVE_G2D" = "xyes")
-
- AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes")
- AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes")
-diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c
-index 058398b..a5ba6ab 100644
---- a/ext/gl/gstgldownloadelement.c
-+++ b/ext/gl/gstgldownloadelement.c
-@@ -25,6 +25,10 @@
- #include <gst/gl/gl.h>
- #include "gstgldownloadelement.h"
-
-+#if GST_GL_HAVE_PHYMEM
-+#include <gst/gl/gstglphymemory.h>
-+#endif
-+
- GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug);
- #define GST_CAT_DEFAULT gst_gl_download_element_debug
-
-@@ -45,6 +49,8 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
- GstBuffer * buffer, GstBuffer ** outbuf);
- static GstFlowReturn gst_gl_download_element_transform (GstBaseTransform * bt,
- GstBuffer * buffer, GstBuffer * outbuf);
-+static gboolean gst_gl_download_element_propose_allocation (GstBaseTransform *
-+ bt, GstQuery * decide_query, GstQuery * query);
-
- static GstStaticPadTemplate gst_gl_download_element_src_pad_template =
- GST_STATIC_PAD_TEMPLATE ("src",
-@@ -70,6 +76,7 @@ gst_gl_download_element_class_init (GstGLDownloadElementClass * klass)
- bt_class->prepare_output_buffer =
- gst_gl_download_element_prepare_output_buffer;
- bt_class->transform = gst_gl_download_element_transform;
-+ bt_class->propose_allocation = gst_gl_download_element_propose_allocation;
-
- bt_class->passthrough_on_same_caps = TRUE;
-
-@@ -160,9 +167,26 @@ static GstFlowReturn
- gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt,
- GstBuffer * inbuf, GstBuffer ** outbuf)
- {
-+ GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt);
- GstCaps *src_caps = gst_pad_get_current_caps (bt->srcpad);
- GstCapsFeatures *features = NULL;
- gint i, n;
-+ GstGLMemory *glmem;
-+
-+#if GST_GL_HAVE_PHYMEM
-+ glmem = gst_buffer_peek_memory (inbuf, 0);
-+ if (gst_is_gl_physical_memory (glmem)) {
-+ GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
-+ GstVideoInfo info;
-+
-+ gst_video_info_from_caps (&info, src_caps);
-+ *outbuf = gst_gl_phymem_buffer_to_gstbuffer (context, &info, inbuf);
-+
-+ GST_DEBUG_OBJECT (download, "gl download with direct viv.");
-+
-+ return GST_FLOW_OK;
-+ }
-+#endif /* GST_GL_HAVE_PHYMEM */
-
- *outbuf = inbuf;
-
-@@ -194,3 +218,78 @@ gst_gl_download_element_transform (GstBaseTransform * bt,
- {
- return GST_FLOW_OK;
- }
-+
-+static gboolean
-+gst_gl_download_element_propose_allocation (GstBaseTransform * bt,
-+ GstQuery * decide_query, GstQuery * query)
-+{
-+ GstGLContext *context = GST_GL_BASE_FILTER (bt)->context;
-+ GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt);
-+ GstAllocationParams params;
-+ GstAllocator *allocator = NULL;
-+ GstBufferPool *pool = NULL;
-+ guint n_pools, i;
-+ GstVideoInfo info;
-+ GstCaps *caps;
-+ GstStructure *config;
-+ gsize size;
-+
-+ gst_query_parse_allocation (query, &caps, NULL);
-+ if (!gst_video_info_from_caps (&info, caps)) {
-+ GST_WARNING_OBJECT (bt, "invalid caps specified");
-+ return FALSE;
-+ }
-+
-+ GST_DEBUG_OBJECT (bt, "video format is %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&info)));
-+
-+ gst_allocation_params_init (¶ms);
-+
-+#if GST_GL_HAVE_PHYMEM
-+ if (gst_is_gl_physical_memory_supported_fmt (&info)) {
-+ allocator = gst_phy_mem_allocator_obtain ();
-+ GST_DEBUG_OBJECT (bt, "obtain physical memory allocator %p.", allocator);
-+ }
-+#endif /* GST_GL_HAVE_PHYMEM */
-+
-+ if (!allocator)
-+ allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME);
-+
-+ if (!allocator) {
-+ GST_ERROR_OBJECT (bt, "Can't obtain gl memory allocator.");
-+ return FALSE;
-+ }
-+
-+ gst_query_add_allocation_param (query, allocator, ¶ms);
-+ gst_object_unref (allocator);
-+
-+ n_pools = gst_query_get_n_allocation_pools (query);
-+ for (i = 0; i < n_pools; i++) {
-+ gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL);
-+ gst_object_unref (pool);
-+ pool = NULL;
-+ }
-+
-+ //new buffer pool
-+ pool = gst_gl_buffer_pool_new (context);
-+ config = gst_buffer_pool_get_config (pool);
-+
-+ /* the normal size of a frame */
-+ size = info.size;
-+ gst_buffer_pool_config_set_params (config, caps, size, 0, 0);
-+ gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_GL_SYNC_META);
-+
-+ if (!gst_buffer_pool_set_config (pool, config)) {
-+ gst_object_unref (pool);
-+ GST_WARNING_OBJECT (bt, "failed setting config");
-+ return FALSE;
-+ }
-+
-+ GST_DEBUG_OBJECT (download, "create pool %p", pool);
-+
-+ //propose 3 buffers for better performance
-+ gst_query_add_allocation_pool (query, pool, size, 3, 0);
-+
-+ gst_object_unref (pool);
-+
-+ return TRUE;
-+}
-diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
-index 4fec88a..0be4fa2 100644
---- a/gst-libs/gst/gl/Makefile.am
-+++ b/gst-libs/gst/gl/Makefile.am
-@@ -40,6 +40,10 @@ if HAVE_DIRECTVIV
- libgstgl_@GST_API_VERSION@_la_SOURCES += gstglvivdirecttexture.c
- endif
-
-+if HAVE_PHYMEM
-+libgstgl_@GST_API_VERSION@_la_SOURCES += gstglphymemory.c
-+endif
-+
- libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl
- libgstgl_@GST_API_VERSION@include_HEADERS = \
- gstglwindow.h \
-@@ -78,6 +82,10 @@ if HAVE_DIRECTVIV
- libgstgl_@GST_API_VERSION@include_HEADERS += gstglvivdirecttexture.h
- endif
-
-+if HAVE_PHYMEM
-+libgstgl_@GST_API_VERSION@include_HEADERS += gstglphymemory.h
-+endif
-+
- noinst_HEADERS = \
- gstglsl_private.h \
- utils/opengl_versions.h \
-@@ -92,6 +100,10 @@ libgstgl_@GST_API_VERSION@_la_LIBADD = \
- $(GST_LIBS) \
- $(GL_LIBS)
-
-+if HAVE_PHYMEM
-+libgstgl_@GST_API_VERSION@_la_LIBADD += -lg2d
-+endif
-+
- if HAVE_WINDOW_WIN32
- SUBDIRS += win32
- libgstgl_@GST_API_VERSION@_la_LIBADD += win32/libgstgl-win32.la
-diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c
-index 218169a..1ca6d8c 100644
---- a/gst-libs/gst/gl/gstglbufferpool.c
-+++ b/gst-libs/gst/gl/gstglbufferpool.c
-@@ -26,6 +26,10 @@
- #include "gstglbufferpool.h"
- #include "gstglutils.h"
-
-+#if GST_GL_HAVE_PHYMEM
-+#include <gst/gl/gstglphymemory.h>
-+#endif
-+
- /**
- * SECTION:gstglbufferpool
- * @short_description: buffer pool for #GstGLMemory objects
-@@ -261,6 +265,18 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer,
- goto no_buffer;
- }
-
-+#if GST_GL_HAVE_PHYMEM
-+ if ((g_strcmp0 (priv->allocator->mem_type, GST_GL_PHY_MEM_ALLOCATOR) == 0)) {
-+ GstAllocator* allocator = (GstAllocator*) gst_phy_mem_allocator_obtain ();
-+ if (!gst_gl_physical_memory_setup_buffer (allocator, buf, priv->gl_params)) {
-+ GST_ERROR_OBJECT (pool, "Can't create physcial buffer.");
-+ return GST_FLOW_ERROR;
-+ }
-+ *buffer = buf;
-+ return GST_FLOW_OK;
-+ }
-+#endif
-+
- alloc = GST_GL_MEMORY_ALLOCATOR (priv->allocator);
- if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params, NULL, NULL, 0))
- goto mem_create_failed;
-diff --git a/gst-libs/gst/gl/gstglphymemory.c b/gst-libs/gst/gl/gstglphymemory.c
-new file mode 100644
-index 0000000..e28546c
---- /dev/null
-+++ b/gst-libs/gst/gl/gstglphymemory.c
-@@ -0,0 +1,254 @@
-+/*
-+ * GStreamer
-+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#include "gstglvivdirecttexture.h"
-+#include "gstglphymemory.h"
-+#include <g2d.h>
-+
-+GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_PHY_MEMORY);
-+#define GST_CAT_DEFAULT GST_CAT_GL_PHY_MEMORY
-+
-+typedef struct _GstPhyMemAllocator GstPhyMemAllocator;
-+typedef struct _GstPhyMemAllocatorClass GstPhyMemAllocatorClass;
-+
-+struct _GstPhyMemAllocator
-+{
-+ GstAllocatorPhyMem parent;
-+};
-+
-+struct _GstPhyMemAllocatorClass
-+{
-+ GstAllocatorPhyMemClass parent_class;
-+};
-+
-+GType gst_phy_mem_allocator_get_type (void);
-+G_DEFINE_TYPE (GstPhyMemAllocator, gst_phy_mem_allocator, GST_TYPE_ALLOCATOR_PHYMEM);
-+
-+static int
-+alloc_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk)
-+{
-+ struct g2d_buf *pbuf = NULL;
-+
-+ memblk->size = PAGE_ALIGN(memblk->size);
-+
-+ pbuf = g2d_alloc (memblk->size, 0);
-+ if (!pbuf) {
-+ GST_ERROR("G2D allocate %u bytes memory failed: %s",
-+ memblk->size, strerror(errno));
-+ return -1;
-+ }
-+
-+ memblk->vaddr = (guchar*) pbuf->buf_vaddr;
-+ memblk->paddr = (guchar*) pbuf->buf_paddr;
-+ memblk->user_data = (gpointer) pbuf;
-+ GST_DEBUG("G2D allocated memory (%p)", memblk->paddr);
-+
-+ return 1;
-+}
-+
-+static int
-+free_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk)
-+{
-+ GST_DEBUG("G2D free memory (%p)", memblk->paddr);
-+ gint ret = g2d_free ((struct g2d_buf*)(memblk->user_data));
-+ memblk->user_data = NULL;
-+ memblk->vaddr = NULL;
-+ memblk->paddr = NULL;
-+ memblk->size = 0;
-+
-+ return ret;
-+}
-+
-+static void
-+gst_phy_mem_allocator_class_init (GstPhyMemAllocatorClass * klass)
-+{
-+ GstAllocatorPhyMemClass *phy_allocator_klass = (GstAllocatorPhyMemClass *) klass;
-+
-+ phy_allocator_klass->alloc_phymem = alloc_phymem;
-+ phy_allocator_klass->free_phymem = free_phymem;
-+}
-+
-+static void
-+gst_phy_mem_allocator_init (GstPhyMemAllocator * allocator)
-+{
-+ GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-+
-+ alloc->mem_type = GST_GL_PHY_MEM_ALLOCATOR;
-+}
-+
-+
-+static gpointer
-+gst_phy_mem_allocator_init_instance (gpointer data)
-+{
-+ GstAllocator *allocator =
-+ g_object_new (gst_phy_mem_allocator_get_type (), NULL);
-+
-+ GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_PHY_MEMORY, "glphymemory", 0,
-+ "GLPhysical Memory");
-+
-+ gst_allocator_register (GST_GL_PHY_MEM_ALLOCATOR, gst_object_ref (allocator));
-+
-+ return allocator;
-+}
-+
-+static void
-+_finish_texture (GstGLContext * ctx, gpointer *data)
-+{
-+ GstGLFuncs *gl = ctx->gl_vtable;
-+
-+ gl->Finish ();
-+}
-+
-+static void
-+gst_gl_phy_mem_destroy (GstMemory *mem)
-+{
-+ gst_memory_unref (mem);
-+}
-+
-+
-+GstAllocator *
-+gst_phy_mem_allocator_obtain (void)
-+{
-+ static GOnce once = G_ONCE_INIT;
-+
-+ g_once (&once, gst_phy_mem_allocator_init_instance, NULL);
-+
-+ g_return_val_if_fail (once.retval != NULL, NULL);
-+
-+ return (GstAllocator *) (g_object_ref (once.retval));
-+}
-+
-+gboolean
-+gst_is_gl_physical_memory (GstMemory * mem)
-+{
-+ GstGLBaseMemory *glmem;
-+ g_return_val_if_fail (gst_is_gl_memory (mem), FALSE);
-+
-+ glmem = (GstGLBaseMemory*) mem;
-+
-+ if (glmem->user_data
-+ && GST_IS_MINI_OBJECT_TYPE(glmem->user_data, GST_TYPE_MEMORY))
-+ return gst_memory_is_type ((GstMemory*)glmem->user_data, GST_GL_PHY_MEM_ALLOCATOR);
-+ else
-+ return FALSE;
-+}
-+
-+gboolean
-+gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info)
-+{
-+ if (GST_VIDEO_INFO_IS_RGB(info)
-+ && gst_gl_is_directviv_supported_format (GST_VIDEO_INFO_FORMAT (info))) {
-+ return TRUE;
-+ }
-+ else
-+ return FALSE;
-+}
-+
-+gboolean
-+gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer,
-+ GstGLVideoAllocationParams * params)
-+{
-+ GstGLBaseMemoryAllocator *gl_alloc;
-+ GstMemory *mem = NULL;
-+ PhyMemBlock *memblk = NULL;
-+ GstGLMemory *glmem = NULL;
-+ gsize size;
-+
-+ GstVideoInfo * info = params->v_info;
-+ GstVideoAlignment * valign = params->valign;
-+
-+ GST_DEBUG ("glphymemory setup buffer format %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (info)));
-+
-+ if (!gst_is_gl_physical_memory_supported_fmt (info)) {
-+ GST_DEBUG ("Not support format.");
-+ return FALSE;
-+ }
-+
-+ //allocator = (GstAllocator*) gst_phy_mem_allocator_obtain ();
-+ size = gst_gl_get_plane_data_size (info, valign, 0);
-+ mem = gst_allocator_alloc (allocator, size, params->parent.alloc_params);
-+ if (!mem) {
-+ GST_DEBUG ("Can't allocate physical memory size %d", size);
-+ return FALSE;
-+ }
-+
-+ memblk = gst_memory_query_phymem_block (mem);
-+ if (!memblk) {
-+ GST_ERROR("Can't find physic memory block.");
-+ return FALSE;
-+ }
-+
-+ gl_alloc =
-+ GST_GL_BASE_MEMORY_ALLOCATOR (gst_gl_memory_allocator_get_default
-+ (params->parent.context));
-+
-+ params->plane = 0;
-+ params->parent.user_data = mem;
-+ params->parent.notify = gst_gl_phy_mem_destroy;
-+
-+ glmem = (GstGLMemory *)gst_gl_base_memory_alloc (gl_alloc, (GstGLAllocationParams *) params);
-+ if (!glmem) {
-+ GST_ERROR("Can't get gl memory.");
-+ return FALSE;
-+ }
-+
-+ gst_buffer_append_memory (buffer, (GstMemory *) glmem);
-+
-+ gst_buffer_add_video_meta_full (buffer, 0,
-+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
-+ GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride);
-+
-+ gst_gl_viv_direct_bind_data(params->parent.context, glmem->tex_id,
-+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
-+ GST_VIDEO_INFO_HEIGHT (info), memblk->vaddr, memblk->paddr);
-+
-+ return TRUE;
-+}
-+
-+GstBuffer *
-+gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx,
-+ GstVideoInfo * info, GstBuffer *glbuf)
-+{
-+ GstBuffer *buf;
-+ GstGLBaseMemory *glmem;
-+
-+ gst_gl_context_thread_add (ctx, (GstGLContextThreadFunc) _finish_texture, NULL);
-+
-+ glmem = gst_buffer_peek_memory (glbuf, 0);
-+
-+ buf = gst_buffer_new ();
-+ gst_buffer_append_memory (buf, (GstMemory *) glmem->user_data);
-+ gst_memory_ref ((GstMemory *)glmem->user_data);
-+
-+ gst_buffer_add_video_meta_full (buf, 0,
-+ GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
-+ GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride);
-+ GST_BUFFER_FLAGS (buf) = GST_BUFFER_FLAGS (glbuf);
-+ GST_BUFFER_PTS (buf) = GST_BUFFER_PTS (glbuf);
-+ GST_BUFFER_DTS (buf) = GST_BUFFER_DTS (glbuf);
-+ GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (glbuf);
-+
-+ return buf;
-+}
-+
-diff --git a/gst-libs/gst/gl/gstglphymemory.h b/gst-libs/gst/gl/gstglphymemory.h
-new file mode 100644
-index 0000000..ebb9911
---- /dev/null
-+++ b/gst-libs/gst/gl/gstglphymemory.h
-@@ -0,0 +1,43 @@
-+/*
-+ * GStreamer
-+ * Copyright (c) 2015, Freescale Semiconductor, Inc.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
-+ * Boston, MA 02110-1301, USA.
-+ */
-+
-+#ifndef _GST_GL_PHY_MEMORY_H_
-+#define _GST_GL_PHY_MEMORY_H_
-+
-+#include <gst/gst.h>
-+#include <gst/gstmemory.h>
-+#include <gst/video/video.h>
-+#include <gst/allocators/gstallocatorphymem.h>
-+
-+#include <gst/gl/gl.h>
-+
-+G_BEGIN_DECLS
-+
-+#define GST_GL_PHY_MEM_ALLOCATOR "GLPhyMemory"
-+
-+GstAllocator *gst_phy_mem_allocator_obtain (void);
-+gboolean gst_is_gl_physical_memory (GstMemory * mem);
-+gboolean gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info);
-+gboolean gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer, GstGLVideoAllocationParams * params);
-+GstBuffer * gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx, GstVideoInfo * info, GstBuffer *glbuf);
-+
-+G_END_DECLS
-+
-+#endif /* _GST_GL_PHY_MEMORY_H_ */
---
-1.9.1
-
+++ /dev/null
-From 64718397e93087ffe37ad3209535ef84e15854aa Mon Sep 17 00:00:00 2001
-From: Haihua Hu <b55597@freescale.com>
-Date: Thu, 25 Feb 2016 13:53:20 +0800
-Subject: [PATCH 16/26] glcolorconvert: convert YUV to RGB use directviv
-
-Add a property "disable_passthrough" in glcolorconvert for enable/disable passthrough.
-When need convert YUV to RGB with directviv, set it to be TRUE.
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Haihua Hu <b55597@freescale.com>
-
-Conflicts:
- gst-libs/gst/gl/gstglcolorconvert.c
----
- ext/gl/gstglcolorconvertelement.c | 70 +++++++++++++++++++++++++++++++++++++
- ext/gl/gstglcolorconvertelement.h | 1 +
- gst-libs/gst/gl/gstglcolorconvert.c | 6 +++-
- 3 files changed, 76 insertions(+), 1 deletion(-)
-
-diff --git a/ext/gl/gstglcolorconvertelement.c b/ext/gl/gstglcolorconvertelement.c
-index 642b494..5e26f84 100644
---- a/ext/gl/gstglcolorconvertelement.c
-+++ b/ext/gl/gstglcolorconvertelement.c
-@@ -35,6 +35,14 @@ G_DEFINE_TYPE_WITH_CODE (GstGLColorConvertElement, gst_gl_color_convert_element,
- "glconvertelement", 0, "convert");
- );
-
-+enum
-+{
-+ GL_COLOR_CONVERT_PROP_0,
-+ GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH
-+};
-+
-+#define DISABLE_PASSTHROUGH_DAFAULT FALSE
-+
- static gboolean gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
- GstCaps * in_caps, GstCaps * out_caps);
- static GstCaps *gst_gl_color_convert_element_transform_caps (GstBaseTransform *
-@@ -54,6 +62,15 @@ static GstFlowReturn gst_gl_color_convert_element_transform (GstBaseTransform *
- static GstCaps *gst_gl_color_convert_element_fixate_caps (GstBaseTransform *
- bt, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
-
-+static void gst_gl_color_convert_set_property (GObject *object,
-+ guint prop_id,
-+ const GValue *value,
-+ GParamSpec *pspec);
-+static void gst_gl_color_convert_get_property (GObject *object,
-+ guint prop_id,
-+ GValue *value,
-+ GParamSpec *pspec);
-+
- static GstStaticPadTemplate gst_gl_color_convert_element_src_pad_template =
- GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
-@@ -89,6 +106,10 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass)
- {
- GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass);
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
-+
-+ object_class->set_property = gst_gl_color_convert_set_property;
-+ object_class->get_property = gst_gl_color_convert_get_property;
-
- bt_class->transform_caps = gst_gl_color_convert_element_transform_caps;
- bt_class->set_caps = gst_gl_color_convert_element_set_caps;
-@@ -108,6 +129,13 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass)
- gst_element_class_add_static_pad_template (element_class,
- &gst_gl_color_convert_element_sink_pad_template);
-
-+ g_object_class_install_property (object_class, GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH,
-+ g_param_spec_boolean ("disable_passthrough",
-+ "Disable passthrough",
-+ "Disable passthrough mode",
-+ DISABLE_PASSTHROUGH_DAFAULT,
-+ G_PARAM_READWRITE));
-+
- gst_element_class_set_metadata (element_class,
- "OpenGL color converter", "Filter/Converter/Video",
- "Converts between color spaces using OpenGL shaders",
-@@ -119,6 +147,41 @@ gst_gl_color_convert_element_init (GstGLColorConvertElement * convert)
- {
- gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (convert),
- TRUE);
-+ convert->disable_passthrough = FALSE;
-+}
-+
-+static void
-+gst_gl_color_convert_set_property (GObject *object,
-+ guint prop_id,
-+ const GValue *value,
-+ GParamSpec *pspec)
-+{
-+ GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object);
-+ switch (prop_id) {
-+ case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH:
-+ convert->disable_passthrough = g_value_get_boolean (value);
-+ break;
-+ default:
-+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-+ break;
-+ }
-+}
-+
-+static void
-+gst_gl_color_convert_get_property (GObject *object,
-+ guint prop_id,
-+ GValue *value,
-+ GParamSpec *pspec)
-+{
-+ GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object);
-+ switch (prop_id) {
-+ case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH:
-+ g_value_set_boolean (value, convert->disable_passthrough);
-+ break;
-+ default:
-+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-+ break;
-+ }
- }
-
- static gboolean
-@@ -133,6 +196,13 @@ gst_gl_color_convert_element_set_caps (GstBaseTransform * bt,
- if (convert->convert)
- gst_gl_color_convert_set_caps (convert->convert, in_caps, out_caps);
-
-+ if(gst_base_transform_is_passthrough (bt) && convert->disable_passthrough){
-+ /* if in passthrough mode and disable_passthrough is set to true,
-+ * set passthrough to FALSE*/
-+ GST_DEBUG_OBJECT(convert, "Disable passthrough mode");
-+ gst_base_transform_set_passthrough(bt, FALSE);
-+ }
-+
- return TRUE;
- }
-
-diff --git a/ext/gl/gstglcolorconvertelement.h b/ext/gl/gstglcolorconvertelement.h
-index 2a0dd1d..5cdbd3a 100644
---- a/ext/gl/gstglcolorconvertelement.h
-+++ b/ext/gl/gstglcolorconvertelement.h
-@@ -47,6 +47,7 @@ struct _GstGLColorConvertElement
- GstGLColorConvert *convert;
- GstCaps *in_caps;
- GstCaps *out_caps;
-+ gboolean disable_passthrough;
- };
-
- struct _GstGLColorConvertElementClass
-diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c
-index 908a53e..4f072f5 100644
---- a/gst-libs/gst/gl/gstglcolorconvert.c
-+++ b/gst-libs/gst/gl/gstglcolorconvert.c
-@@ -710,7 +710,11 @@ _gst_gl_color_convert_set_caps_unlocked (GstGLColorConvert * convert,
- convert->priv->to_texture_target = to_target;
- convert->initted = FALSE;
-
-- convert->passthrough = passthrough;
-+ /* We may disable passthrough via an external property
-+ * By the way, when glconvertelement is in passthrough mode,
-+ * the plugin will not call gst_gl_color_convert_perform().*/
-+
-+ //convert->passthrough = passthrough;
- #ifndef GST_DISABLE_GST_DEBUG
- if (G_UNLIKELY (convert->passthrough))
- GST_DEBUG_OBJECT (convert,
---
-1.9.1
-
+++ /dev/null
-From 99b8b8f92e3785ff05f30c9c1e4a722593dfc492 Mon Sep 17 00:00:00 2001
-From: Haihua Hu <b55597@freescale.com>
-Date: Wed, 9 Mar 2016 13:00:39 +0800
-Subject: [PATCH 17/26] glwindow: work around for no frame when imxplayer use
- glimagesink
-
-change parent window of internal_window in window_show function.
-
-Upstream Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Haihua Hu <b55597@freescale.com>
----
- gst-libs/gst/gl/x11/gstglwindow_x11.c | 14 +++++++++++---
- 1 file changed, 11 insertions(+), 3 deletions(-)
-
-diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c
-index d08b757..bc7b9c0 100644
---- a/gst-libs/gst/gl/x11/gstglwindow_x11.c
-+++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c
-@@ -322,13 +322,13 @@ gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id)
- g_main_context_get_thread_default ());
- }
-
-- XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
-+ /*XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr);
-
- XResizeWindow (window_x11->device, window_x11->internal_win_id,
- attr.width, attr.height);
-
- XReparentWindow (window_x11->device, window_x11->internal_win_id,
-- window_x11->parent_win, 0, 0);
-+ window_x11->parent_win, 0, 0);*/
-
- XSync (window_x11->device, FALSE);
- }
-@@ -359,7 +359,7 @@ _show_window (GstGLWindow * window)
- GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window);
- guint width = window_x11->priv->preferred_width;
- guint height = window_x11->priv->preferred_height;
-- XWindowAttributes attr;
-+ XWindowAttributes attr, parent_attr;
-
- XGetWindowAttributes (window_x11->device, window_x11->internal_win_id, &attr);
-
-@@ -371,6 +371,14 @@ _show_window (GstGLWindow * window)
- XResizeWindow (window_x11->device, window_x11->internal_win_id,
- attr.width, attr.height);
- XSync (window_x11->device, FALSE);
-+ }else{
-+ XGetWindowAttributes (window_x11->device, window_x11->parent_win, &parent_attr);
-+
-+ XResizeWindow (window_x11->device, window_x11->internal_win_id,
-+ parent_attr.width, parent_attr.height);
-+
-+ XReparentWindow (window_x11->device, window_x11->internal_win_id,
-+ window_x11->parent_win, 0, 0);
- }
-
- XMapWindow (window_x11->device, window_x11->internal_win_id);
---
-1.9.1
-
+++ /dev/null
-From f705c7bbc8274b6824a9063161263cb16af9d15d Mon Sep 17 00:00:00 2001
-From: Haihua Hu <jared.hu@nxp.com>
-Date: Mon, 14 Nov 2016 10:53:27 +0800
-Subject: [PATCH 18/26] glcolorconvert: fix MRT cannot work in GLES3.0
-
-use glBlitFramebuffer for textures copy if it is available
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Haihua Hu <jared.hu@nxp.com>
----
- gst-libs/gst/gl/glprototypes/fbo.h | 6 ++---
- gst-libs/gst/gl/gstglmemory.c | 54 ++++++++++++++++++++++++++++++++------
- 2 files changed, 49 insertions(+), 11 deletions(-)
-
-diff --git a/gst-libs/gst/gl/glprototypes/fbo.h b/gst-libs/gst/gl/glprototypes/fbo.h
-index d142483..789f289 100644
---- a/gst-libs/gst/gl/glprototypes/fbo.h
-+++ b/gst-libs/gst/gl/glprototypes/fbo.h
-@@ -102,9 +102,9 @@ GST_GL_EXT_FUNCTION (GLboolean, IsFramebuffer,
- GST_GL_EXT_END ()
-
- GST_GL_EXT_BEGIN (offscreen_blit,
-- GST_GL_API_NONE,
-- 255, 255,
-- 255, 255, /* not in either GLES */
-+ GST_GL_API_OPENGL3 | GST_GL_API_GLES2,
-+ 3, 0,
-+ 3, 0,/* enable to avoid using glCopyTexImage2D for texture copying */
- "EXT\0ANGLE\0",
- "framebuffer_blit\0")
- GST_GL_EXT_FUNCTION (void, BlitFramebuffer,
-diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c
-index 73c3b59..6f9794f 100644
---- a/gst-libs/gst/gl/gstglmemory.c
-+++ b/gst-libs/gst/gl/gstglmemory.c
-@@ -69,6 +69,12 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY);
- #ifndef GL_TEXTURE_EXTERNAL_OES
- #define GL_TEXTURE_EXTERNAL_OES 0x8D65
- #endif
-+#ifndef GL_READ_FRAMEBUFFER
-+#define GL_READ_FRAMEBUFFER 0x8CA8
-+#endif
-+#ifndef GL_DRAW_FRAMEBUFFER
-+#define GL_DRAW_FRAMEBUFFER 0x8CA9
-+#endif
-
- G_DEFINE_TYPE (GstGLMemoryAllocator, gst_gl_memory_allocator,
- GST_TYPE_GL_BASE_MEMORY_ALLOCATOR);
-@@ -626,7 +632,7 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
- guint out_gl_format, out_tex_target;
- GstMapInfo sinfo;
- guint src_tex_id;
-- guint fbo;
-+ guint fbo[2];
-
- gl = src->mem.context->gl_vtable;
- out_tex_target = gst_gl_texture_target_to_gl (out_target);
-@@ -659,31 +665,63 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id,
-
- /* FIXME: try and avoid creating and destroying fbo's every copy... */
- /* create a framebuffer object */
-- gl->GenFramebuffers (1, &fbo);
-- gl->BindFramebuffer (GL_FRAMEBUFFER, fbo);
-+ gl->GenFramebuffers (2, &fbo[0]);
-+ gl->BindFramebuffer (GL_READ_FRAMEBUFFER, fbo[0]);
-
-- gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-+ gl->FramebufferTexture2D (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
- gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0);
-
--// if (!gst_gl_context_check_framebuffer_status (src->context))
--// goto fbo_error;
-+ if (!gst_gl_context_check_framebuffer_status (src->mem.context))
-+ goto fbo_error;
-+
-+ gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[1]);
-+
-+ gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-+ gst_gl_texture_target_to_gl (src->tex_target), tex_id, 0);
-
-+ if (!gst_gl_context_check_framebuffer_status (src->mem.context))
-+ goto fbo_error;
-+
-+ /*
- gl->BindTexture (out_tex_target, tex_id);
- gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query,
- GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "CopyTexImage2D took");
- gl->CopyTexImage2D (out_tex_target, 0, out_gl_format, 0, 0, out_width,
- out_height, 0);
- gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query);
--
-+ */
-+
-+ /*
-+ * glCopyTexImage2D cannot work without internal_format
-+ * we cannot get the internal_format in this function
-+ * so use glBlitFramebuffer for texture copy
-+ */
-+ GST_CAT_LOG(GST_CAT_GL_MEMORY,"Use BlitFramebuffer copy texture %d into %d",
-+ src_tex_id, tex_id);
-+ gl->ReadBuffer ( GL_COLOR_ATTACHMENT0 );
-+ gl->BlitFramebuffer ( 0, 0, out_width, out_height,
-+ 0, 0, out_width, out_height,
-+ GL_COLOR_BUFFER_BIT, GL_LINEAR );
- gl->BindTexture (out_tex_target, 0);
- gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
-
-- gl->DeleteFramebuffers (1, &fbo);
-+ gl->DeleteFramebuffers (2, &fbo[0]);
-
- gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
-
- return TRUE;
-
-+fbo_error:
-+ {
-+ gl->BindTexture (out_tex_target, 0);
-+ gl->BindFramebuffer (GL_FRAMEBUFFER, 0);
-+
-+ gl->DeleteFramebuffers (2, &fbo[0]);
-+
-+ gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo);
-+
-+ return FALSE;
-+ }
- error:
- return FALSE;
- }
---
-1.9.1
-
+++ /dev/null
-# Vivante EGL headers require the correct preprocessor
-# defines to be set for each platform
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-
-PACKAGECONFIG_GL_imxgpu2d = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'opengl', '', d)}"
-
-PACKAGECONFIG_GL_imxgpu3d = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles2', '', d)}"
-
-
-SRC_URI_append_imxgpu2d = " \
- file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \
- file://0002-Support-fb-backend-for-gl-plugins.patch \
- file://0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch \
- file://0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with.patch \
- file://0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \
- file://0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch \
- file://0007-glcolorconvert-fix-MRT-cannot-work-in-GLES3.0.patch \
-"
-
-
-PACKAGE_ARCH_imxgpu2d = "${MACHINE_SOCARCH}"
+++ /dev/null
-From f19e83a1a69a3dbbeb16dc4bcee3fb87317bb65b Mon Sep 17 00:00:00 2001
-From: Song Bing <b06498@freescale.com>
-Date: Mon, 11 Jan 2016 14:51:17 +0800
-Subject: [PATCH] MMFMWK-7030 [Linux_MX6QP_ARD]IMXCameraApp:When Enabled "save
- time to image" item, preview, find the time can not display
- completely. 100%
-
-As IPU need 8 pixels alignment, add one workaround in base text overlay
-to generate 8 pixels alignment text video buffer. The side effect should
-cause all text a little smaller.
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Song Bing b06498@freescale.com
----
- ext/pango/gstbasetextoverlay.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c
-index 3e98aa1..de64c92 100755
---- a/ext/pango/gstbasetextoverlay.c
-+++ b/ext/pango/gstbasetextoverlay.c
-@@ -1545,7 +1545,7 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay,
- gint unscaled_width, unscaled_height;
- gint width, height;
- gboolean full_width = FALSE;
-- double scalef = 1.0;
-+ double scalef = 1.0, scalefx, scalefy;
- double a, r, g, b;
- gdouble shadow_offset = 0.0;
- gdouble outline_offset = 0.0;
-@@ -1673,6 +1673,14 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay,
- height = ceil (height * overlay->render_scale);
- scalef *= overlay->render_scale;
-
-+ /* i.MX special, will cause text a little small */
-+ scalefx = scalef * ((gdouble)GST_ROUND_DOWN_8 (width)) / width;
-+ scalefy = scalef * ((gdouble)GST_ROUND_DOWN_8 (height)) / height;
-+ width = GST_ROUND_DOWN_8 (width);
-+ height = GST_ROUND_DOWN_8 (height);
-+ GST_DEBUG_OBJECT (overlay, "Rendering with width %d and height %d "
-+ , width, height);
-+
- if (width <= 0 || height <= 0) {
- g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock);
- GST_DEBUG_OBJECT (overlay,
-@@ -1689,7 +1697,7 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay,
- /* Prepare the transformation matrix. Note that the transformation happens
- * in reverse order. So for horizontal text, we will translate and then
- * scale. This is important to understand which scale shall be used. */
-- cairo_matrix_init_scale (&cairo_matrix, scalef, scalef);
-+ cairo_matrix_init_scale (&cairo_matrix, scalefx, scalefy);
-
- if (overlay->use_vertical_render) {
- gint tmp;
---
-1.7.9.5
-
+++ /dev/null
-From 950fe3a224eb5339c946193413f9373c333ea1f0 Mon Sep 17 00:00:00 2001
-From: Haihua Hu <jared.hu@nxp.com>
-Date: Fri, 5 Aug 2016 17:08:40 +0800
-Subject: [PATCH] [MMFMWK-7259] Remove dependence on imx plugin git.
-
-Add physical memory allocator
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Haihua Hu <jared.hu@nxp.com>
----
- gst-libs/gst/allocators/Makefile.am | 6 +-
- gst-libs/gst/allocators/gstallocatorphymem.c | 314 +++++++++++++++++++++++++++
- gst-libs/gst/allocators/gstallocatorphymem.h | 64 ++++++
- 3 files changed, 382 insertions(+), 2 deletions(-)
- create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.c
- create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.h
-
-diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am
-index 5c11b8a..13ffd9c 100644
---- a/gst-libs/gst/allocators/Makefile.am
-+++ b/gst-libs/gst/allocators/Makefile.am
-@@ -5,13 +5,15 @@ libgstallocators_@GST_API_VERSION@_includedir = $(includedir)/gstreamer-@GST_API
- libgstallocators_@GST_API_VERSION@_include_HEADERS = \
- allocators.h \
- gstfdmemory.h \
-- gstdmabuf.h
-+ gstdmabuf.h \
-+ gstallocatorphymem.h
-
- noinst_HEADERS =
-
- libgstallocators_@GST_API_VERSION@_la_SOURCES = \
- gstfdmemory.c \
-- gstdmabuf.c
-+ gstdmabuf.c \
-+ gstallocatorphymem.c
-
- libgstallocators_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS) $(LIBM)
- libgstallocators_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
-diff --git a/gst-libs/gst/allocators/gstallocatorphymem.c b/gst-libs/gst/allocators/gstallocatorphymem.c
-new file mode 100755
-index 0000000..cf5995e
---- /dev/null
-+++ b/gst-libs/gst/allocators/gstallocatorphymem.c
-@@ -0,0 +1,314 @@
-+/*
-+ * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ * Boston, MA 02111-1307, USA.
-+ */
-+
-+#include <stdio.h>
-+#include <string.h>
-+#include "gstallocatorphymem.h"
-+
-+typedef struct {
-+ GstMemory mem;
-+ guint8 *vaddr;
-+ guint8 *paddr;
-+ PhyMemBlock block;
-+} GstMemoryPhy;
-+
-+static int
-+default_copy (GstAllocatorPhyMem *allocator, PhyMemBlock *dst_mem,
-+ PhyMemBlock *src_mem, guint offset, guint size)
-+{
-+ GST_WARNING ("No default copy implementation for physical memory allocator.\n");
-+ return -1;
-+}
-+
-+static gpointer
-+gst_phymem_map (GstMemory * mem, gsize maxsize, GstMapFlags flags)
-+{
-+ GstMemoryPhy *phymem = (GstMemoryPhy*) mem;
-+
-+ if (GST_MEMORY_IS_READONLY(mem) && (flags & GST_MAP_WRITE)) {
-+ GST_ERROR("memory is read only");
-+ return NULL;
-+ }
-+
-+ return phymem->vaddr;
-+}
-+
-+static void
-+gst_phymem_unmap (GstMemory * mem)
-+{
-+ return;
-+}
-+
-+static GstMemory *
-+gst_phymem_copy (GstMemory * mem, gssize offset, gssize size)
-+{
-+ GstAllocatorPhyMemClass *klass;
-+ GstMemoryPhy *src_mem = (GstMemoryPhy *)mem;
-+
-+ GstMemoryPhy *dst_mem = g_slice_alloc(sizeof(GstMemoryPhy));
-+ if(dst_mem == NULL) {
-+ GST_ERROR("Can't allocate for GstMemoryPhy structure.\n");
-+ return NULL;
-+ }
-+
-+ klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(mem->allocator));
-+ if(klass == NULL) {
-+ GST_ERROR("Can't get class from allocator object.\n");
-+ return NULL;
-+ }
-+
-+ if(klass->copy_phymem((GstAllocatorPhyMem*)mem->allocator,
-+ &dst_mem->block, &src_mem->block, offset, size) < 0) {
-+ GST_WARNING ("Copy phymem %d failed.\n", size);
-+ return NULL;
-+ }
-+
-+ GST_DEBUG ("copied phymem, vaddr(%p), paddr(%p), size(%d).\n",
-+ dst_mem->block.vaddr, dst_mem->block.paddr, dst_mem->block.size);
-+
-+ dst_mem->vaddr = dst_mem->block.vaddr;
-+ dst_mem->paddr = dst_mem->block.paddr;
-+
-+ gst_memory_init (GST_MEMORY_CAST (dst_mem),
-+ mem->mini_object.flags&(~GST_MEMORY_FLAG_READONLY),
-+ mem->allocator, NULL, mem->maxsize, mem->align,
-+ mem->offset, mem->size);
-+
-+ return (GstMemory*)dst_mem;
-+}
-+
-+static GstMemory *
-+gst_phymem_share (GstMemory * mem, gssize offset, gssize size)
-+{
-+ GST_ERROR("Not implemented mem_share in gstallocatorphymem.\n");
-+ return NULL;
-+}
-+
-+static gboolean
-+gst_phymem_is_span (GstMemory * mem1, GstMemory * mem2, gsize * offset)
-+{
-+ return FALSE;
-+}
-+
-+static gpointer
-+gst_phymem_get_phy (GstMemory * mem)
-+{
-+ GstMemoryPhy *phymem = (GstMemoryPhy*) mem;
-+
-+ return phymem->paddr;
-+}
-+
-+static GstMemory *
-+base_alloc (GstAllocator * allocator, gsize size,
-+ GstAllocationParams * params)
-+{
-+ GstAllocatorPhyMemClass *klass;
-+ GstMemoryPhy *mem;
-+ gsize maxsize, aoffset, offset, align, padding;
-+ guint8 *data;
-+
-+ mem = g_slice_alloc(sizeof(GstMemoryPhy));
-+ if(mem == NULL) {
-+ GST_ERROR("Can allocate for GstMemoryPhy structure.\n");
-+ return NULL;
-+ }
-+
-+ klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator));
-+ if(klass == NULL) {
-+ GST_ERROR("Can't get class from allocator object.\n");
-+ return NULL;
-+ }
-+
-+ GST_DEBUG ("allocate params, prefix (%d), padding (%d), align (%d), flags (%x).\n",
-+ params->prefix, params->padding, params->align, params->flags);
-+
-+ maxsize = size + params->prefix + params->padding;
-+ mem->block.size = maxsize;
-+ if(klass->alloc_phymem((GstAllocatorPhyMem*)allocator, &mem->block) < 0) {
-+ GST_ERROR("Allocate phymem %d failed.\n", maxsize);
-+ return NULL;
-+ }
-+
-+ GST_DEBUG ("allocated phymem, vaddr(%p), paddr(%p), size(%d).\n",
-+ mem->block.vaddr, mem->block.paddr, mem->block.size);
-+
-+ data = mem->block.vaddr;
-+ offset = params->prefix;
-+ align = params->align;
-+ /* do alignment */
-+ if ((aoffset = ((guintptr)data & align))) {
-+ aoffset = (align + 1) - aoffset;
-+ data += aoffset;
-+ maxsize -= aoffset;
-+ }
-+ mem->vaddr = mem->block.vaddr + aoffset;
-+ mem->paddr = mem->block.paddr + aoffset;
-+
-+ GST_DEBUG ("aligned vaddr(%p), paddr(%p), size(%d).\n",
-+ mem->block.vaddr, mem->block.paddr, mem->block.size);
-+
-+ if (offset && (params->flags & GST_MEMORY_FLAG_ZERO_PREFIXED))
-+ memset (data, 0, offset);
-+
-+ padding = maxsize - (offset + size);
-+ if (padding && (params->flags & GST_MEMORY_FLAG_ZERO_PADDED))
-+ memset (data + offset + size, 0, padding);
-+
-+ gst_memory_init (GST_MEMORY_CAST (mem), params->flags, allocator, NULL, maxsize, align, offset, size);
-+
-+ return (GstMemory*)mem;
-+}
-+
-+static void
-+base_free (GstAllocator * allocator, GstMemory * mem)
-+{
-+ GstAllocatorPhyMemClass *klass;
-+ GstMemoryPhy *phymem;
-+
-+ klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator));
-+ if(klass == NULL) {
-+ GST_ERROR("Can't get class from allocator object, can't free %p\n", mem);
-+ return;
-+ }
-+
-+ phymem = (GstMemoryPhy*)mem;
-+
-+ GST_DEBUG ("free phymem, vaddr(%p), paddr(%p), size(%d).\n",
-+ phymem->block.vaddr, phymem->block.paddr, phymem->block.size);
-+
-+ klass->free_phymem((GstAllocatorPhyMem*)allocator, &phymem->block);
-+ g_slice_free1(sizeof(GstMemoryPhy), mem);
-+
-+ return;
-+}
-+
-+static int
-+default_alloc (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem)
-+{
-+ GST_ERROR ("No default allocating implementation for physical memory allocation.\n");
-+ return -1;
-+}
-+
-+static int
-+default_free (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem)
-+{
-+ GST_ERROR ("No default free implementation for physical memory allocation.\n");
-+ return -1;
-+}
-+
-+G_DEFINE_TYPE (GstAllocatorPhyMem, gst_allocator_phymem, GST_TYPE_ALLOCATOR);
-+
-+static void
-+gst_allocator_phymem_class_init (GstAllocatorPhyMemClass * klass)
-+{
-+ GstAllocatorClass *allocator_class;
-+
-+ allocator_class = (GstAllocatorClass *) klass;
-+
-+ allocator_class->alloc = base_alloc;
-+ allocator_class->free = base_free;
-+ klass->alloc_phymem = default_alloc;
-+ klass->free_phymem = default_free;
-+ klass->copy_phymem = default_copy;
-+}
-+
-+static void
-+gst_allocator_phymem_init (GstAllocatorPhyMem * allocator)
-+{
-+ GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator);
-+
-+ alloc->mem_map = gst_phymem_map;
-+ alloc->mem_unmap = gst_phymem_unmap;
-+ alloc->mem_copy = gst_phymem_copy;
-+ alloc->mem_share = gst_phymem_share;
-+ alloc->mem_is_span = gst_phymem_is_span;
-+}
-+
-+
-+//global functions
-+
-+gboolean
-+gst_buffer_is_phymem (GstBuffer *buffer)
-+{
-+ gboolean ret = FALSE;
-+ PhyMemBlock * memblk;
-+ GstMemory *mem = gst_buffer_get_memory (buffer, 0);
-+ if(mem == NULL) {
-+ GST_ERROR ("Not get memory from buffer.\n");
-+ return FALSE;
-+ }
-+
-+ if(GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) {
-+ if (NULL == ((GstMemoryPhy*)mem)->block.paddr) {
-+ GST_WARNING("physical address in memory block is invalid");
-+ ret = FALSE;
-+ } else {
-+ ret = TRUE;
-+ }
-+ }
-+
-+ gst_memory_unref (mem);
-+
-+ return ret;
-+}
-+
-+PhyMemBlock *
-+gst_buffer_query_phymem_block (GstBuffer *buffer)
-+{
-+ GstMemory *mem;
-+ GstMemoryPhy *memphy;
-+ PhyMemBlock *memblk;
-+
-+ mem = gst_buffer_get_memory (buffer, 0);
-+ if(mem == NULL) {
-+ GST_ERROR ("Not get memory from buffer.\n");
-+ return NULL;
-+ }
-+
-+ if(!GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) {
-+ gst_memory_unref (mem);
-+ return NULL;
-+ }
-+
-+ memphy = (GstMemoryPhy*) mem;
-+ memblk = &memphy->block;
-+
-+ gst_memory_unref (mem);
-+
-+ return memblk;
-+}
-+
-+PhyMemBlock *
-+gst_memory_query_phymem_block (GstMemory *mem)
-+{
-+ GstMemoryPhy *memphy;
-+ PhyMemBlock *memblk;
-+
-+ if (!mem)
-+ return NULL;
-+
-+ if (!GST_IS_ALLOCATOR_PHYMEM(mem->allocator))
-+ return NULL;
-+
-+ memphy = (GstMemoryPhy*) mem;
-+ memblk = &memphy->block;
-+
-+ return memblk;
-+}
-+
-diff --git a/gst-libs/gst/allocators/gstallocatorphymem.h b/gst-libs/gst/allocators/gstallocatorphymem.h
-new file mode 100755
-index 0000000..f0833ae
---- /dev/null
-+++ b/gst-libs/gst/allocators/gstallocatorphymem.h
-@@ -0,0 +1,64 @@
-+/*
-+ * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved.
-+ *
-+ * This library is free software; you can redistribute it and/or
-+ * modify it under the terms of the GNU Library General Public
-+ * License as published by the Free Software Foundation; either
-+ * version 2 of the License, or (at your option) any later version.
-+ *
-+ * This library is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-+ * Library General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU Library General Public
-+ * License along with this library; if not, write to the
-+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-+ * Boston, MA 02111-1307, USA.
-+ */
-+
-+#ifndef __ALLOCATOR_PHYMEM_H__
-+#define __ALLOCATOR_PHYMEM_H__
-+
-+#include <gst/gst.h>
-+#include <gst/gstallocator.h>
-+
-+#define PAGE_ALIGN(x) (((x) + 4095) & ~4095)
-+
-+#define GST_TYPE_ALLOCATOR_PHYMEM (gst_allocator_phymem_get_type())
-+#define GST_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMem))
-+#define GST_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMemClass))
-+#define GST_IS_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ALLOCATOR_PHYMEM))
-+#define GST_IS_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ALLOCATOR_PHYMEM))
-+
-+typedef struct _GstAllocatorPhyMem GstAllocatorPhyMem;
-+typedef struct _GstAllocatorPhyMemClass GstAllocatorPhyMemClass;
-+
-+/* also change gst-libs/gst/gl/gstglvivdirecttexture.c in gst-plugins-bad git
-+ * if changed below structure */
-+typedef struct {
-+ guint8 *vaddr;
-+ guint8 *paddr;
-+ guint8 *caddr;
-+ gsize size;
-+ gpointer *user_data;
-+} PhyMemBlock;
-+
-+struct _GstAllocatorPhyMem {
-+ GstAllocator parent;
-+};
-+
-+struct _GstAllocatorPhyMemClass {
-+ GstAllocatorClass parent_class;
-+ int (*alloc_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem);
-+ int (*free_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem);
-+ int (*copy_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *det_mem,
-+ PhyMemBlock *src_mem, guint offset, guint size);
-+};
-+
-+GType gst_allocator_phymem_get_type (void);
-+gboolean gst_buffer_is_phymem (GstBuffer *buffer);
-+PhyMemBlock *gst_buffer_query_phymem_block (GstBuffer *buffer);
-+PhyMemBlock *gst_memory_query_phymem_block (GstMemory *mem);
-+
-+#endif
---
-1.9.1
-
+++ /dev/null
-From 7847d85e7f37a4a40e483f3b3095c7f8a9fdf5ee Mon Sep 17 00:00:00 2001
-From: Mingke Wang <mingke.wang@freescale.com>
-Date: Thu, 19 Mar 2015 14:15:25 +0800
-Subject: [PATCH 02/13] gstplaysink: don't set async of custom text-sink to
- false
-
-Setting async to false leads to A/V sync problem when seeking.
-The preroll need to use GAP event instead of set async to false.
-
-Upstream-Status: Inappropriate [i.MX specific]
-
-Signed-off-by: Mingke Wang <mingke.wang@freescale.com>
----
- gst/playback/gstplaysink.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
- mode change 100644 => 100755 gst/playback/gstplaysink.c
-
-diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c
-old mode 100644
-new mode 100755
-index eaac018..02d019e
---- a/gst/playback/gstplaysink.c
-+++ b/gst/playback/gstplaysink.c
-@@ -2430,7 +2430,7 @@ gen_text_chain (GstPlaySink * playsink)
- G_TYPE_BOOLEAN);
- if (elem) {
- /* make sure the sparse subtitles don't participate in the preroll */
-- g_object_set (elem, "async", FALSE, NULL);
-+ //g_object_set (elem, "async", FALSE, NULL);
- GST_DEBUG_OBJECT (playsink, "adding custom text sink");
- gst_bin_add (bin, chain->sink);
- /* NOTE streamsynchronizer needs streams decoupled */
---
-1.9.1
-
+++ /dev/null
-From 9cfb86cd100904f0ef2626f348695bd2d3416c6a Mon Sep 17 00:00:00 2001
-From: Jian Li <jian.li@freescale.com>
-Date: Mon, 23 Jun 2014 14:14:07 +0800
-Subject: [PATCH] gstplaybin remove default deinterlace flag
-
-- remove default deinterlace flag in playbin for i.MX SoCs
-
-Upstream-Status: Inappropriate [platform specific]
-
-Signed-off-by: Jian Li <jian.li@freescale.com>
----
- gst/playback/gstplaybin2.c | 3 +--
- 1 file changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c
-index fc02ca3..c342438 100644
---- a/gst/playback/gstplaybin2.c
-+++ b/gst/playback/gstplaybin2.c
-@@ -511,8 +511,7 @@ struct _GstPlayBinClass
- #define DEFAULT_SUBURI NULL
- #define DEFAULT_SOURCE NULL
- #define DEFAULT_FLAGS GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_TEXT | \
-- GST_PLAY_FLAG_SOFT_VOLUME | GST_PLAY_FLAG_DEINTERLACE | \
-- GST_PLAY_FLAG_SOFT_COLORBALANCE
-+ GST_PLAY_FLAG_SOFT_VOLUME
- #define DEFAULT_N_VIDEO 0
- #define DEFAULT_CURRENT_VIDEO -1
- #define DEFAULT_N_AUDIO 0
---
-1.7.9.5
-
+++ /dev/null
-FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-
-GST_IMX_PATCHES = " file://gstplaybin-remove-flag-deinterlace.patch \
- file://0001-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch \
- file://0002-Remove-dependence-on-imx-plugin-git.patch \
- file://0003-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch \
-"
-
-GST_IMX_PATCHES_TO_APPEND = ""
-GST_IMX_PATCHES_TO_APPEND_imxpxp = "${GST_IMX_PATCHES}"
-GST_IMX_PATCHES_TO_APPEND_imxvpu = "${GST_IMX_PATCHES}"
-
-SRC_URI_append = "${GST_IMX_PATCHES_TO_APPEND}"
-
-PACKAGE_ARCH_imxpxp = "${MACHINE_SOCARCH}"
-PACKAGE_ARCH_imxvpu = "${MACHINE_SOCARCH}"