diff options
13 files changed, 0 insertions, 2922 deletions
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-glplugin-Change-wayland-default-res-to-1024x768.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-glplugin-Change-wayland-default-res-to-1024x768.patch deleted file mode 100644 index ee1cffbb7..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0001-glplugin-Change-wayland-default-res-to-1024x768.patch +++ /dev/null | |||
| @@ -1,42 +0,0 @@ | |||
| 1 | From bb2db3bb88e1f72b611c1ae1cc4854bf570daac8 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jian <Jian.Li@freescale.com> | ||
| 3 | Date: Tue, 17 Nov 2015 14:39:07 +0800 | ||
| 4 | Subject: [PATCH 10/18] [glplugin] Change wayland default res to 1024x768 | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | Change wayland backend default window resolution | ||
| 10 | from 320x240 to 1024x768 | ||
| 11 | |||
| 12 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 13 | |||
| 14 | Signed-off-by: Jian <Jian.Li@freescale.com> | ||
| 15 | Signed-off-by: Lyon Wang <lyon.wang@freescale.com> | ||
| 16 | --- | ||
| 17 | gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | 4 ++-- | ||
| 18 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | ||
| 21 | index 6e1f0c5..48b37a2 100644 | ||
| 22 | --- a/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | ||
| 23 | +++ b/gst-libs/gst/gl/wayland/gstglwindow_wayland_egl.c | ||
| 24 | @@ -305,13 +305,13 @@ create_surfaces (GstGLWindowWaylandEGL * window_egl) | ||
| 25 | if (window_egl->window.window_width > 0) | ||
| 26 | width = window_egl->window.window_width; | ||
| 27 | else | ||
| 28 | - width = 320; | ||
| 29 | + width = 1024; | ||
| 30 | window_egl->window.window_width = width; | ||
| 31 | |||
| 32 | if (window_egl->window.window_height > 0) | ||
| 33 | height = window_egl->window.window_height; | ||
| 34 | else | ||
| 35 | - height = 240; | ||
| 36 | + height = 768; | ||
| 37 | window_egl->window.window_height = height; | ||
| 38 | |||
| 39 | if (!window_egl->window.native) { | ||
| 40 | -- | ||
| 41 | 1.9.1 | ||
| 42 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch deleted file mode 100755 index 2dcce8d55..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0002-Support-fb-backend-for-gl-plugins.patch +++ /dev/null | |||
| @@ -1,781 +0,0 @@ | |||
| 1 | From d0179e89c294f775a7ebb6ccb0ad539433f3c22e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <b55597@freescale.com> | ||
| 3 | Date: Mon, 16 Nov 2015 17:41:57 +0800 | ||
| 4 | Subject: [PATCH 08/26] Support fb backend for gl plugins | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | 1.Add fb support in glimagesink | ||
| 10 | 2.override set_render_rectangle() to support resize | ||
| 11 | |||
| 12 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 13 | |||
| 14 | Signed-off-by: Haihua Hu <b55597@freescale.com> | ||
| 15 | |||
| 16 | Conflicts: | ||
| 17 | configure.ac | ||
| 18 | --- | ||
| 19 | configure.ac | 25 ++- | ||
| 20 | gst-libs/gst/gl/Makefile.am | 5 + | ||
| 21 | gst-libs/gst/gl/fb/Makefile.am | 25 +++ | ||
| 22 | gst-libs/gst/gl/fb/gstgldisplay_fb.c | 109 +++++++++++++ | ||
| 23 | gst-libs/gst/gl/fb/gstgldisplay_fb.h | 67 ++++++++ | ||
| 24 | gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | 265 ++++++++++++++++++++++++++++++++ | ||
| 25 | gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | 65 ++++++++ | ||
| 26 | gst-libs/gst/gl/gstgldisplay.c | 11 ++ | ||
| 27 | gst-libs/gst/gl/gstgldisplay.h | 1 + | ||
| 28 | gst-libs/gst/gl/gstglwindow.c | 8 + | ||
| 29 | 11 files changed, 580 insertions(+), 1 deletions(-) | ||
| 30 | create mode 100644 gst-libs/gst/gl/fb/Makefile.am | ||
| 31 | create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.c | ||
| 32 | create mode 100644 gst-libs/gst/gl/fb/gstgldisplay_fb.h | ||
| 33 | create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | ||
| 34 | create mode 100644 gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | ||
| 35 | |||
| 36 | diff --git a/configure.ac b/configure.ac | ||
| 37 | index f135648..991e7d0 100644 | ||
| 38 | --- a/configure.ac | ||
| 39 | +++ b/configure.ac | ||
| 40 | @@ -700,6 +700,7 @@ HAVE_GL=no | ||
| 41 | HAVE_GLES2=no | ||
| 42 | HAVE_GLES3_H=no | ||
| 43 | HAVE_WAYLAND_EGL=no | ||
| 44 | +HAVE_FB_EGL=no | ||
| 45 | |||
| 46 | HAVE_EGL_RPI=no | ||
| 47 | |||
| 48 | @@ -737,6 +738,9 @@ case $host in | ||
| 49 | old_LIBS=$LIBS | ||
| 50 | old_CFLAGS=$CFLAGS | ||
| 51 | |||
| 52 | + dnl check fb backend for imx soc | ||
| 53 | + AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no) | ||
| 54 | + | ||
| 55 | dnl FIXME: Mali EGL depends on GLESv1 or GLESv2 | ||
| 56 | AC_CHECK_HEADER([EGL/fbdev_window.h], | ||
| 57 | [ | ||
| 58 | @@ -1043,6 +1047,16 @@ case $host in | ||
| 59 | fi | ||
| 60 | fi | ||
| 61 | |||
| 62 | + if test "x$HAVE_FB_EGL" = "xyes"; then | ||
| 63 | + if test "x$NEED_EGL" = "xno" -o "x$HAVE_EGL" = "xno"; then | ||
| 64 | + AC_MSG_WARN([EGL is required by the fb backend for OpenGL support]) | ||
| 65 | + else | ||
| 66 | + HAVE_WINDOW_FB=yes | ||
| 67 | + GL_LIBS="$GL_LIBS" | ||
| 68 | + GL_CFLAGS="$GL_CFLAGS" | ||
| 69 | + fi | ||
| 70 | + fi | ||
| 71 | + | ||
| 72 | if test "x$HAVE_EGL_RPI" = "xyes"; then | ||
| 73 | if test "x$NEED_DISPMANX" != "xno"; then | ||
| 74 | HAVE_WINDOW_DISPMANX=yes | ||
| 75 | @@ -1057,7 +1071,7 @@ case $host in | ||
| 76 | fi | ||
| 77 | else | ||
| 78 | if test "x$NEED_EGL" != "xno"; then | ||
| 79 | - if test "x$HAVE_WINDOW_WAYLAND" = "xyes" -o "x$HAVE_WINDOW_X11" = "xyes" -o "x$HAVE_WINDOW_DISPMANX" = "xyes"; then | ||
| 80 | + 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 | ||
| 81 | GL_LIBS="$GL_LIBS -lEGL $EGL_LIBS" | ||
| 82 | GL_CFLAGS="$GL_CFLAGS $EGL_CFLAGS" | ||
| 83 | USE_EGL=yes | ||
| 84 | @@ -1209,6 +1223,7 @@ GST_GL_HAVE_WINDOW_WAYLAND=0 | ||
| 85 | GST_GL_HAVE_WINDOW_ANDROID=0 | ||
| 86 | GST_GL_HAVE_WINDOW_DISPMANX=0 | ||
| 87 | GST_GL_HAVE_WINDOW_EAGL=0 | ||
| 88 | +GST_GL_HAVE_WINDOW_FB=0 | ||
| 89 | |||
| 90 | if test "x$HAVE_WINDOW_X11" = "xyes"; then | ||
| 91 | GL_WINDOWS="x11 $GL_WINDOWS" | ||
| 92 | @@ -1238,6 +1253,10 @@ if test "x$HAVE_WINDOW_EAGL" = "xyes"; then | ||
| 93 | GL_WINDOWS="eagl $GL_WINDOWS" | ||
| 94 | GST_GL_HAVE_WINDOW_EAGL=1 | ||
| 95 | fi | ||
| 96 | +if test "x$HAVE_WINDOW_FB" = "xyes"; then | ||
| 97 | + GL_WINDOWS="fb $GL_WINDOWS" | ||
| 98 | + GST_GL_HAVE_WINDOW_FB=1 | ||
| 99 | +fi | ||
| 100 | |||
| 101 | GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES | ||
| 102 | #define GST_GL_HAVE_WINDOW_X11 $GST_GL_HAVE_WINDOW_X11 | ||
| 103 | @@ -1247,6 +1266,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES | ||
| 104 | #define GST_GL_HAVE_WINDOW_ANDROID $GST_GL_HAVE_WINDOW_ANDROID | ||
| 105 | #define GST_GL_HAVE_WINDOW_DISPMANX $GST_GL_HAVE_WINDOW_DISPMANX | ||
| 106 | #define GST_GL_HAVE_WINDOW_EAGL $GST_GL_HAVE_WINDOW_EAGL | ||
| 107 | +#define GST_GL_HAVE_WINDOW_FB $GST_GL_HAVE_WINDOW_FB | ||
| 108 | " | ||
| 109 | |||
| 110 | dnl PLATFORM's | ||
| 111 | @@ -1322,6 +1342,7 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the | ||
| 112 | HAVE_WINDOW_ANDROID=no | ||
| 113 | HAVE_WINDOW_COCOA=no | ||
| 114 | HAVE_WINDOW_EAGL=no | ||
| 115 | + HAVE_WINDOW_FB=no | ||
| 116 | fi | ||
| 117 | |||
| 118 | AC_SUBST(GL_LIBS) | ||
| 119 | @@ -1337,6 +1358,7 @@ AM_CONDITIONAL(HAVE_WINDOW_DISPMANX, test "x$HAVE_WINDOW_DISPMANX" = "xyes") | ||
| 120 | AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes") | ||
| 121 | AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes") | ||
| 122 | AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes") | ||
| 123 | +AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes") | ||
| 124 | |||
| 125 | AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes") | ||
| 126 | AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes") | ||
| 127 | @@ -3700,6 +3722,7 @@ gst-libs/gst/gl/egl/Makefile | ||
| 128 | gst-libs/gst/gl/wayland/Makefile | ||
| 129 | gst-libs/gst/gl/win32/Makefile | ||
| 130 | gst-libs/gst/gl/x11/Makefile | ||
| 131 | +gst-libs/gst/gl/fb/Makefile | ||
| 132 | gst-libs/gst/insertbin/Makefile | ||
| 133 | gst-libs/gst/interfaces/Makefile | ||
| 134 | gst-libs/gst/codecparsers/Makefile | ||
| 135 | diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am | ||
| 136 | index 5ceb622..01498e0 100644 | ||
| 137 | --- a/gst-libs/gst/gl/Makefile.am | ||
| 138 | +++ b/gst-libs/gst/gl/Makefile.am | ||
| 139 | @@ -119,6 +119,11 @@ SUBDIRS += eagl | ||
| 140 | libgstgl_@GST_API_VERSION@_la_LIBADD += eagl/libgstgl-eagl.la | ||
| 141 | endif | ||
| 142 | |||
| 143 | +if HAVE_WINDOW_FB | ||
| 144 | +SUBDIRS += fb | ||
| 145 | +libgstgl_@GST_API_VERSION@_la_LIBADD += fb/libgstgl-fb.la | ||
| 146 | +endif | ||
| 147 | + | ||
| 148 | if USE_EGL | ||
| 149 | SUBDIRS += egl | ||
| 150 | libgstgl_@GST_API_VERSION@_la_LIBADD += egl/libgstgl-egl.la | ||
| 151 | diff --git a/gst-libs/gst/gl/fb/Makefile.am b/gst-libs/gst/gl/fb/Makefile.am | ||
| 152 | new file mode 100644 | ||
| 153 | index 0000000..8e4656c | ||
| 154 | --- /dev/null | ||
| 155 | +++ b/gst-libs/gst/gl/fb/Makefile.am | ||
| 156 | @@ -0,0 +1,25 @@ | ||
| 157 | +## Process this file with automake to produce Makefile.in | ||
| 158 | + | ||
| 159 | +noinst_LTLIBRARIES = libgstgl-fb.la | ||
| 160 | + | ||
| 161 | +libgstgl_fb_la_SOURCES = \ | ||
| 162 | + gstgldisplay_fb.c \ | ||
| 163 | + gstglwindow_fb_egl.c | ||
| 164 | + | ||
| 165 | +noinst_HEADERS = \ | ||
| 166 | + gstgldisplay_fb.h \ | ||
| 167 | + gstglwindow_fb_egl.h | ||
| 168 | + | ||
| 169 | +libgstgl_fbincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/fb | ||
| 170 | + | ||
| 171 | +libgstgl_fb_la_CFLAGS = \ | ||
| 172 | + -I$(top_srcdir)/gst-libs \ | ||
| 173 | + -I$(top_builddir)/gst-libs \ | ||
| 174 | + $(GL_CFLAGS) \ | ||
| 175 | + $(GST_PLUGINS_BASE_CFLAGS) \ | ||
| 176 | + $(GST_BASE_CFLAGS) \ | ||
| 177 | + $(GST_CFLAGS) | ||
| 178 | + | ||
| 179 | +libgstgl_fb_la_LDFLAGS = \ | ||
| 180 | + $(GST_LIB_LDFLAGS) \ | ||
| 181 | + $(GST_ALL_LDFLAGS) | ||
| 182 | diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.c b/gst-libs/gst/gl/fb/gstgldisplay_fb.c | ||
| 183 | new file mode 100644 | ||
| 184 | index 0000000..3be9756 | ||
| 185 | --- /dev/null | ||
| 186 | +++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.c | ||
| 187 | @@ -0,0 +1,109 @@ | ||
| 188 | +/* | ||
| 189 | + * GStreamer | ||
| 190 | + * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com> | ||
| 191 | + * | ||
| 192 | + * This library is free software; you can redistribute it and/or | ||
| 193 | + * modify it under the terms of the GNU Library General Public | ||
| 194 | + * License as published by the Free Software Foundation; either | ||
| 195 | + * version 2 of the License, or (at your option) any later version. | ||
| 196 | + * | ||
| 197 | + * This library is distributed in the hope that it will be useful, | ||
| 198 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 199 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 200 | + * Library General Public License for more details. | ||
| 201 | + * | ||
| 202 | + * You should have received a copy of the GNU Library General Public | ||
| 203 | + * License along with this library; if not, write to the | ||
| 204 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 205 | + * Boston, MA 02110-1301, USA. | ||
| 206 | + */ | ||
| 207 | + | ||
| 208 | +#ifdef HAVE_CONFIG_H | ||
| 209 | +#include "config.h" | ||
| 210 | +#endif | ||
| 211 | + | ||
| 212 | +#include <gst/gl/fb/gstgldisplay_fb.h> | ||
| 213 | + | ||
| 214 | +GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug); | ||
| 215 | +#define GST_CAT_DEFAULT gst_gl_display_debug | ||
| 216 | + | ||
| 217 | +G_DEFINE_TYPE (GstGLDisplayFB, gst_gl_display_fb, GST_TYPE_GL_DISPLAY); | ||
| 218 | + | ||
| 219 | +static void gst_gl_display_fb_finalize (GObject * object); | ||
| 220 | +static guintptr gst_gl_display_fb_get_handle (GstGLDisplay * display); | ||
| 221 | + | ||
| 222 | +static void | ||
| 223 | +gst_gl_display_fb_class_init (GstGLDisplayFBClass * klass) | ||
| 224 | +{ | ||
| 225 | + GST_GL_DISPLAY_CLASS (klass)->get_handle = | ||
| 226 | + GST_DEBUG_FUNCPTR (gst_gl_display_fb_get_handle); | ||
| 227 | + | ||
| 228 | + G_OBJECT_CLASS (klass)->finalize = gst_gl_display_fb_finalize; | ||
| 229 | +} | ||
| 230 | + | ||
| 231 | +static void | ||
| 232 | +gst_gl_display_fb_init (GstGLDisplayFB * display_fb) | ||
| 233 | +{ | ||
| 234 | + GstGLDisplay *display = (GstGLDisplay *) display_fb; | ||
| 235 | + | ||
| 236 | + display->type = GST_GL_DISPLAY_TYPE_FB; | ||
| 237 | + display_fb->name = NULL; | ||
| 238 | + display_fb->disp_idx = 0; | ||
| 239 | + display_fb->display = NULL; | ||
| 240 | +} | ||
| 241 | + | ||
| 242 | +static void | ||
| 243 | +gst_gl_display_fb_finalize (GObject * object) | ||
| 244 | +{ | ||
| 245 | + GstGLDisplayFB *display_fb = GST_GL_DISPLAY_FB (object); | ||
| 246 | + | ||
| 247 | + if (display_fb->name) | ||
| 248 | + g_free (display_fb->name); | ||
| 249 | + | ||
| 250 | + if (display_fb->display) | ||
| 251 | + fbDestroyDisplay (display_fb->display); | ||
| 252 | + | ||
| 253 | + G_OBJECT_CLASS (gst_gl_display_fb_parent_class)->finalize (object); | ||
| 254 | +} | ||
| 255 | + | ||
| 256 | +/** | ||
| 257 | + * gst_gl_display_fb_new: | ||
| 258 | + * @name: (allow-none): a display name | ||
| 259 | + * | ||
| 260 | + * Create a new #GstGLDisplayFB from the x11 display name. See XOpenDisplay() | ||
| 261 | + * for details on what is a valid name. | ||
| 262 | + * | ||
| 263 | + * Returns: (transfer full): a new #GstGLDisplayFB or %NULL | ||
| 264 | + */ | ||
| 265 | +GstGLDisplayFB * | ||
| 266 | +gst_gl_display_fb_new (gchar *name) | ||
| 267 | +{ | ||
| 268 | + GstGLDisplayFB *display; | ||
| 269 | + const gchar *fb_name = NULL; | ||
| 270 | + | ||
| 271 | + GST_DEBUG_CATEGORY_GET (gst_gl_display_debug, "gldisplay"); | ||
| 272 | + GST_DEBUG ("creating Fb EGL display"); | ||
| 273 | + | ||
| 274 | + fb_name = name; | ||
| 275 | + if (!fb_name) fb_name = "fb0"; | ||
| 276 | + | ||
| 277 | + display = g_object_new (GST_TYPE_GL_DISPLAY_FB, NULL); | ||
| 278 | + display->name = g_strdup (fb_name); | ||
| 279 | + sscanf (display->name, "fb%d", &display->disp_idx); | ||
| 280 | + display->display = fbGetDisplayByIndex (display->disp_idx); | ||
| 281 | + if (!display->display) { | ||
| 282 | + GST_ERROR ("Failed to open FB display, \'%s\'", fb_name); | ||
| 283 | + return NULL; | ||
| 284 | + } | ||
| 285 | + | ||
| 286 | + GST_DEBUG ("Created fb EGL display %d", display->display); | ||
| 287 | + | ||
| 288 | + return display; | ||
| 289 | +} | ||
| 290 | + | ||
| 291 | +static guintptr | ||
| 292 | +gst_gl_display_fb_get_handle (GstGLDisplay * display) | ||
| 293 | +{ | ||
| 294 | + GST_DEBUG ("Get fb EGL display %d", GST_GL_DISPLAY_FB (display)->display); | ||
| 295 | + return (guintptr) GST_GL_DISPLAY_FB (display)->display; | ||
| 296 | +} | ||
| 297 | diff --git a/gst-libs/gst/gl/fb/gstgldisplay_fb.h b/gst-libs/gst/gl/fb/gstgldisplay_fb.h | ||
| 298 | new file mode 100644 | ||
| 299 | index 0000000..62987c1 | ||
| 300 | --- /dev/null | ||
| 301 | +++ b/gst-libs/gst/gl/fb/gstgldisplay_fb.h | ||
| 302 | @@ -0,0 +1,67 @@ | ||
| 303 | +/* | ||
| 304 | + * GStreamer | ||
| 305 | + * Copyright (C) 2014 Matthew Waters <ystreet00@gmail.com> | ||
| 306 | + * | ||
| 307 | + * This library is free software; you can redistribute it and/or | ||
| 308 | + * modify it under the terms of the GNU Library General Public | ||
| 309 | + * License as published by the Free Software Foundation; either | ||
| 310 | + * version 2 of the License, or (at your option) any later version. | ||
| 311 | + * | ||
| 312 | + * This library is distributed in the hope that it will be useful, | ||
| 313 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 314 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 315 | + * Library General Public License for more details. | ||
| 316 | + * | ||
| 317 | + * You should have received a copy of the GNU Library General Public | ||
| 318 | + * License along with this library; if not, write to the | ||
| 319 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 320 | + * Boston, MA 02110-1301, USA. | ||
| 321 | + */ | ||
| 322 | + | ||
| 323 | +#ifndef __GST_GL_DISPLAY_FB_H__ | ||
| 324 | +#define __GST_GL_DISPLAY_FB_H__ | ||
| 325 | + | ||
| 326 | +#include <EGL/egl.h> | ||
| 327 | +#include <gst/gst.h> | ||
| 328 | +#include <gst/gl/gstgldisplay.h> | ||
| 329 | + | ||
| 330 | +G_BEGIN_DECLS | ||
| 331 | + | ||
| 332 | +GType gst_gl_display_fb_get_type (void); | ||
| 333 | + | ||
| 334 | +#define GST_TYPE_GL_DISPLAY_FB (gst_gl_display_fb_get_type()) | ||
| 335 | +#define GST_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFB)) | ||
| 336 | +#define GST_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_GL_DISPLAY_FB,GstGLDisplayFBClass)) | ||
| 337 | +#define GST_IS_GL_DISPLAY_FB(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GL_DISPLAY_FB)) | ||
| 338 | +#define GST_IS_GL_DISPLAY_FB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_GL_DISPLAY_FB)) | ||
| 339 | +#define GST_GL_DISPLAY_FB_CAST(obj) ((GstGLDisplayFB*)(obj)) | ||
| 340 | + | ||
| 341 | +typedef struct _GstGLDisplayFB GstGLDisplayFB; | ||
| 342 | +typedef struct _GstGLDisplayFBClass GstGLDisplayFBClass; | ||
| 343 | + | ||
| 344 | +/** | ||
| 345 | + * GstGLDisplayFB: | ||
| 346 | + * | ||
| 347 | + * the contents of a #GstGLDisplayFB are private and should only be accessed | ||
| 348 | + * through the provided API | ||
| 349 | + */ | ||
| 350 | +struct _GstGLDisplayFB | ||
| 351 | +{ | ||
| 352 | + GstGLDisplay parent; | ||
| 353 | + | ||
| 354 | + /* <private> */ | ||
| 355 | + gchar *name; | ||
| 356 | + gint disp_idx; | ||
| 357 | + EGLNativeDisplayType display; | ||
| 358 | +}; | ||
| 359 | + | ||
| 360 | +struct _GstGLDisplayFBClass | ||
| 361 | +{ | ||
| 362 | + GstGLDisplayClass object_class; | ||
| 363 | +}; | ||
| 364 | + | ||
| 365 | +GstGLDisplayFB *gst_gl_display_fb_new (gchar *name); | ||
| 366 | + | ||
| 367 | +G_END_DECLS | ||
| 368 | + | ||
| 369 | +#endif /* __GST_GL_DISPLAY_FB_H__ */ | ||
| 370 | diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | ||
| 371 | new file mode 100644 | ||
| 372 | index 0000000..a068e30 | ||
| 373 | --- /dev/null | ||
| 374 | +++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.c | ||
| 375 | @@ -0,0 +1,265 @@ | ||
| 376 | +/* | ||
| 377 | + * GStreamer | ||
| 378 | + * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com> | ||
| 379 | + * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com> | ||
| 380 | + * | ||
| 381 | + * This library is free software; you can redistribute it and/or | ||
| 382 | + * modify it under the terms of the GNU Library General Public | ||
| 383 | + * License as published by the Free Software Foundation; either | ||
| 384 | + * version 2 of the License, or (at your option) any later version. | ||
| 385 | + * | ||
| 386 | + * This library is distributed in the hope that it will be useful, | ||
| 387 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 388 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 389 | + * Library General Public License for more details. | ||
| 390 | + * | ||
| 391 | + * You should have received a copy of the GNU Library General Public | ||
| 392 | + * License along with this library; if not, write to the | ||
| 393 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 394 | + * Boston, MA 02110-1301, USA. | ||
| 395 | + */ | ||
| 396 | + | ||
| 397 | +#include "../gstgl_fwd.h" | ||
| 398 | +#include <gst/gl/gstglcontext.h> | ||
| 399 | + | ||
| 400 | +#include "gstglwindow_fb_egl.h" | ||
| 401 | + | ||
| 402 | +#define GST_CAT_DEFAULT gst_gl_window_debug | ||
| 403 | + | ||
| 404 | +#define gst_gl_window_fb_egl_parent_class parent_class | ||
| 405 | +G_DEFINE_TYPE (GstGLWindowFbEGL, gst_gl_window_fb_egl, | ||
| 406 | + GST_GL_TYPE_WINDOW); | ||
| 407 | + | ||
| 408 | +static guintptr gst_gl_window_fb_egl_get_window_handle (GstGLWindow * | ||
| 409 | + window); | ||
| 410 | +static void gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window, | ||
| 411 | + guintptr handle); | ||
| 412 | +static void gst_gl_window_fb_egl_draw (GstGLWindow * window); | ||
| 413 | +static void gst_gl_window_fb_egl_close (GstGLWindow * window); | ||
| 414 | +static gboolean gst_gl_window_fb_egl_open (GstGLWindow * window, | ||
| 415 | + GError ** error); | ||
| 416 | +static gboolean | ||
| 417 | +gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window, | ||
| 418 | + guint x, guint y, guint width, guint height); | ||
| 419 | + | ||
| 420 | +static void | ||
| 421 | +gst_gl_window_fb_egl_class_init (GstGLWindowFbEGLClass * klass) | ||
| 422 | +{ | ||
| 423 | + GstGLWindowClass *window_class = (GstGLWindowClass *) klass; | ||
| 424 | + | ||
| 425 | + window_class->get_window_handle = | ||
| 426 | + GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_get_window_handle); | ||
| 427 | + window_class->set_window_handle = | ||
| 428 | + GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_window_handle); | ||
| 429 | + window_class->draw = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_draw); | ||
| 430 | + window_class->close = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_close); | ||
| 431 | + window_class->open = GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_open); | ||
| 432 | + window_class->set_render_rectangle = | ||
| 433 | + GST_DEBUG_FUNCPTR (gst_gl_window_fb_egl_set_render_rectangle); | ||
| 434 | +} | ||
| 435 | + | ||
| 436 | +static void | ||
| 437 | +gst_gl_window_fb_egl_init (GstGLWindowFbEGL * window) | ||
| 438 | +{ | ||
| 439 | + GstGLWindowFbEGL *window_egl; | ||
| 440 | + | ||
| 441 | + window_egl = GST_GL_WINDOW_FB_EGL (window); | ||
| 442 | + | ||
| 443 | + window_egl->width = 0; | ||
| 444 | + window_egl->height = 0; | ||
| 445 | + window_egl->default_fullscreen = TRUE; | ||
| 446 | + window_egl->display = 0; | ||
| 447 | +} | ||
| 448 | + | ||
| 449 | +/* Must be called in the gl thread */ | ||
| 450 | +GstGLWindowFbEGL * | ||
| 451 | +gst_gl_window_fb_egl_new (GstGLDisplay * display) | ||
| 452 | +{ | ||
| 453 | + GstGLWindowFbEGL *window; | ||
| 454 | + const gchar *fb_name = NULL; | ||
| 455 | + | ||
| 456 | + if (!display) | ||
| 457 | + return NULL; | ||
| 458 | + | ||
| 459 | + window = g_object_new (GST_GL_TYPE_WINDOW_FB_EGL, NULL); | ||
| 460 | + window->display = gst_gl_display_get_handle (display); | ||
| 461 | + if (!window->display) { | ||
| 462 | + GST_ERROR ("failed to get display for egl window"); | ||
| 463 | + return NULL; | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + return window; | ||
| 467 | +} | ||
| 468 | + | ||
| 469 | +static void | ||
| 470 | +gst_gl_window_fb_egl_close (GstGLWindow * window) | ||
| 471 | +{ | ||
| 472 | + GstGLWindowFbEGL *window_egl; | ||
| 473 | + | ||
| 474 | + window_egl = GST_GL_WINDOW_FB_EGL (window); | ||
| 475 | + | ||
| 476 | + if (window_egl->win_id) { | ||
| 477 | + fbDestroyWindow (window_egl->win_id); | ||
| 478 | + } | ||
| 479 | + | ||
| 480 | + GST_GL_WINDOW_CLASS (parent_class)->close (window); | ||
| 481 | +} | ||
| 482 | + | ||
| 483 | +static gboolean | ||
| 484 | +gst_gl_window_fb_egl_open (GstGLWindow * window, GError ** error) | ||
| 485 | +{ | ||
| 486 | + GstGLWindowFbEGL *window_egl; | ||
| 487 | + | ||
| 488 | + window_egl = GST_GL_WINDOW_FB_EGL (window); | ||
| 489 | + | ||
| 490 | + if (!window_egl->display) { | ||
| 491 | + GST_ERROR ("No display for window_egl."); | ||
| 492 | + return FALSE; | ||
| 493 | + } | ||
| 494 | + | ||
| 495 | + window_egl->win_id = fbCreateWindow (window_egl->display, -1, -1, 0, 0); | ||
| 496 | + if (!window_egl->win_id) { | ||
| 497 | + GST_ERROR ("Failed to create window_egl"); | ||
| 498 | + return FALSE; | ||
| 499 | + } | ||
| 500 | + | ||
| 501 | + fbGetDisplayGeometry (window_egl->display, &window_egl->width, &window_egl->height); | ||
| 502 | + window_egl->req_width = window_egl->width; | ||
| 503 | + window_egl->req_height = window_egl->height; | ||
| 504 | + GST_DEBUG ("Open FB display succesfully, resolution is (%dx%d),display %d, window %d.", | ||
| 505 | + window_egl->width, window_egl->height, window_egl->display, window_egl->win_id); | ||
| 506 | + | ||
| 507 | + if (!GST_GL_WINDOW_CLASS (parent_class)->open (window, error)) | ||
| 508 | + return FALSE; | ||
| 509 | + | ||
| 510 | + return TRUE; | ||
| 511 | +} | ||
| 512 | +static guintptr | ||
| 513 | +gst_gl_window_fb_egl_get_window_handle (GstGLWindow * window) | ||
| 514 | +{ | ||
| 515 | + GST_DEBUG ("fb egl get window: %d", GST_GL_WINDOW_FB_EGL (window)->win_id); | ||
| 516 | + return (guintptr) GST_GL_WINDOW_FB_EGL (window)->win_id; | ||
| 517 | +} | ||
| 518 | + | ||
| 519 | +static void | ||
| 520 | +gst_gl_window_fb_egl_set_window_handle (GstGLWindow * window, | ||
| 521 | + guintptr handle) | ||
| 522 | +{ | ||
| 523 | +} | ||
| 524 | + | ||
| 525 | +static void | ||
| 526 | +draw_cb (gpointer data) | ||
| 527 | +{ | ||
| 528 | + GstGLWindowFbEGL *window_egl = (GstGLWindowFbEGL *)data; | ||
| 529 | + GstGLWindow *window = GST_GL_WINDOW (window_egl); | ||
| 530 | + GstGLContext *context = gst_gl_window_get_context (window); | ||
| 531 | + GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context); | ||
| 532 | + | ||
| 533 | + /* default full screen */ | ||
| 534 | + if (window_egl->default_fullscreen && window->resize) { | ||
| 535 | + window->resize (window->resize_data, window_egl->width, window_egl->height); | ||
| 536 | + window_egl->default_fullscreen = FALSE; | ||
| 537 | + } | ||
| 538 | + | ||
| 539 | + if (window->draw) | ||
| 540 | + window->draw (window->draw_data); | ||
| 541 | + | ||
| 542 | + GST_DEBUG ("####### draw data"); | ||
| 543 | + context_class->swap_buffers (context); | ||
| 544 | + | ||
| 545 | + gst_object_unref (context); | ||
| 546 | +} | ||
| 547 | + | ||
| 548 | +static void | ||
| 549 | +gst_gl_window_fb_egl_draw (GstGLWindow * window) | ||
| 550 | +{ | ||
| 551 | + gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, window); | ||
| 552 | +} | ||
| 553 | + | ||
| 554 | +static gboolean | ||
| 555 | +_calculate_viewport_coordinates(GstVideoRectangle *req, GstVideoRectangle *result, | ||
| 556 | + guint display_width, guint display_height) | ||
| 557 | +{ | ||
| 558 | + if(!req || !result || req->w < 1 || req->h < 1) | ||
| 559 | + return FALSE; | ||
| 560 | + | ||
| 561 | + result->x = req->x; | ||
| 562 | + result->y = display_height - (req->y + req->h); | ||
| 563 | + result->w = req->w; | ||
| 564 | + result->h = req->h; | ||
| 565 | + | ||
| 566 | + return TRUE; | ||
| 567 | +} | ||
| 568 | + | ||
| 569 | +struct SetRenderRectangle | ||
| 570 | +{ | ||
| 571 | + GstGLWindowFbEGL *window_egl; | ||
| 572 | + GstVideoRectangle rect; | ||
| 573 | +}; | ||
| 574 | + | ||
| 575 | +static void | ||
| 576 | +_free_set_render_rectangle (struct SetRenderRectangle *render) | ||
| 577 | +{ | ||
| 578 | + if (render) { | ||
| 579 | + if (render->window_egl) | ||
| 580 | + gst_object_unref (render->window_egl); | ||
| 581 | + g_free (render); | ||
| 582 | + } | ||
| 583 | +} | ||
| 584 | + | ||
| 585 | +static void | ||
| 586 | +_set_render_rectangle (gpointer data) | ||
| 587 | +{ | ||
| 588 | + const GstGLFuncs *gl; | ||
| 589 | + GstGLContext *context; | ||
| 590 | + GstVideoRectangle result, video_rect, tmp_res; | ||
| 591 | + struct SetRenderRectangle *render = data; | ||
| 592 | + GstGLWindow *window = GST_GL_WINDOW (render->window_egl); | ||
| 593 | + | ||
| 594 | + context = gst_gl_window_get_context(window); | ||
| 595 | + gl = context->gl_vtable; | ||
| 596 | + | ||
| 597 | + GST_LOG_OBJECT (render->window_egl, "setting render rectangle %i,%i+%ix%i", | ||
| 598 | + render->rect.x, render->rect.y, render->rect.w, render->rect.h); | ||
| 599 | + | ||
| 600 | + video_rect.x = render->rect.x; | ||
| 601 | + video_rect.y = render->rect.y; | ||
| 602 | + video_rect.w = GST_VIDEO_SINK_WIDTH(window->resize_data); | ||
| 603 | + video_rect.h = GST_VIDEO_SINK_HEIGHT(window->resize_data); | ||
| 604 | + | ||
| 605 | + gst_video_sink_center_rect(video_rect, render->rect, &tmp_res, TRUE); | ||
| 606 | + | ||
| 607 | + GST_LOG_OBJECT (render->window_egl, "set center render rectangle %i,%i+%ix%i", | ||
| 608 | + tmp_res.x, tmp_res.y, tmp_res.w, tmp_res.h); | ||
| 609 | + | ||
| 610 | + /* need to transform screen coordinate to viewport coordinate */ | ||
| 611 | + if( _calculate_viewport_coordinates(&tmp_res, &result, | ||
| 612 | + render->window_egl->width, render->window_egl->height)){ | ||
| 613 | + GST_LOG_OBJECT (render->window_egl, "viewport render rectangle %i,%i+%ix%i", | ||
| 614 | + result.x, result.y, result.w, result.h); | ||
| 615 | + gl->Viewport(result.x, result.y, result.w, result.h); | ||
| 616 | + } | ||
| 617 | + | ||
| 618 | + if(context) | ||
| 619 | + gst_object_unref(context); | ||
| 620 | +} | ||
| 621 | + | ||
| 622 | +static gboolean | ||
| 623 | +gst_gl_window_fb_egl_set_render_rectangle(GstGLWindow * window, | ||
| 624 | + guint x, guint y, guint width, guint height) | ||
| 625 | +{ | ||
| 626 | + GstGLWindowFbEGL *window_egl = GST_GL_WINDOW_FB_EGL (window); | ||
| 627 | + struct SetRenderRectangle *render; | ||
| 628 | + | ||
| 629 | + render = g_new0 (struct SetRenderRectangle, 1); | ||
| 630 | + render->window_egl = gst_object_ref (window_egl); | ||
| 631 | + render->rect.x = x; | ||
| 632 | + render->rect.y = y; | ||
| 633 | + render->rect.w = width; | ||
| 634 | + render->rect.h = height; | ||
| 635 | + | ||
| 636 | + gst_gl_window_send_message_async (window, | ||
| 637 | + (GstGLWindowCB) _set_render_rectangle, render, | ||
| 638 | + (GDestroyNotify) _free_set_render_rectangle); | ||
| 639 | + return TRUE; | ||
| 640 | +} | ||
| 641 | diff --git a/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | ||
| 642 | new file mode 100644 | ||
| 643 | index 0000000..216e421 | ||
| 644 | --- /dev/null | ||
| 645 | +++ b/gst-libs/gst/gl/fb/gstglwindow_fb_egl.h | ||
| 646 | @@ -0,0 +1,65 @@ | ||
| 647 | +/* | ||
| 648 | + * GStreamer | ||
| 649 | + * Copyright (C) 2012 Matthew Waters <ystreet00@gmail.com> | ||
| 650 | + * | ||
| 651 | + * This library is free software; you can redistribute it and/or | ||
| 652 | + * modify it under the terms of the GNU Library General Public | ||
| 653 | + * License as published by the Free Software Foundation; either | ||
| 654 | + * version 2 of the License, or (at your option) any later version. | ||
| 655 | + * | ||
| 656 | + * This library is distributed in the hope that it will be useful, | ||
| 657 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 658 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 659 | + * Library General Public License for more details. | ||
| 660 | + * | ||
| 661 | + * You should have received a copy of the GNU Library General Public | ||
| 662 | + * License along with this library; if not, write to the | ||
| 663 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 664 | + * Boston, MA 02110-1301, USA. | ||
| 665 | + */ | ||
| 666 | + | ||
| 667 | +#ifndef __GST_GL_WINDOW_FB_EGL_H__ | ||
| 668 | +#define __GST_GL_WINDOW_FB_EGL_H__ | ||
| 669 | + | ||
| 670 | +#include <gst/gl/gl.h> | ||
| 671 | +#include "EGL/eglplatform.h" | ||
| 672 | + | ||
| 673 | +G_BEGIN_DECLS | ||
| 674 | + | ||
| 675 | +#define GST_GL_TYPE_WINDOW_FB_EGL (gst_gl_window_fb_egl_get_type()) | ||
| 676 | +#define GST_GL_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_CAST((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL)) | ||
| 677 | +#define GST_GL_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS((k), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGLClass)) | ||
| 678 | +#define GST_GL_IS_WINDOW_FB_EGL(o) (G_TYPE_CHECK_INSTANCE_TYPE((o), GST_GL_TYPE_WINDOW_FB_EGL)) | ||
| 679 | +#define GST_GL_IS_WINDOW_FB_EGL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE((k), GST_GL_TYPE_WINDOW_FB_EGL)) | ||
| 680 | +#define GST_GL_WINDOW_FB_EGL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), GST_GL_TYPE_WINDOW_FB_EGL, GstGLWindowFbEGL_Class)) | ||
| 681 | + | ||
| 682 | +typedef struct _GstGLWindowFbEGL GstGLWindowFbEGL; | ||
| 683 | +typedef struct _GstGLWindowFbEGLClass GstGLWindowFbEGLClass; | ||
| 684 | + | ||
| 685 | +struct _GstGLWindowFbEGL { | ||
| 686 | + /*< private >*/ | ||
| 687 | + GstGLWindow parent; | ||
| 688 | + | ||
| 689 | + /* <private> */ | ||
| 690 | + gint width, req_width; | ||
| 691 | + gint height, req_height; | ||
| 692 | + gboolean default_fullscreen; | ||
| 693 | + EGLNativeDisplayType display; | ||
| 694 | + EGLNativeWindowType win_id; | ||
| 695 | +}; | ||
| 696 | + | ||
| 697 | +struct _GstGLWindowFbEGLClass { | ||
| 698 | + /*< private >*/ | ||
| 699 | + GstGLWindowClass parent_class; | ||
| 700 | + | ||
| 701 | + /*< private >*/ | ||
| 702 | + gpointer _reserved[GST_PADDING]; | ||
| 703 | +}; | ||
| 704 | + | ||
| 705 | +GType gst_gl_window_fb_egl_get_type (void); | ||
| 706 | + | ||
| 707 | +GstGLWindowFbEGL * gst_gl_window_fb_egl_new (GstGLDisplay * display); | ||
| 708 | + | ||
| 709 | +G_END_DECLS | ||
| 710 | + | ||
| 711 | +#endif /* __GST_GL_WINDOW_FB_EGL_H__ */ | ||
| 712 | diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c | ||
| 713 | index 3ffc906..7b0b5bf 100644 | ||
| 714 | --- a/gst-libs/gst/gl/gstgldisplay.c | ||
| 715 | +++ b/gst-libs/gst/gl/gstgldisplay.c | ||
| 716 | @@ -70,6 +70,9 @@ | ||
| 717 | #include <gst/gl/egl/gsteglimage.h> | ||
| 718 | #include <gst/gl/egl/gstglmemoryegl.h> | ||
| 719 | #endif | ||
| 720 | +#if GST_GL_HAVE_WINDOW_FB | ||
| 721 | +#include <gst/gl/fb/gstgldisplay_fb.h> | ||
| 722 | +#endif | ||
| 723 | |||
| 724 | GST_DEBUG_CATEGORY_STATIC (gst_context); | ||
| 725 | GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug); | ||
| 726 | @@ -207,6 +210,14 @@ gst_gl_display_new (void) | ||
| 727 | if (!display && (!user_choice || g_strstr_len (user_choice, 7, "wayland"))) | ||
| 728 | display = GST_GL_DISPLAY (gst_gl_display_wayland_new (NULL)); | ||
| 729 | #endif | ||
| 730 | +#if GST_GL_HAVE_WINDOW_FB | ||
| 731 | + if (!display && (!user_choice || g_strstr_len (user_choice, 2, "fb"))) { | ||
| 732 | + const gchar *fb_name = NULL; | ||
| 733 | + fb_name = g_getenv ("GST_GL_FB"); | ||
| 734 | + if (!fb_name) fb_name = "fb0"; | ||
| 735 | + display = GST_GL_DISPLAY (gst_gl_display_fb_new (fb_name)); | ||
| 736 | + } | ||
| 737 | +#endif | ||
| 738 | #if GST_GL_HAVE_PLATFORM_EGL | ||
| 739 | if (!display && (!platform_choice | ||
| 740 | || g_strstr_len (platform_choice, 3, "egl"))) | ||
| 741 | diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h | ||
| 742 | index a02e904..2f896bb 100644 | ||
| 743 | --- a/gst-libs/gst/gl/gstgldisplay.h | ||
| 744 | +++ b/gst-libs/gst/gl/gstgldisplay.h | ||
| 745 | @@ -61,6 +61,7 @@ typedef enum | ||
| 746 | GST_GL_DISPLAY_TYPE_WIN32 = (1 << 3), | ||
| 747 | GST_GL_DISPLAY_TYPE_DISPMANX = (1 << 4), | ||
| 748 | GST_GL_DISPLAY_TYPE_EGL = (1 << 5), | ||
| 749 | + GST_GL_DISPLAY_TYPE_FB = (1 << 6), | ||
| 750 | |||
| 751 | GST_GL_DISPLAY_TYPE_ANY = G_MAXUINT32 | ||
| 752 | } GstGLDisplayType; | ||
| 753 | diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c | ||
| 754 | index 0588f1d..834d927 100644 | ||
| 755 | --- a/gst-libs/gst/gl/gstglwindow.c | ||
| 756 | +++ b/gst-libs/gst/gl/gstglwindow.c | ||
| 757 | @@ -58,6 +58,9 @@ | ||
| 758 | #if GST_GL_HAVE_WINDOW_EAGL | ||
| 759 | #include "eagl/gstglwindow_eagl.h" | ||
| 760 | #endif | ||
| 761 | +#if GST_GL_HAVE_WINDOW_FB | ||
| 762 | +#include "fb/gstglwindow_fb_egl.h" | ||
| 763 | +#endif | ||
| 764 | #if GST_GL_HAVE_WINDOW_DISPMANX | ||
| 765 | #include "dispmanx/gstglwindow_dispmanx_egl.h" | ||
| 766 | #endif | ||
| 767 | @@ -308,6 +311,11 @@ gst_gl_window_new (GstGLDisplay * display) | ||
| 768 | if (!window && (!user_choice || g_strstr_len (user_choice, 4, "eagl"))) | ||
| 769 | window = GST_GL_WINDOW (gst_gl_window_eagl_new (display)); | ||
| 770 | #endif | ||
| 771 | +#if GST_GL_HAVE_WINDOW_FB | ||
| 772 | + if (!window && (!user_choice || g_strstr_len (user_choice, 2, "fb"))) | ||
| 773 | + window = GST_GL_WINDOW (gst_gl_window_fb_egl_new (display)); | ||
| 774 | +#endif | ||
| 775 | + | ||
| 776 | if (!window) { | ||
| 777 | /* subclass returned a NULL window */ | ||
| 778 | GST_WARNING ("Could not create window. user specified %s, creating dummy" | ||
| 779 | -- | ||
| 780 | 1.9.1 | ||
| 781 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch deleted file mode 100644 index 162bcbed3..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch +++ /dev/null | |||
| @@ -1,535 +0,0 @@ | |||
| 1 | From 989d63bdf9397ba3630a3d6b9fc934b78ef62823 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <b55597@freescale.com> | ||
| 3 | Date: Tue, 13 Oct 2015 09:33:54 +0800 | ||
| 4 | Subject: [PATCH 12/26] Add directviv to glimagesink to improve playback | ||
| 5 | performance | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | 1.Add a physical buffer uploader in glupload plugin and using viv direct | ||
| 11 | texture to bind physical continious buffer with texture to avoid memory | ||
| 12 | copy from videobuffer to texture to gain good performance. | ||
| 13 | 2.Reduce glimagesink load latency by override glimagesink ALLOCATION query to | ||
| 14 | avoid memory copy. | ||
| 15 | 3.Add configure check for directviv feature | ||
| 16 | |||
| 17 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 18 | |||
| 19 | Signed-off-by: Haihua Hu <b55597@freescale.com> | ||
| 20 | --- | ||
| 21 | configure.ac | 12 +++ | ||
| 22 | ext/gl/gstglimagesink.c | 5 ++ | ||
| 23 | gst-libs/gst/gl/Makefile.am | 8 ++ | ||
| 24 | gst-libs/gst/gl/gstglapi.h | 1 + | ||
| 25 | gst-libs/gst/gl/gstglupload.c | 151 +++++++++++++++++++++++++++++++- | ||
| 26 | gst-libs/gst/gl/gstglvivdirecttexture.c | 149 +++++++++++++++++++++++++++++++ | ||
| 27 | gst-libs/gst/gl/gstglvivdirecttexture.h | 38 ++++++++ | ||
| 28 | 7 files changed, 361 insertions(+), 3 deletions(-) | ||
| 29 | create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 30 | create mode 100644 gst-libs/gst/gl/gstglvivdirecttexture.h | ||
| 31 | |||
| 32 | diff --git a/configure.ac b/configure.ac | ||
| 33 | index 991e7d0..3dc2b75 100644 | ||
| 34 | --- a/configure.ac | ||
| 35 | +++ b/configure.ac | ||
| 36 | @@ -701,6 +701,7 @@ HAVE_GLES2=no | ||
| 37 | HAVE_GLES3_H=no | ||
| 38 | HAVE_WAYLAND_EGL=no | ||
| 39 | HAVE_FB_EGL=no | ||
| 40 | +HAVE_DIRECTVIV=no | ||
| 41 | |||
| 42 | HAVE_EGL_RPI=no | ||
| 43 | |||
| 44 | @@ -740,6 +741,7 @@ case $host in | ||
| 45 | |||
| 46 | dnl check fb backend for imx soc | ||
| 47 | AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no) | ||
| 48 | + AC_CHECK_LIB(GLESv2, glTexDirectVIV, HAVE_DIRECTVIV=yes, HAVE_DIRECTVIV=no) | ||
| 49 | |||
| 50 | dnl FIXME: Mali EGL depends on GLESv1 or GLESv2 | ||
| 51 | AC_CHECK_HEADER([EGL/fbdev_window.h], | ||
| 52 | @@ -850,6 +852,12 @@ if test "x$HAVE_GLES2" = "xno"; then | ||
| 53 | fi | ||
| 54 | fi | ||
| 55 | |||
| 56 | +dnl specific for imx soc | ||
| 57 | +GST_GL_HAVE_DIRECTVIV=0 | ||
| 58 | +if test "x$HAVE_DIRECTVIV" = "xyes"; then | ||
| 59 | + GST_GL_HAVE_DIRECTVIV=1 | ||
| 60 | +fi | ||
| 61 | + | ||
| 62 | dnl X, GLX and OpenGL | ||
| 63 | if test "x$HAVE_X" = "xno"; then | ||
| 64 | if test "x$NEED_GLX" = "xyes"; then | ||
| 65 | @@ -1308,6 +1316,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES | ||
| 66 | |||
| 67 | GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES | ||
| 68 | #define GST_GL_HAVE_DMABUF $GST_GL_HAVE_DMABUF | ||
| 69 | +#define GST_GL_HAVE_DIRECTVIV $GST_GL_HAVE_DIRECTVIV | ||
| 70 | " | ||
| 71 | |||
| 72 | dnl Check for no platforms/window systems | ||
| 73 | @@ -1343,6 +1352,8 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the | ||
| 74 | HAVE_WINDOW_COCOA=no | ||
| 75 | HAVE_WINDOW_EAGL=no | ||
| 76 | HAVE_WINDOW_FB=no | ||
| 77 | + | ||
| 78 | + HAVE_DIRECTVIV=no | ||
| 79 | fi | ||
| 80 | |||
| 81 | AC_SUBST(GL_LIBS) | ||
| 82 | @@ -1359,6 +1370,7 @@ AM_CONDITIONAL(HAVE_WINDOW_WAYLAND, test "x$HAVE_WINDOW_WAYLAND" = "xyes") | ||
| 83 | AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes") | ||
| 84 | AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes") | ||
| 85 | AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes") | ||
| 86 | +AM_CONDITIONAL(HAVE_DIRECTVIV, test "x$HAVE_DIRECTVIV" = "xyes") | ||
| 87 | |||
| 88 | AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes") | ||
| 89 | AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes") | ||
| 90 | diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c | ||
| 91 | index 385e3e4..5da1012 100644 | ||
| 92 | --- a/ext/gl/gstglimagesink.c | ||
| 93 | +++ b/ext/gl/gstglimagesink.c | ||
| 94 | @@ -1139,6 +1139,11 @@ gst_glimage_sink_query (GstBaseSink * bsink, GstQuery * query) | ||
| 95 | res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query); | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | + case GST_QUERY_ALLOCATION: | ||
| 99 | + { | ||
| 100 | + gst_glimage_sink_propose_allocation(bsink, query); | ||
| 101 | + break; | ||
| 102 | + } | ||
| 103 | default: | ||
| 104 | res = GST_BASE_SINK_CLASS (parent_class)->query (bsink, query); | ||
| 105 | break; | ||
| 106 | diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am | ||
| 107 | index 01498e0..a6b9755 100644 | ||
| 108 | --- a/gst-libs/gst/gl/Makefile.am | ||
| 109 | +++ b/gst-libs/gst/gl/Makefile.am | ||
| 110 | @@ -36,6 +36,10 @@ libgstgl_@GST_API_VERSION@_la_SOURCES = \ | ||
| 111 | gstglquery.c \ | ||
| 112 | gstglcontrolbindingproxy.c | ||
| 113 | |||
| 114 | +if HAVE_DIRECTVIV | ||
| 115 | +libgstgl_@GST_API_VERSION@_la_SOURCES += gstglvivdirecttexture.c | ||
| 116 | +endif | ||
| 117 | + | ||
| 118 | libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl | ||
| 119 | libgstgl_@GST_API_VERSION@include_HEADERS = \ | ||
| 120 | gstglwindow.h \ | ||
| 121 | @@ -70,6 +74,10 @@ libgstgl_@GST_API_VERSION@include_HEADERS = \ | ||
| 122 | gstgl_enums.h \ | ||
| 123 | gl.h | ||
| 124 | |||
| 125 | +if HAVE_DIRECTVIV | ||
| 126 | +libgstgl_@GST_API_VERSION@include_HEADERS += gstglvivdirecttexture.h | ||
| 127 | +endif | ||
| 128 | + | ||
| 129 | noinst_HEADERS = \ | ||
| 130 | gstglsl_private.h \ | ||
| 131 | utils/opengl_versions.h \ | ||
| 132 | diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h | ||
| 133 | index 3088920..2e9c561 100644 | ||
| 134 | --- a/gst-libs/gst/gl/gstglapi.h | ||
| 135 | +++ b/gst-libs/gst/gl/gstglapi.h | ||
| 136 | @@ -42,6 +42,7 @@ | ||
| 137 | # if GST_GL_HAVE_GLES3 | ||
| 138 | # include <GLES3/gl3.h> | ||
| 139 | # include <GLES3/gl3ext.h> | ||
| 140 | +# include <GLES2/gl2ext.h> | ||
| 141 | # else | ||
| 142 | # include <GLES2/gl2.h> | ||
| 143 | # include <GLES2/gl2ext.h> | ||
| 144 | diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c | ||
| 145 | index bfa5f22..2e52c3e 100644 | ||
| 146 | --- a/gst-libs/gst/gl/gstglupload.c | ||
| 147 | +++ b/gst-libs/gst/gl/gstglupload.c | ||
| 148 | @@ -27,6 +27,9 @@ | ||
| 149 | #include "gl.h" | ||
| 150 | #include "gstglupload.h" | ||
| 151 | |||
| 152 | +#if GST_GL_HAVE_DIRECTVIV | ||
| 153 | +#include <gst/gl/gstglvivdirecttexture.h> | ||
| 154 | +#endif | ||
| 155 | #if GST_GL_HAVE_PLATFORM_EGL | ||
| 156 | #include "egl/gstglmemoryegl.h" | ||
| 157 | #endif | ||
| 158 | @@ -51,7 +54,7 @@ | ||
| 159 | #define USING_GLES2(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 2, 0)) | ||
| 160 | #define USING_GLES3(context) (gst_gl_context_check_gl_version (context, GST_GL_API_GLES2, 3, 0)) | ||
| 161 | |||
| 162 | -GST_DEBUG_CATEGORY_STATIC (gst_gl_upload_debug); | ||
| 163 | +GST_DEBUG_CATEGORY (gst_gl_upload_debug); | ||
| 164 | #define GST_CAT_DEFAULT gst_gl_upload_debug | ||
| 165 | |||
| 166 | #define DEBUG_INIT \ | ||
| 167 | @@ -969,6 +972,144 @@ static const UploadMethod _upload_meta_upload = { | ||
| 168 | &_upload_meta_upload_free | ||
| 169 | }; | ||
| 170 | |||
| 171 | +#if GST_GL_HAVE_DIRECTVIV | ||
| 172 | +struct PhyBufferUpload | ||
| 173 | +{ | ||
| 174 | + GstGLUpload *upload; | ||
| 175 | + GstGLVideoAllocationParams *params; | ||
| 176 | +}; | ||
| 177 | + | ||
| 178 | +static gpointer | ||
| 179 | +_physical_buffer_upload_new(GstGLUpload *upload) | ||
| 180 | +{ | ||
| 181 | + struct PhyBufferUpload *phybuffer = g_new0 (struct PhyBufferUpload, 1); | ||
| 182 | + | ||
| 183 | + phybuffer->upload = upload; | ||
| 184 | + | ||
| 185 | + return phybuffer; | ||
| 186 | +} | ||
| 187 | + | ||
| 188 | +static GstCaps * | ||
| 189 | +_physical_buffer_upload_transform_caps(gpointer impl, GstGLContext *context, | ||
| 190 | + GstPadDirection direction, GstCaps *caps) | ||
| 191 | +{ | ||
| 192 | + GstCapsFeatures *passthrough = | ||
| 193 | + gst_caps_features_from_string | ||
| 194 | + (GST_CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION); | ||
| 195 | + GstCaps *ret; | ||
| 196 | + | ||
| 197 | + if (direction == GST_PAD_SINK) { | ||
| 198 | + GstCaps *tmp; | ||
| 199 | + | ||
| 200 | + ret = | ||
| 201 | + _set_caps_features_with_passthrough (caps, | ||
| 202 | + GST_CAPS_FEATURE_MEMORY_GL_MEMORY, passthrough); | ||
| 203 | + | ||
| 204 | + gst_caps_set_simple (ret, "format", G_TYPE_STRING, "RGBA", NULL); | ||
| 205 | + tmp = _caps_intersect_texture_target (ret, 1 << GST_GL_TEXTURE_TARGET_2D); | ||
| 206 | + gst_caps_unref (ret); | ||
| 207 | + ret = tmp; | ||
| 208 | + } else { | ||
| 209 | + ret = gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES | ||
| 210 | + (GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY,GST_GL_DIRECTVIV_FORMAT)); | ||
| 211 | + } | ||
| 212 | + | ||
| 213 | + gst_caps_features_free (passthrough); | ||
| 214 | + return ret; | ||
| 215 | +} | ||
| 216 | + | ||
| 217 | +static gboolean | ||
| 218 | +_physical_buffer_upload_accept(gpointer impl, GstBuffer *buffer, | ||
| 219 | + GstCaps *in_caps, GstCaps *out_caps) | ||
| 220 | +{ | ||
| 221 | + struct PhyBufferUpload *upload = impl; | ||
| 222 | + GstCapsFeatures *features; | ||
| 223 | + | ||
| 224 | + features = gst_caps_get_features (out_caps, 0); | ||
| 225 | + if (!gst_caps_features_contains (features, GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) | ||
| 226 | + return FALSE; | ||
| 227 | + | ||
| 228 | + if (upload->params) | ||
| 229 | + gst_gl_allocation_params_free ((GstGLAllocationParams *) upload->params); | ||
| 230 | + if (!(upload->params = | ||
| 231 | + gst_gl_video_allocation_params_new (upload->upload->context, NULL, | ||
| 232 | + &upload->upload->priv->out_info, -1, NULL, | ||
| 233 | + GST_GL_TEXTURE_TARGET_2D, GST_VIDEO_GL_TEXTURE_TYPE_RGBA))) | ||
| 234 | + return FALSE; | ||
| 235 | + | ||
| 236 | + return gst_is_physical_buffer(buffer); | ||
| 237 | +} | ||
| 238 | + | ||
| 239 | +static void | ||
| 240 | +_physical_buffer_upload_propose_allocation(gpointer impl, GstQuery *decide_query, | ||
| 241 | + GstQuery *query) | ||
| 242 | +{ | ||
| 243 | + gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, 0); | ||
| 244 | +} | ||
| 245 | + | ||
| 246 | +static GstGLUploadReturn | ||
| 247 | +_physical_buffer_upload_perform(gpointer impl, GstBuffer *buffer, GstBuffer **outbuf) | ||
| 248 | +{ | ||
| 249 | + struct PhyBufferUpload *phyBuffer = impl; | ||
| 250 | + GstGLMemoryAllocator *allocator; | ||
| 251 | + GstVideoInfo *info; | ||
| 252 | + gint n_mem; | ||
| 253 | + | ||
| 254 | + info = &phyBuffer->upload->priv->out_info; | ||
| 255 | + n_mem = GST_VIDEO_INFO_N_PLANES (info); | ||
| 256 | + GST_LOG_OBJECT (phyBuffer->upload, "Attempting viv direct upload, out format %s", | ||
| 257 | + gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (info))); | ||
| 258 | + | ||
| 259 | + allocator = | ||
| 260 | + GST_GL_MEMORY_ALLOCATOR (gst_allocator_find | ||
| 261 | + (GST_GL_MEMORY_PBO_ALLOCATOR_NAME)); | ||
| 262 | + | ||
| 263 | + /* FIXME: buffer pool */ | ||
| 264 | + *outbuf = gst_buffer_new (); | ||
| 265 | + gst_gl_memory_setup_buffer (allocator, *outbuf, phyBuffer->params, NULL, | ||
| 266 | + NULL, 0); | ||
| 267 | + gst_object_unref (allocator); | ||
| 268 | + | ||
| 269 | + GstGLMemory *out_gl_mem = | ||
| 270 | + (GstGLMemory *) gst_buffer_peek_memory (*outbuf, 0); | ||
| 271 | + | ||
| 272 | + gst_gl_viv_direct_bind_gstbuffer(phyBuffer->upload->context, out_gl_mem->tex_id, | ||
| 273 | + &phyBuffer->upload->priv->in_info, buffer); | ||
| 274 | + | ||
| 275 | + gst_buffer_add_video_meta_full (*outbuf, 0, | ||
| 276 | + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), | ||
| 277 | + GST_VIDEO_INFO_HEIGHT (info), n_mem, info->offset, info->stride); | ||
| 278 | + | ||
| 279 | + return GST_GL_UPLOAD_DONE; | ||
| 280 | +} | ||
| 281 | + | ||
| 282 | +static void | ||
| 283 | +_physical_buffer_upload_free(gpointer impl) | ||
| 284 | +{ | ||
| 285 | + struct PhyBufferUpload *phyBuffer = impl; | ||
| 286 | + | ||
| 287 | + if (phyBuffer->params) | ||
| 288 | + gst_gl_allocation_params_free ((GstGLAllocationParams *) phyBuffer->params); | ||
| 289 | + | ||
| 290 | + g_free(phyBuffer); | ||
| 291 | +} | ||
| 292 | + | ||
| 293 | +static GstStaticCaps _physical_buffer_upload_caps = | ||
| 294 | +GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_GL_DIRECTVIV_FORMAT)); | ||
| 295 | + | ||
| 296 | +static const UploadMethod _physical_buffer_upload = { | ||
| 297 | + "Physical buffer", | ||
| 298 | + 0, | ||
| 299 | + &_physical_buffer_upload_caps, | ||
| 300 | + &_physical_buffer_upload_new, | ||
| 301 | + &_physical_buffer_upload_transform_caps, | ||
| 302 | + &_physical_buffer_upload_accept, | ||
| 303 | + &_physical_buffer_upload_propose_allocation, | ||
| 304 | + &_physical_buffer_upload_perform, | ||
| 305 | + &_physical_buffer_upload_free | ||
| 306 | +}; | ||
| 307 | +#endif /* GST_GL_HAVE_DIRECTVIV */ | ||
| 308 | + | ||
| 309 | struct RawUploadFrame | ||
| 310 | { | ||
| 311 | gint ref_count; | ||
| 312 | @@ -1191,7 +1332,11 @@ static const UploadMethod *upload_methods[] = { &_gl_memory_upload, | ||
| 313 | #if GST_GL_HAVE_DMABUF | ||
| 314 | &_dma_buf_upload, | ||
| 315 | #endif | ||
| 316 | - &_upload_meta_upload, &_raw_data_upload | ||
| 317 | + &_upload_meta_upload, | ||
| 318 | +#if GST_GL_HAVE_DIRECTVIV | ||
| 319 | + &_physical_buffer_upload, | ||
| 320 | +#endif | ||
| 321 | + &_raw_data_upload | ||
| 322 | }; | ||
| 323 | |||
| 324 | static GMutex upload_global_lock; | ||
| 325 | @@ -1325,7 +1470,7 @@ gst_gl_upload_transform_caps (GstGLUpload * upload, GstGLContext * context, | ||
| 326 | } | ||
| 327 | |||
| 328 | if (filter) { | ||
| 329 | - result = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST); | ||
| 330 | + result = gst_caps_intersect_full (tmp, filter, GST_CAPS_INTERSECT_FIRST); | ||
| 331 | gst_caps_unref (tmp); | ||
| 332 | } else { | ||
| 333 | result = tmp; | ||
| 334 | diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 335 | new file mode 100644 | ||
| 336 | index 0000000..4c9dc69 | ||
| 337 | --- /dev/null | ||
| 338 | +++ b/gst-libs/gst/gl/gstglvivdirecttexture.c | ||
| 339 | @@ -0,0 +1,149 @@ | ||
| 340 | +/* | ||
| 341 | + * GStreamer | ||
| 342 | + * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
| 343 | + * | ||
| 344 | + * This library is free software; you can redistribute it and/or | ||
| 345 | + * modify it under the terms of the GNU Library General Public | ||
| 346 | + * License as published by the Free Software Foundation; either | ||
| 347 | + * version 2 of the License, or (at your option) any later version. | ||
| 348 | + * | ||
| 349 | + * This library is distributed in the hope that it will be useful, | ||
| 350 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 351 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 352 | + * Library General Public License for more details. | ||
| 353 | + * | ||
| 354 | + * You should have received a copy of the GNU Library General Public | ||
| 355 | + * License along with this library; if not, write to the | ||
| 356 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 357 | + * Boston, MA 02110-1301, USA. | ||
| 358 | + */ | ||
| 359 | + | ||
| 360 | +#ifdef HAVE_CONFIG_H | ||
| 361 | +#include "config.h" | ||
| 362 | +#endif | ||
| 363 | + | ||
| 364 | +#include "gl.h" | ||
| 365 | +#include "gstglvivdirecttexture.h" | ||
| 366 | +#include <gst/allocators/gstallocatorphymem.h> | ||
| 367 | + | ||
| 368 | +GST_DEBUG_CATEGORY_EXTERN (gst_gl_upload_debug); | ||
| 369 | +#define GST_CAT_DEFAULT gst_gl_upload_debug | ||
| 370 | + | ||
| 371 | +typedef struct { | ||
| 372 | + GstVideoFormat gst_fmt; | ||
| 373 | + guint viv_fmt; | ||
| 374 | +} VIV_FMT_MAP; | ||
| 375 | + | ||
| 376 | +static VIV_FMT_MAP viv_fmt_map_table[] = { | ||
| 377 | + {GST_VIDEO_FORMAT_I420, GL_VIV_I420}, | ||
| 378 | + {GST_VIDEO_FORMAT_YV12, GL_VIV_YV12}, | ||
| 379 | + {GST_VIDEO_FORMAT_NV12, GL_VIV_NV12}, | ||
| 380 | + {GST_VIDEO_FORMAT_NV21, GL_VIV_NV21}, | ||
| 381 | + {GST_VIDEO_FORMAT_YUY2, GL_VIV_YUY2}, | ||
| 382 | + {GST_VIDEO_FORMAT_UYVY, GL_VIV_UYVY}, | ||
| 383 | + {GST_VIDEO_FORMAT_RGBA, GL_RGBA}, | ||
| 384 | + {GST_VIDEO_FORMAT_RGBx, GL_RGBA}, | ||
| 385 | + {GST_VIDEO_FORMAT_BGRA, GL_BGRA_EXT}, | ||
| 386 | + {GST_VIDEO_FORMAT_RGB16, GL_RGB565_OES} | ||
| 387 | +}; | ||
| 388 | + | ||
| 389 | +typedef struct { | ||
| 390 | + guint tex_id; | ||
| 391 | + guint w; | ||
| 392 | + guint h; | ||
| 393 | + guint fmt; | ||
| 394 | + void *vaddr; | ||
| 395 | + guint paddr; | ||
| 396 | + gboolean ret; | ||
| 397 | +} GstVivDirectTexture; | ||
| 398 | + | ||
| 399 | +gboolean | ||
| 400 | +gst_is_physical_buffer (GstBuffer *buffer) | ||
| 401 | +{ | ||
| 402 | + return gst_buffer_is_phymem (buffer); | ||
| 403 | +} | ||
| 404 | + | ||
| 405 | +static void | ||
| 406 | +_do_viv_direct_tex_bind_mem (GstGLContext * context, GstVivDirectTexture * viv_tex) | ||
| 407 | +{ | ||
| 408 | + 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); | ||
| 409 | + GST_DEBUG ("Physical memory buffer, vaddr: %p, paddr: %p", viv_tex->vaddr, viv_tex->paddr); | ||
| 410 | + | ||
| 411 | + glBindTexture (GL_TEXTURE_2D, viv_tex->tex_id); | ||
| 412 | + glTexDirectVIVMap (GL_TEXTURE_2D, viv_tex->w, viv_tex->h, viv_tex->fmt, &viv_tex->vaddr, &viv_tex->paddr); | ||
| 413 | + glTexDirectInvalidateVIV (GL_TEXTURE_2D); | ||
| 414 | + viv_tex->ret = TRUE; | ||
| 415 | + | ||
| 416 | + return; | ||
| 417 | +} | ||
| 418 | + | ||
| 419 | +gst_gl_is_directviv_supported_format (GstVideoFormat fmt) | ||
| 420 | +{ | ||
| 421 | + gint i; | ||
| 422 | + gboolean ret = FALSE; | ||
| 423 | + | ||
| 424 | + for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) { | ||
| 425 | + if (fmt == viv_fmt_map_table[i].gst_fmt) { | ||
| 426 | + ret = TRUE; | ||
| 427 | + break; | ||
| 428 | + } | ||
| 429 | + } | ||
| 430 | + | ||
| 431 | + return ret; | ||
| 432 | +} | ||
| 433 | + | ||
| 434 | +gboolean | ||
| 435 | +gst_gl_viv_direct_bind_data (GstGLContext * context, | ||
| 436 | + guint tex_id, GstVideoFormat fmt, gint width, gint height, | ||
| 437 | + gpointer * vaddr, gpointer *paddr) | ||
| 438 | +{ | ||
| 439 | + guint viv_fmt = GL_NONE; | ||
| 440 | + gint i; | ||
| 441 | + | ||
| 442 | + for (i=0; i<sizeof(viv_fmt_map_table)/sizeof(VIV_FMT_MAP); i++) { | ||
| 443 | + if (fmt == viv_fmt_map_table[i].gst_fmt) { | ||
| 444 | + viv_fmt = viv_fmt_map_table[i].viv_fmt; | ||
| 445 | + break; | ||
| 446 | + } | ||
| 447 | + } | ||
| 448 | + | ||
| 449 | + if (viv_fmt == GL_NONE) { | ||
| 450 | + GST_ERROR ("Not supported format %d for viv direct texture upload.", fmt); | ||
| 451 | + return FALSE; | ||
| 452 | + } | ||
| 453 | + | ||
| 454 | + GstVivDirectTexture viv_tex = {tex_id, width, height, viv_fmt, vaddr, paddr, FALSE}; | ||
| 455 | + gst_gl_context_thread_add (context, (GstGLContextThreadFunc) _do_viv_direct_tex_bind_mem, &viv_tex); | ||
| 456 | + | ||
| 457 | + return viv_tex.ret; | ||
| 458 | +} | ||
| 459 | + | ||
| 460 | +gboolean | ||
| 461 | +gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer) | ||
| 462 | +{ | ||
| 463 | + PhyMemBlock *memblk; | ||
| 464 | + GstVideoMeta *vmeta; | ||
| 465 | + GstVideoFormat fmt; | ||
| 466 | + gint width, height; | ||
| 467 | + | ||
| 468 | + memblk = gst_buffer_query_phymem_block (buffer); | ||
| 469 | + if (!memblk) | ||
| 470 | + return FALSE; | ||
| 471 | + | ||
| 472 | + width = GST_VIDEO_INFO_WIDTH (info); | ||
| 473 | + height = GST_VIDEO_INFO_HEIGHT (info); | ||
| 474 | + | ||
| 475 | + vmeta = gst_buffer_get_video_meta (buffer); | ||
| 476 | + fmt = GST_VIDEO_INFO_FORMAT (info); | ||
| 477 | + if (vmeta && (fmt == GST_VIDEO_FORMAT_I420 || fmt == GST_VIDEO_FORMAT_NV12)) { | ||
| 478 | + width = vmeta->stride[0]; | ||
| 479 | + height = vmeta->offset[1] / width; | ||
| 480 | + } | ||
| 481 | + else { | ||
| 482 | + width = GST_VIDEO_INFO_WIDTH (info); | ||
| 483 | + height = GST_VIDEO_INFO_HEIGHT (info); | ||
| 484 | + } | ||
| 485 | + | ||
| 486 | + return gst_gl_viv_direct_bind_data (context, tex_id, fmt, width, height, memblk->vaddr, memblk->paddr); | ||
| 487 | +} | ||
| 488 | + | ||
| 489 | diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.h b/gst-libs/gst/gl/gstglvivdirecttexture.h | ||
| 490 | new file mode 100644 | ||
| 491 | index 0000000..9a2d123 | ||
| 492 | --- /dev/null | ||
| 493 | +++ b/gst-libs/gst/gl/gstglvivdirecttexture.h | ||
| 494 | @@ -0,0 +1,38 @@ | ||
| 495 | +/* | ||
| 496 | + * GStreamer | ||
| 497 | + * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
| 498 | + * | ||
| 499 | + * This library is free software; you can redistribute it and/or | ||
| 500 | + * modify it under the terms of the GNU Library General Public | ||
| 501 | + * License as published by the Free Software Foundation; either | ||
| 502 | + * version 2 of the License, or (at your option) any later version. | ||
| 503 | + * | ||
| 504 | + * This library is distributed in the hope that it will be useful, | ||
| 505 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 506 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 507 | + * Library General Public License for more details. | ||
| 508 | + * | ||
| 509 | + * You should have received a copy of the GNU Library General Public | ||
| 510 | + * License along with this library; if not, write to the | ||
| 511 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 512 | + * Boston, MA 02110-1301, USA. | ||
| 513 | + */ | ||
| 514 | + | ||
| 515 | +#ifndef __GST_GL_VIVDIRECT_H__ | ||
| 516 | +#define __GST_GL_VIVDIRECT_H__ | ||
| 517 | + | ||
| 518 | +#include <gst/video/video.h> | ||
| 519 | +#include <gst/gl/gstgl_fwd.h> | ||
| 520 | + | ||
| 521 | +#define GST_GL_DIRECTVIV_FORMAT "{RGBA, I420, YV12, NV12, NV21, YUY2, UYVY, BGRA, RGB16}" | ||
| 522 | +G_BEGIN_DECLS | ||
| 523 | + | ||
| 524 | +gboolean gst_is_physical_buffer (GstBuffer *buffer); | ||
| 525 | +gboolean gst_gl_is_directviv_supported_format (GstVideoFormat fmt); | ||
| 526 | +gboolean gst_gl_viv_direct_bind_data (GstGLContext * context, guint tex_id, GstVideoFormat fmt, gint width, gint height, | ||
| 527 | + gpointer * vaddr, gpointer *paddr); | ||
| 528 | +gboolean gst_gl_viv_direct_bind_gstbuffer (GstGLContext * context, guint tex_id, GstVideoInfo * info, GstBuffer * buffer); | ||
| 529 | + | ||
| 530 | +G_END_DECLS | ||
| 531 | + | ||
| 532 | +#endif /* __GST_GL_VIVDIRECT_H__ */ | ||
| 533 | -- | ||
| 534 | 1.9.1 | ||
| 535 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with.patch deleted file mode 100755 index eee43a666..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with.patch +++ /dev/null | |||
| @@ -1,608 +0,0 @@ | |||
| 1 | From 771ef0eb163d23d172527e11ce1b587a03cfa745 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <jared.hu@nxp.com> | ||
| 3 | Date: Sun, 13 Nov 2016 00:45:29 +0800 | ||
| 4 | Subject: [PATCH] MMFMWK-6930 [glplugin] Accelerate gldownload with | ||
| 5 | MIME-Version: 1.0 | ||
| 6 | Content-Type: text/plain; charset=UTF-8 | ||
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | |||
| 9 | 1) Propose a physical buffer pool to upstream in gldownload | ||
| 10 | 2) Bind the physical buffer with texture via dirctviv | ||
| 11 | 3) In gldownload, wrap the physical buffer to gstbuffer, pass to | ||
| 12 | downstream plugins. | ||
| 13 | 4) Add some configure check for g2d and phymem | ||
| 14 | |||
| 15 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 16 | |||
| 17 | Signed-off-by: Haihua Hu <jared.hu@nxp.com> | ||
| 18 | --- | ||
| 19 | configure.ac | 11 ++ | ||
| 20 | ext/gl/gstgldownloadelement.c | 99 +++++++++++++++ | ||
| 21 | gst-libs/gst/gl/Makefile.am | 12 ++ | ||
| 22 | gst-libs/gst/gl/gstglbufferpool.c | 16 +++ | ||
| 23 | gst-libs/gst/gl/gstglphymemory.c | 254 ++++++++++++++++++++++++++++++++++++++ | ||
| 24 | gst-libs/gst/gl/gstglphymemory.h | 43 +++++++ | ||
| 25 | 6 files changed, 435 insertions(+) | ||
| 26 | create mode 100644 gst-libs/gst/gl/gstglphymemory.c | ||
| 27 | create mode 100644 gst-libs/gst/gl/gstglphymemory.h | ||
| 28 | |||
| 29 | diff --git a/configure.ac b/configure.ac | ||
| 30 | index 3dc2b75..90bf768 100644 | ||
| 31 | --- a/configure.ac | ||
| 32 | +++ b/configure.ac | ||
| 33 | @@ -702,6 +702,7 @@ HAVE_GLES3_H=no | ||
| 34 | HAVE_WAYLAND_EGL=no | ||
| 35 | HAVE_FB_EGL=no | ||
| 36 | HAVE_DIRECTVIV=no | ||
| 37 | +HAVE_G2D=no | ||
| 38 | |||
| 39 | HAVE_EGL_RPI=no | ||
| 40 | |||
| 41 | @@ -742,6 +743,7 @@ case $host in | ||
| 42 | dnl check fb backend for imx soc | ||
| 43 | AC_CHECK_LIB(EGL, fbGetDisplay, HAVE_FB_EGL=yes, HAVE_FB_EGL=no) | ||
| 44 | AC_CHECK_LIB(GLESv2, glTexDirectVIV, HAVE_DIRECTVIV=yes, HAVE_DIRECTVIV=no) | ||
| 45 | + AC_CHECK_HEADER(g2d.h, HAVE_G2D=yes, HAVE_G2D=no) | ||
| 46 | |||
| 47 | dnl FIXME: Mali EGL depends on GLESv1 or GLESv2 | ||
| 48 | AC_CHECK_HEADER([EGL/fbdev_window.h], | ||
| 49 | @@ -854,8 +856,14 @@ fi | ||
| 50 | |||
| 51 | dnl specific for imx soc | ||
| 52 | GST_GL_HAVE_DIRECTVIV=0 | ||
| 53 | +GST_GL_HAVE_PHYMEM=0 | ||
| 54 | if test "x$HAVE_DIRECTVIV" = "xyes"; then | ||
| 55 | GST_GL_HAVE_DIRECTVIV=1 | ||
| 56 | + if test "x$HAVE_G2D" = "xyes"; then | ||
| 57 | + GST_GL_HAVE_PHYMEM=1 | ||
| 58 | + else | ||
| 59 | + AC_MSG_WARN([Physical memory do not support]) | ||
| 60 | + fi | ||
| 61 | fi | ||
| 62 | |||
| 63 | dnl X, GLX and OpenGL | ||
| 64 | @@ -1317,6 +1325,7 @@ GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES | ||
| 65 | GL_CONFIG_DEFINES="$GL_CONFIG_DEFINES | ||
| 66 | #define GST_GL_HAVE_DMABUF $GST_GL_HAVE_DMABUF | ||
| 67 | #define GST_GL_HAVE_DIRECTVIV $GST_GL_HAVE_DIRECTVIV | ||
| 68 | +#define GST_GL_HAVE_PHYMEM $GST_GL_HAVE_PHYMEM | ||
| 69 | " | ||
| 70 | |||
| 71 | dnl Check for no platforms/window systems | ||
| 72 | @@ -1354,6 +1363,7 @@ if test "x$GL_APIS" = "x" -o "x$GL_PLATFORMS" = "x" -o "x$GL_WINDOWS" = "x"; the | ||
| 73 | HAVE_WINDOW_FB=no | ||
| 74 | |||
| 75 | HAVE_DIRECTVIV=no | ||
| 76 | + HAVE_G2D=no | ||
| 77 | fi | ||
| 78 | |||
| 79 | AC_SUBST(GL_LIBS) | ||
| 80 | @@ -1371,6 +1381,7 @@ AM_CONDITIONAL(HAVE_WINDOW_ANDROID, test "x$HAVE_WINDOW_ANDROID" = "xyes") | ||
| 81 | AM_CONDITIONAL(HAVE_WINDOW_EAGL, test "x$HAVE_WINDOW_EAGL" = "xyes") | ||
| 82 | AM_CONDITIONAL(HAVE_WINDOW_FB, test "x$HAVE_WINDOW_FB" = "xyes") | ||
| 83 | AM_CONDITIONAL(HAVE_DIRECTVIV, test "x$HAVE_DIRECTVIV" = "xyes") | ||
| 84 | +AM_CONDITIONAL(HAVE_PHYMEM, test "x$HAVE_DIRECTVIV" = "xyes" -a "x$HAVE_G2D" = "xyes") | ||
| 85 | |||
| 86 | AM_CONDITIONAL(USE_OPENGL, test "x$USE_OPENGL" = "xyes") | ||
| 87 | AM_CONDITIONAL(USE_GLES2, test "x$USE_GLES2" = "xyes") | ||
| 88 | diff --git a/ext/gl/gstgldownloadelement.c b/ext/gl/gstgldownloadelement.c | ||
| 89 | index 058398b..a5ba6ab 100644 | ||
| 90 | --- a/ext/gl/gstgldownloadelement.c | ||
| 91 | +++ b/ext/gl/gstgldownloadelement.c | ||
| 92 | @@ -25,6 +25,10 @@ | ||
| 93 | #include <gst/gl/gl.h> | ||
| 94 | #include "gstgldownloadelement.h" | ||
| 95 | |||
| 96 | +#if GST_GL_HAVE_PHYMEM | ||
| 97 | +#include <gst/gl/gstglphymemory.h> | ||
| 98 | +#endif | ||
| 99 | + | ||
| 100 | GST_DEBUG_CATEGORY_STATIC (gst_gl_download_element_debug); | ||
| 101 | #define GST_CAT_DEFAULT gst_gl_download_element_debug | ||
| 102 | |||
| 103 | @@ -45,6 +49,8 @@ gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt, | ||
| 104 | GstBuffer * buffer, GstBuffer ** outbuf); | ||
| 105 | static GstFlowReturn gst_gl_download_element_transform (GstBaseTransform * bt, | ||
| 106 | GstBuffer * buffer, GstBuffer * outbuf); | ||
| 107 | +static gboolean gst_gl_download_element_propose_allocation (GstBaseTransform * | ||
| 108 | + bt, GstQuery * decide_query, GstQuery * query); | ||
| 109 | |||
| 110 | static GstStaticPadTemplate gst_gl_download_element_src_pad_template = | ||
| 111 | GST_STATIC_PAD_TEMPLATE ("src", | ||
| 112 | @@ -70,6 +76,7 @@ gst_gl_download_element_class_init (GstGLDownloadElementClass * klass) | ||
| 113 | bt_class->prepare_output_buffer = | ||
| 114 | gst_gl_download_element_prepare_output_buffer; | ||
| 115 | bt_class->transform = gst_gl_download_element_transform; | ||
| 116 | + bt_class->propose_allocation = gst_gl_download_element_propose_allocation; | ||
| 117 | |||
| 118 | bt_class->passthrough_on_same_caps = TRUE; | ||
| 119 | |||
| 120 | @@ -160,9 +167,26 @@ static GstFlowReturn | ||
| 121 | gst_gl_download_element_prepare_output_buffer (GstBaseTransform * bt, | ||
| 122 | GstBuffer * inbuf, GstBuffer ** outbuf) | ||
| 123 | { | ||
| 124 | + GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt); | ||
| 125 | GstCaps *src_caps = gst_pad_get_current_caps (bt->srcpad); | ||
| 126 | GstCapsFeatures *features = NULL; | ||
| 127 | gint i, n; | ||
| 128 | + GstGLMemory *glmem; | ||
| 129 | + | ||
| 130 | +#if GST_GL_HAVE_PHYMEM | ||
| 131 | + glmem = gst_buffer_peek_memory (inbuf, 0); | ||
| 132 | + if (gst_is_gl_physical_memory (glmem)) { | ||
| 133 | + GstGLContext *context = GST_GL_BASE_FILTER (bt)->context; | ||
| 134 | + GstVideoInfo info; | ||
| 135 | + | ||
| 136 | + gst_video_info_from_caps (&info, src_caps); | ||
| 137 | + *outbuf = gst_gl_phymem_buffer_to_gstbuffer (context, &info, inbuf); | ||
| 138 | + | ||
| 139 | + GST_DEBUG_OBJECT (download, "gl download with direct viv."); | ||
| 140 | + | ||
| 141 | + return GST_FLOW_OK; | ||
| 142 | + } | ||
| 143 | +#endif /* GST_GL_HAVE_PHYMEM */ | ||
| 144 | |||
| 145 | *outbuf = inbuf; | ||
| 146 | |||
| 147 | @@ -194,3 +218,78 @@ gst_gl_download_element_transform (GstBaseTransform * bt, | ||
| 148 | { | ||
| 149 | return GST_FLOW_OK; | ||
| 150 | } | ||
| 151 | + | ||
| 152 | +static gboolean | ||
| 153 | +gst_gl_download_element_propose_allocation (GstBaseTransform * bt, | ||
| 154 | + GstQuery * decide_query, GstQuery * query) | ||
| 155 | +{ | ||
| 156 | + GstGLContext *context = GST_GL_BASE_FILTER (bt)->context; | ||
| 157 | + GstGLDownloadElement *download = GST_GL_DOWNLOAD_ELEMENT (bt); | ||
| 158 | + GstAllocationParams params; | ||
| 159 | + GstAllocator *allocator = NULL; | ||
| 160 | + GstBufferPool *pool = NULL; | ||
| 161 | + guint n_pools, i; | ||
| 162 | + GstVideoInfo info; | ||
| 163 | + GstCaps *caps; | ||
| 164 | + GstStructure *config; | ||
| 165 | + gsize size; | ||
| 166 | + | ||
| 167 | + gst_query_parse_allocation (query, &caps, NULL); | ||
| 168 | + if (!gst_video_info_from_caps (&info, caps)) { | ||
| 169 | + GST_WARNING_OBJECT (bt, "invalid caps specified"); | ||
| 170 | + return FALSE; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + GST_DEBUG_OBJECT (bt, "video format is %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (&info))); | ||
| 174 | + | ||
| 175 | + gst_allocation_params_init (¶ms); | ||
| 176 | + | ||
| 177 | +#if GST_GL_HAVE_PHYMEM | ||
| 178 | + if (gst_is_gl_physical_memory_supported_fmt (&info)) { | ||
| 179 | + allocator = gst_phy_mem_allocator_obtain (); | ||
| 180 | + GST_DEBUG_OBJECT (bt, "obtain physical memory allocator %p.", allocator); | ||
| 181 | + } | ||
| 182 | +#endif /* GST_GL_HAVE_PHYMEM */ | ||
| 183 | + | ||
| 184 | + if (!allocator) | ||
| 185 | + allocator = gst_allocator_find (GST_GL_MEMORY_ALLOCATOR_NAME); | ||
| 186 | + | ||
| 187 | + if (!allocator) { | ||
| 188 | + GST_ERROR_OBJECT (bt, "Can't obtain gl memory allocator."); | ||
| 189 | + return FALSE; | ||
| 190 | + } | ||
| 191 | + | ||
| 192 | + gst_query_add_allocation_param (query, allocator, ¶ms); | ||
| 193 | + gst_object_unref (allocator); | ||
| 194 | + | ||
| 195 | + n_pools = gst_query_get_n_allocation_pools (query); | ||
| 196 | + for (i = 0; i < n_pools; i++) { | ||
| 197 | + gst_query_parse_nth_allocation_pool (query, i, &pool, NULL, NULL, NULL); | ||
| 198 | + gst_object_unref (pool); | ||
| 199 | + pool = NULL; | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + //new buffer pool | ||
| 203 | + pool = gst_gl_buffer_pool_new (context); | ||
| 204 | + config = gst_buffer_pool_get_config (pool); | ||
| 205 | + | ||
| 206 | + /* the normal size of a frame */ | ||
| 207 | + size = info.size; | ||
| 208 | + gst_buffer_pool_config_set_params (config, caps, size, 0, 0); | ||
| 209 | + gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_GL_SYNC_META); | ||
| 210 | + | ||
| 211 | + if (!gst_buffer_pool_set_config (pool, config)) { | ||
| 212 | + gst_object_unref (pool); | ||
| 213 | + GST_WARNING_OBJECT (bt, "failed setting config"); | ||
| 214 | + return FALSE; | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + GST_DEBUG_OBJECT (download, "create pool %p", pool); | ||
| 218 | + | ||
| 219 | + //propose 3 buffers for better performance | ||
| 220 | + gst_query_add_allocation_pool (query, pool, size, 3, 0); | ||
| 221 | + | ||
| 222 | + gst_object_unref (pool); | ||
| 223 | + | ||
| 224 | + return TRUE; | ||
| 225 | +} | ||
| 226 | diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am | ||
| 227 | index 4fec88a..0be4fa2 100644 | ||
| 228 | --- a/gst-libs/gst/gl/Makefile.am | ||
| 229 | +++ b/gst-libs/gst/gl/Makefile.am | ||
| 230 | @@ -40,6 +40,10 @@ if HAVE_DIRECTVIV | ||
| 231 | libgstgl_@GST_API_VERSION@_la_SOURCES += gstglvivdirecttexture.c | ||
| 232 | endif | ||
| 233 | |||
| 234 | +if HAVE_PHYMEM | ||
| 235 | +libgstgl_@GST_API_VERSION@_la_SOURCES += gstglphymemory.c | ||
| 236 | +endif | ||
| 237 | + | ||
| 238 | libgstgl_@GST_API_VERSION@includedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl | ||
| 239 | libgstgl_@GST_API_VERSION@include_HEADERS = \ | ||
| 240 | gstglwindow.h \ | ||
| 241 | @@ -78,6 +82,10 @@ if HAVE_DIRECTVIV | ||
| 242 | libgstgl_@GST_API_VERSION@include_HEADERS += gstglvivdirecttexture.h | ||
| 243 | endif | ||
| 244 | |||
| 245 | +if HAVE_PHYMEM | ||
| 246 | +libgstgl_@GST_API_VERSION@include_HEADERS += gstglphymemory.h | ||
| 247 | +endif | ||
| 248 | + | ||
| 249 | noinst_HEADERS = \ | ||
| 250 | gstglsl_private.h \ | ||
| 251 | utils/opengl_versions.h \ | ||
| 252 | @@ -92,6 +100,10 @@ libgstgl_@GST_API_VERSION@_la_LIBADD = \ | ||
| 253 | $(GST_LIBS) \ | ||
| 254 | $(GL_LIBS) | ||
| 255 | |||
| 256 | +if HAVE_PHYMEM | ||
| 257 | +libgstgl_@GST_API_VERSION@_la_LIBADD += -lg2d | ||
| 258 | +endif | ||
| 259 | + | ||
| 260 | if HAVE_WINDOW_WIN32 | ||
| 261 | SUBDIRS += win32 | ||
| 262 | libgstgl_@GST_API_VERSION@_la_LIBADD += win32/libgstgl-win32.la | ||
| 263 | diff --git a/gst-libs/gst/gl/gstglbufferpool.c b/gst-libs/gst/gl/gstglbufferpool.c | ||
| 264 | index 218169a..1ca6d8c 100644 | ||
| 265 | --- a/gst-libs/gst/gl/gstglbufferpool.c | ||
| 266 | +++ b/gst-libs/gst/gl/gstglbufferpool.c | ||
| 267 | @@ -26,6 +26,10 @@ | ||
| 268 | #include "gstglbufferpool.h" | ||
| 269 | #include "gstglutils.h" | ||
| 270 | |||
| 271 | +#if GST_GL_HAVE_PHYMEM | ||
| 272 | +#include <gst/gl/gstglphymemory.h> | ||
| 273 | +#endif | ||
| 274 | + | ||
| 275 | /** | ||
| 276 | * SECTION:gstglbufferpool | ||
| 277 | * @short_description: buffer pool for #GstGLMemory objects | ||
| 278 | @@ -261,6 +265,18 @@ gst_gl_buffer_pool_alloc (GstBufferPool * pool, GstBuffer ** buffer, | ||
| 279 | goto no_buffer; | ||
| 280 | } | ||
| 281 | |||
| 282 | +#if GST_GL_HAVE_PHYMEM | ||
| 283 | + if ((g_strcmp0 (priv->allocator->mem_type, GST_GL_PHY_MEM_ALLOCATOR) == 0)) { | ||
| 284 | + GstAllocator* allocator = (GstAllocator*) gst_phy_mem_allocator_obtain (); | ||
| 285 | + if (!gst_gl_physical_memory_setup_buffer (allocator, buf, priv->gl_params)) { | ||
| 286 | + GST_ERROR_OBJECT (pool, "Can't create physcial buffer."); | ||
| 287 | + return GST_FLOW_ERROR; | ||
| 288 | + } | ||
| 289 | + *buffer = buf; | ||
| 290 | + return GST_FLOW_OK; | ||
| 291 | + } | ||
| 292 | +#endif | ||
| 293 | + | ||
| 294 | alloc = GST_GL_MEMORY_ALLOCATOR (priv->allocator); | ||
| 295 | if (!gst_gl_memory_setup_buffer (alloc, buf, priv->gl_params, NULL, NULL, 0)) | ||
| 296 | goto mem_create_failed; | ||
| 297 | diff --git a/gst-libs/gst/gl/gstglphymemory.c b/gst-libs/gst/gl/gstglphymemory.c | ||
| 298 | new file mode 100644 | ||
| 299 | index 0000000..e28546c | ||
| 300 | --- /dev/null | ||
| 301 | +++ b/gst-libs/gst/gl/gstglphymemory.c | ||
| 302 | @@ -0,0 +1,254 @@ | ||
| 303 | +/* | ||
| 304 | + * GStreamer | ||
| 305 | + * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
| 306 | + * | ||
| 307 | + * This library is free software; you can redistribute it and/or | ||
| 308 | + * modify it under the terms of the GNU Library General Public | ||
| 309 | + * License as published by the Free Software Foundation; either | ||
| 310 | + * version 2 of the License, or (at your option) any later version. | ||
| 311 | + * | ||
| 312 | + * This library is distributed in the hope that it will be useful, | ||
| 313 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 314 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 315 | + * Library General Public License for more details. | ||
| 316 | + * | ||
| 317 | + * You should have received a copy of the GNU Library General Public | ||
| 318 | + * License along with this library; if not, write to the | ||
| 319 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 320 | + * Boston, MA 02110-1301, USA. | ||
| 321 | + */ | ||
| 322 | + | ||
| 323 | +#ifdef HAVE_CONFIG_H | ||
| 324 | +#include "config.h" | ||
| 325 | +#endif | ||
| 326 | + | ||
| 327 | +#include "gstglvivdirecttexture.h" | ||
| 328 | +#include "gstglphymemory.h" | ||
| 329 | +#include <g2d.h> | ||
| 330 | + | ||
| 331 | +GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_PHY_MEMORY); | ||
| 332 | +#define GST_CAT_DEFAULT GST_CAT_GL_PHY_MEMORY | ||
| 333 | + | ||
| 334 | +typedef struct _GstPhyMemAllocator GstPhyMemAllocator; | ||
| 335 | +typedef struct _GstPhyMemAllocatorClass GstPhyMemAllocatorClass; | ||
| 336 | + | ||
| 337 | +struct _GstPhyMemAllocator | ||
| 338 | +{ | ||
| 339 | + GstAllocatorPhyMem parent; | ||
| 340 | +}; | ||
| 341 | + | ||
| 342 | +struct _GstPhyMemAllocatorClass | ||
| 343 | +{ | ||
| 344 | + GstAllocatorPhyMemClass parent_class; | ||
| 345 | +}; | ||
| 346 | + | ||
| 347 | +GType gst_phy_mem_allocator_get_type (void); | ||
| 348 | +G_DEFINE_TYPE (GstPhyMemAllocator, gst_phy_mem_allocator, GST_TYPE_ALLOCATOR_PHYMEM); | ||
| 349 | + | ||
| 350 | +static int | ||
| 351 | +alloc_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk) | ||
| 352 | +{ | ||
| 353 | + struct g2d_buf *pbuf = NULL; | ||
| 354 | + | ||
| 355 | + memblk->size = PAGE_ALIGN(memblk->size); | ||
| 356 | + | ||
| 357 | + pbuf = g2d_alloc (memblk->size, 0); | ||
| 358 | + if (!pbuf) { | ||
| 359 | + GST_ERROR("G2D allocate %u bytes memory failed: %s", | ||
| 360 | + memblk->size, strerror(errno)); | ||
| 361 | + return -1; | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + memblk->vaddr = (guchar*) pbuf->buf_vaddr; | ||
| 365 | + memblk->paddr = (guchar*) pbuf->buf_paddr; | ||
| 366 | + memblk->user_data = (gpointer) pbuf; | ||
| 367 | + GST_DEBUG("G2D allocated memory (%p)", memblk->paddr); | ||
| 368 | + | ||
| 369 | + return 1; | ||
| 370 | +} | ||
| 371 | + | ||
| 372 | +static int | ||
| 373 | +free_phymem (GstAllocatorPhyMem *allocator, PhyMemBlock *memblk) | ||
| 374 | +{ | ||
| 375 | + GST_DEBUG("G2D free memory (%p)", memblk->paddr); | ||
| 376 | + gint ret = g2d_free ((struct g2d_buf*)(memblk->user_data)); | ||
| 377 | + memblk->user_data = NULL; | ||
| 378 | + memblk->vaddr = NULL; | ||
| 379 | + memblk->paddr = NULL; | ||
| 380 | + memblk->size = 0; | ||
| 381 | + | ||
| 382 | + return ret; | ||
| 383 | +} | ||
| 384 | + | ||
| 385 | +static void | ||
| 386 | +gst_phy_mem_allocator_class_init (GstPhyMemAllocatorClass * klass) | ||
| 387 | +{ | ||
| 388 | + GstAllocatorPhyMemClass *phy_allocator_klass = (GstAllocatorPhyMemClass *) klass; | ||
| 389 | + | ||
| 390 | + phy_allocator_klass->alloc_phymem = alloc_phymem; | ||
| 391 | + phy_allocator_klass->free_phymem = free_phymem; | ||
| 392 | +} | ||
| 393 | + | ||
| 394 | +static void | ||
| 395 | +gst_phy_mem_allocator_init (GstPhyMemAllocator * allocator) | ||
| 396 | +{ | ||
| 397 | + GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator); | ||
| 398 | + | ||
| 399 | + alloc->mem_type = GST_GL_PHY_MEM_ALLOCATOR; | ||
| 400 | +} | ||
| 401 | + | ||
| 402 | + | ||
| 403 | +static gpointer | ||
| 404 | +gst_phy_mem_allocator_init_instance (gpointer data) | ||
| 405 | +{ | ||
| 406 | + GstAllocator *allocator = | ||
| 407 | + g_object_new (gst_phy_mem_allocator_get_type (), NULL); | ||
| 408 | + | ||
| 409 | + GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_PHY_MEMORY, "glphymemory", 0, | ||
| 410 | + "GLPhysical Memory"); | ||
| 411 | + | ||
| 412 | + gst_allocator_register (GST_GL_PHY_MEM_ALLOCATOR, gst_object_ref (allocator)); | ||
| 413 | + | ||
| 414 | + return allocator; | ||
| 415 | +} | ||
| 416 | + | ||
| 417 | +static void | ||
| 418 | +_finish_texture (GstGLContext * ctx, gpointer *data) | ||
| 419 | +{ | ||
| 420 | + GstGLFuncs *gl = ctx->gl_vtable; | ||
| 421 | + | ||
| 422 | + gl->Finish (); | ||
| 423 | +} | ||
| 424 | + | ||
| 425 | +static void | ||
| 426 | +gst_gl_phy_mem_destroy (GstMemory *mem) | ||
| 427 | +{ | ||
| 428 | + gst_memory_unref (mem); | ||
| 429 | +} | ||
| 430 | + | ||
| 431 | + | ||
| 432 | +GstAllocator * | ||
| 433 | +gst_phy_mem_allocator_obtain (void) | ||
| 434 | +{ | ||
| 435 | + static GOnce once = G_ONCE_INIT; | ||
| 436 | + | ||
| 437 | + g_once (&once, gst_phy_mem_allocator_init_instance, NULL); | ||
| 438 | + | ||
| 439 | + g_return_val_if_fail (once.retval != NULL, NULL); | ||
| 440 | + | ||
| 441 | + return (GstAllocator *) (g_object_ref (once.retval)); | ||
| 442 | +} | ||
| 443 | + | ||
| 444 | +gboolean | ||
| 445 | +gst_is_gl_physical_memory (GstMemory * mem) | ||
| 446 | +{ | ||
| 447 | + GstGLBaseMemory *glmem; | ||
| 448 | + g_return_val_if_fail (gst_is_gl_memory (mem), FALSE); | ||
| 449 | + | ||
| 450 | + glmem = (GstGLBaseMemory*) mem; | ||
| 451 | + | ||
| 452 | + if (glmem->user_data | ||
| 453 | + && GST_IS_MINI_OBJECT_TYPE(glmem->user_data, GST_TYPE_MEMORY)) | ||
| 454 | + return gst_memory_is_type ((GstMemory*)glmem->user_data, GST_GL_PHY_MEM_ALLOCATOR); | ||
| 455 | + else | ||
| 456 | + return FALSE; | ||
| 457 | +} | ||
| 458 | + | ||
| 459 | +gboolean | ||
| 460 | +gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info) | ||
| 461 | +{ | ||
| 462 | + if (GST_VIDEO_INFO_IS_RGB(info) | ||
| 463 | + && gst_gl_is_directviv_supported_format (GST_VIDEO_INFO_FORMAT (info))) { | ||
| 464 | + return TRUE; | ||
| 465 | + } | ||
| 466 | + else | ||
| 467 | + return FALSE; | ||
| 468 | +} | ||
| 469 | + | ||
| 470 | +gboolean | ||
| 471 | +gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer, | ||
| 472 | + GstGLVideoAllocationParams * params) | ||
| 473 | +{ | ||
| 474 | + GstGLBaseMemoryAllocator *gl_alloc; | ||
| 475 | + GstMemory *mem = NULL; | ||
| 476 | + PhyMemBlock *memblk = NULL; | ||
| 477 | + GstGLMemory *glmem = NULL; | ||
| 478 | + gsize size; | ||
| 479 | + | ||
| 480 | + GstVideoInfo * info = params->v_info; | ||
| 481 | + GstVideoAlignment * valign = params->valign; | ||
| 482 | + | ||
| 483 | + GST_DEBUG ("glphymemory setup buffer format %s", gst_video_format_to_string (GST_VIDEO_INFO_FORMAT (info))); | ||
| 484 | + | ||
| 485 | + if (!gst_is_gl_physical_memory_supported_fmt (info)) { | ||
| 486 | + GST_DEBUG ("Not support format."); | ||
| 487 | + return FALSE; | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + //allocator = (GstAllocator*) gst_phy_mem_allocator_obtain (); | ||
| 491 | + size = gst_gl_get_plane_data_size (info, valign, 0); | ||
| 492 | + mem = gst_allocator_alloc (allocator, size, params->parent.alloc_params); | ||
| 493 | + if (!mem) { | ||
| 494 | + GST_DEBUG ("Can't allocate physical memory size %d", size); | ||
| 495 | + return FALSE; | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + memblk = gst_memory_query_phymem_block (mem); | ||
| 499 | + if (!memblk) { | ||
| 500 | + GST_ERROR("Can't find physic memory block."); | ||
| 501 | + return FALSE; | ||
| 502 | + } | ||
| 503 | + | ||
| 504 | + gl_alloc = | ||
| 505 | + GST_GL_BASE_MEMORY_ALLOCATOR (gst_gl_memory_allocator_get_default | ||
| 506 | + (params->parent.context)); | ||
| 507 | + | ||
| 508 | + params->plane = 0; | ||
| 509 | + params->parent.user_data = mem; | ||
| 510 | + params->parent.notify = gst_gl_phy_mem_destroy; | ||
| 511 | + | ||
| 512 | + glmem = (GstGLMemory *)gst_gl_base_memory_alloc (gl_alloc, (GstGLAllocationParams *) params); | ||
| 513 | + if (!glmem) { | ||
| 514 | + GST_ERROR("Can't get gl memory."); | ||
| 515 | + return FALSE; | ||
| 516 | + } | ||
| 517 | + | ||
| 518 | + gst_buffer_append_memory (buffer, (GstMemory *) glmem); | ||
| 519 | + | ||
| 520 | + gst_buffer_add_video_meta_full (buffer, 0, | ||
| 521 | + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), | ||
| 522 | + GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride); | ||
| 523 | + | ||
| 524 | + gst_gl_viv_direct_bind_data(params->parent.context, glmem->tex_id, | ||
| 525 | + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), | ||
| 526 | + GST_VIDEO_INFO_HEIGHT (info), memblk->vaddr, memblk->paddr); | ||
| 527 | + | ||
| 528 | + return TRUE; | ||
| 529 | +} | ||
| 530 | + | ||
| 531 | +GstBuffer * | ||
| 532 | +gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx, | ||
| 533 | + GstVideoInfo * info, GstBuffer *glbuf) | ||
| 534 | +{ | ||
| 535 | + GstBuffer *buf; | ||
| 536 | + GstGLBaseMemory *glmem; | ||
| 537 | + | ||
| 538 | + gst_gl_context_thread_add (ctx, (GstGLContextThreadFunc) _finish_texture, NULL); | ||
| 539 | + | ||
| 540 | + glmem = gst_buffer_peek_memory (glbuf, 0); | ||
| 541 | + | ||
| 542 | + buf = gst_buffer_new (); | ||
| 543 | + gst_buffer_append_memory (buf, (GstMemory *) glmem->user_data); | ||
| 544 | + gst_memory_ref ((GstMemory *)glmem->user_data); | ||
| 545 | + | ||
| 546 | + gst_buffer_add_video_meta_full (buf, 0, | ||
| 547 | + GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info), | ||
| 548 | + GST_VIDEO_INFO_HEIGHT (info), 1, info->offset, info->stride); | ||
| 549 | + GST_BUFFER_FLAGS (buf) = GST_BUFFER_FLAGS (glbuf); | ||
| 550 | + GST_BUFFER_PTS (buf) = GST_BUFFER_PTS (glbuf); | ||
| 551 | + GST_BUFFER_DTS (buf) = GST_BUFFER_DTS (glbuf); | ||
| 552 | + GST_BUFFER_DURATION (buf) = GST_BUFFER_DURATION (glbuf); | ||
| 553 | + | ||
| 554 | + return buf; | ||
| 555 | +} | ||
| 556 | + | ||
| 557 | diff --git a/gst-libs/gst/gl/gstglphymemory.h b/gst-libs/gst/gl/gstglphymemory.h | ||
| 558 | new file mode 100644 | ||
| 559 | index 0000000..ebb9911 | ||
| 560 | --- /dev/null | ||
| 561 | +++ b/gst-libs/gst/gl/gstglphymemory.h | ||
| 562 | @@ -0,0 +1,43 @@ | ||
| 563 | +/* | ||
| 564 | + * GStreamer | ||
| 565 | + * Copyright (c) 2015, Freescale Semiconductor, Inc. | ||
| 566 | + * | ||
| 567 | + * This library is free software; you can redistribute it and/or | ||
| 568 | + * modify it under the terms of the GNU Library General Public | ||
| 569 | + * License as published by the Free Software Foundation; either | ||
| 570 | + * version 2 of the License, or (at your option) any later version. | ||
| 571 | + * | ||
| 572 | + * This library is distributed in the hope that it will be useful, | ||
| 573 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 574 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 575 | + * Library General Public License for more details. | ||
| 576 | + * | ||
| 577 | + * You should have received a copy of the GNU Library General Public | ||
| 578 | + * License along with this library; if not, write to the | ||
| 579 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
| 580 | + * Boston, MA 02110-1301, USA. | ||
| 581 | + */ | ||
| 582 | + | ||
| 583 | +#ifndef _GST_GL_PHY_MEMORY_H_ | ||
| 584 | +#define _GST_GL_PHY_MEMORY_H_ | ||
| 585 | + | ||
| 586 | +#include <gst/gst.h> | ||
| 587 | +#include <gst/gstmemory.h> | ||
| 588 | +#include <gst/video/video.h> | ||
| 589 | +#include <gst/allocators/gstallocatorphymem.h> | ||
| 590 | + | ||
| 591 | +#include <gst/gl/gl.h> | ||
| 592 | + | ||
| 593 | +G_BEGIN_DECLS | ||
| 594 | + | ||
| 595 | +#define GST_GL_PHY_MEM_ALLOCATOR "GLPhyMemory" | ||
| 596 | + | ||
| 597 | +GstAllocator *gst_phy_mem_allocator_obtain (void); | ||
| 598 | +gboolean gst_is_gl_physical_memory (GstMemory * mem); | ||
| 599 | +gboolean gst_is_gl_physical_memory_supported_fmt (GstVideoInfo * info); | ||
| 600 | +gboolean gst_gl_physical_memory_setup_buffer (GstAllocator * allocator, GstBuffer *buffer, GstGLVideoAllocationParams * params); | ||
| 601 | +GstBuffer * gst_gl_phymem_buffer_to_gstbuffer (GstGLContext * ctx, GstVideoInfo * info, GstBuffer *glbuf); | ||
| 602 | + | ||
| 603 | +G_END_DECLS | ||
| 604 | + | ||
| 605 | +#endif /* _GST_GL_PHY_MEMORY_H_ */ | ||
| 606 | -- | ||
| 607 | 1.9.1 | ||
| 608 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch deleted file mode 100644 index f126f17ab..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch +++ /dev/null | |||
| @@ -1,168 +0,0 @@ | |||
| 1 | From 64718397e93087ffe37ad3209535ef84e15854aa Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <b55597@freescale.com> | ||
| 3 | Date: Thu, 25 Feb 2016 13:53:20 +0800 | ||
| 4 | Subject: [PATCH 16/26] glcolorconvert: convert YUV to RGB use directviv | ||
| 5 | |||
| 6 | Add a property "disable_passthrough" in glcolorconvert for enable/disable passthrough. | ||
| 7 | When need convert YUV to RGB with directviv, set it to be TRUE. | ||
| 8 | |||
| 9 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 10 | |||
| 11 | Signed-off-by: Haihua Hu <b55597@freescale.com> | ||
| 12 | |||
| 13 | Conflicts: | ||
| 14 | gst-libs/gst/gl/gstglcolorconvert.c | ||
| 15 | --- | ||
| 16 | ext/gl/gstglcolorconvertelement.c | 70 +++++++++++++++++++++++++++++++++++++ | ||
| 17 | ext/gl/gstglcolorconvertelement.h | 1 + | ||
| 18 | gst-libs/gst/gl/gstglcolorconvert.c | 6 +++- | ||
| 19 | 3 files changed, 76 insertions(+), 1 deletion(-) | ||
| 20 | |||
| 21 | diff --git a/ext/gl/gstglcolorconvertelement.c b/ext/gl/gstglcolorconvertelement.c | ||
| 22 | index 642b494..5e26f84 100644 | ||
| 23 | --- a/ext/gl/gstglcolorconvertelement.c | ||
| 24 | +++ b/ext/gl/gstglcolorconvertelement.c | ||
| 25 | @@ -35,6 +35,14 @@ G_DEFINE_TYPE_WITH_CODE (GstGLColorConvertElement, gst_gl_color_convert_element, | ||
| 26 | "glconvertelement", 0, "convert"); | ||
| 27 | ); | ||
| 28 | |||
| 29 | +enum | ||
| 30 | +{ | ||
| 31 | + GL_COLOR_CONVERT_PROP_0, | ||
| 32 | + GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH | ||
| 33 | +}; | ||
| 34 | + | ||
| 35 | +#define DISABLE_PASSTHROUGH_DAFAULT FALSE | ||
| 36 | + | ||
| 37 | static gboolean gst_gl_color_convert_element_set_caps (GstBaseTransform * bt, | ||
| 38 | GstCaps * in_caps, GstCaps * out_caps); | ||
| 39 | static GstCaps *gst_gl_color_convert_element_transform_caps (GstBaseTransform * | ||
| 40 | @@ -54,6 +62,15 @@ static GstFlowReturn gst_gl_color_convert_element_transform (GstBaseTransform * | ||
| 41 | static GstCaps *gst_gl_color_convert_element_fixate_caps (GstBaseTransform * | ||
| 42 | bt, GstPadDirection direction, GstCaps * caps, GstCaps * othercaps); | ||
| 43 | |||
| 44 | +static void gst_gl_color_convert_set_property (GObject *object, | ||
| 45 | + guint prop_id, | ||
| 46 | + const GValue *value, | ||
| 47 | + GParamSpec *pspec); | ||
| 48 | +static void gst_gl_color_convert_get_property (GObject *object, | ||
| 49 | + guint prop_id, | ||
| 50 | + GValue *value, | ||
| 51 | + GParamSpec *pspec); | ||
| 52 | + | ||
| 53 | static GstStaticPadTemplate gst_gl_color_convert_element_src_pad_template = | ||
| 54 | GST_STATIC_PAD_TEMPLATE ("src", | ||
| 55 | GST_PAD_SRC, | ||
| 56 | @@ -89,6 +106,10 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass) | ||
| 57 | { | ||
| 58 | GstBaseTransformClass *bt_class = GST_BASE_TRANSFORM_CLASS (klass); | ||
| 59 | GstElementClass *element_class = GST_ELEMENT_CLASS (klass); | ||
| 60 | + GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
| 61 | + | ||
| 62 | + object_class->set_property = gst_gl_color_convert_set_property; | ||
| 63 | + object_class->get_property = gst_gl_color_convert_get_property; | ||
| 64 | |||
| 65 | bt_class->transform_caps = gst_gl_color_convert_element_transform_caps; | ||
| 66 | bt_class->set_caps = gst_gl_color_convert_element_set_caps; | ||
| 67 | @@ -108,6 +129,13 @@ gst_gl_color_convert_element_class_init (GstGLColorConvertElementClass * klass) | ||
| 68 | gst_element_class_add_static_pad_template (element_class, | ||
| 69 | &gst_gl_color_convert_element_sink_pad_template); | ||
| 70 | |||
| 71 | + g_object_class_install_property (object_class, GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH, | ||
| 72 | + g_param_spec_boolean ("disable_passthrough", | ||
| 73 | + "Disable passthrough", | ||
| 74 | + "Disable passthrough mode", | ||
| 75 | + DISABLE_PASSTHROUGH_DAFAULT, | ||
| 76 | + G_PARAM_READWRITE)); | ||
| 77 | + | ||
| 78 | gst_element_class_set_metadata (element_class, | ||
| 79 | "OpenGL color converter", "Filter/Converter/Video", | ||
| 80 | "Converts between color spaces using OpenGL shaders", | ||
| 81 | @@ -119,6 +147,41 @@ gst_gl_color_convert_element_init (GstGLColorConvertElement * convert) | ||
| 82 | { | ||
| 83 | gst_base_transform_set_prefer_passthrough (GST_BASE_TRANSFORM (convert), | ||
| 84 | TRUE); | ||
| 85 | + convert->disable_passthrough = FALSE; | ||
| 86 | +} | ||
| 87 | + | ||
| 88 | +static void | ||
| 89 | +gst_gl_color_convert_set_property (GObject *object, | ||
| 90 | + guint prop_id, | ||
| 91 | + const GValue *value, | ||
| 92 | + GParamSpec *pspec) | ||
| 93 | +{ | ||
| 94 | + GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object); | ||
| 95 | + switch (prop_id) { | ||
| 96 | + case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH: | ||
| 97 | + convert->disable_passthrough = g_value_get_boolean (value); | ||
| 98 | + break; | ||
| 99 | + default: | ||
| 100 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 101 | + break; | ||
| 102 | + } | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +static void | ||
| 106 | +gst_gl_color_convert_get_property (GObject *object, | ||
| 107 | + guint prop_id, | ||
| 108 | + GValue *value, | ||
| 109 | + GParamSpec *pspec) | ||
| 110 | +{ | ||
| 111 | + GstGLColorConvertElement *convert = GST_GL_COLOR_CONVERT_ELEMENT (object); | ||
| 112 | + switch (prop_id) { | ||
| 113 | + case GL_COLOR_CONVERT_PROP_DISABLE_PASSTHROUGH: | ||
| 114 | + g_value_set_boolean (value, convert->disable_passthrough); | ||
| 115 | + break; | ||
| 116 | + default: | ||
| 117 | + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); | ||
| 118 | + break; | ||
| 119 | + } | ||
| 120 | } | ||
| 121 | |||
| 122 | static gboolean | ||
| 123 | @@ -133,6 +196,13 @@ gst_gl_color_convert_element_set_caps (GstBaseTransform * bt, | ||
| 124 | if (convert->convert) | ||
| 125 | gst_gl_color_convert_set_caps (convert->convert, in_caps, out_caps); | ||
| 126 | |||
| 127 | + if(gst_base_transform_is_passthrough (bt) && convert->disable_passthrough){ | ||
| 128 | + /* if in passthrough mode and disable_passthrough is set to true, | ||
| 129 | + * set passthrough to FALSE*/ | ||
| 130 | + GST_DEBUG_OBJECT(convert, "Disable passthrough mode"); | ||
| 131 | + gst_base_transform_set_passthrough(bt, FALSE); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | return TRUE; | ||
| 135 | } | ||
| 136 | |||
| 137 | diff --git a/ext/gl/gstglcolorconvertelement.h b/ext/gl/gstglcolorconvertelement.h | ||
| 138 | index 2a0dd1d..5cdbd3a 100644 | ||
| 139 | --- a/ext/gl/gstglcolorconvertelement.h | ||
| 140 | +++ b/ext/gl/gstglcolorconvertelement.h | ||
| 141 | @@ -47,6 +47,7 @@ struct _GstGLColorConvertElement | ||
| 142 | GstGLColorConvert *convert; | ||
| 143 | GstCaps *in_caps; | ||
| 144 | GstCaps *out_caps; | ||
| 145 | + gboolean disable_passthrough; | ||
| 146 | }; | ||
| 147 | |||
| 148 | struct _GstGLColorConvertElementClass | ||
| 149 | diff --git a/gst-libs/gst/gl/gstglcolorconvert.c b/gst-libs/gst/gl/gstglcolorconvert.c | ||
| 150 | index 908a53e..4f072f5 100644 | ||
| 151 | --- a/gst-libs/gst/gl/gstglcolorconvert.c | ||
| 152 | +++ b/gst-libs/gst/gl/gstglcolorconvert.c | ||
| 153 | @@ -710,7 +710,11 @@ _gst_gl_color_convert_set_caps_unlocked (GstGLColorConvert * convert, | ||
| 154 | convert->priv->to_texture_target = to_target; | ||
| 155 | convert->initted = FALSE; | ||
| 156 | |||
| 157 | - convert->passthrough = passthrough; | ||
| 158 | + /* We may disable passthrough via an external property | ||
| 159 | + * By the way, when glconvertelement is in passthrough mode, | ||
| 160 | + * the plugin will not call gst_gl_color_convert_perform().*/ | ||
| 161 | + | ||
| 162 | + //convert->passthrough = passthrough; | ||
| 163 | #ifndef GST_DISABLE_GST_DEBUG | ||
| 164 | if (G_UNLIKELY (convert->passthrough)) | ||
| 165 | GST_DEBUG_OBJECT (convert, | ||
| 166 | -- | ||
| 167 | 1.9.1 | ||
| 168 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch deleted file mode 100644 index 787f3cbd7..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch +++ /dev/null | |||
| @@ -1,62 +0,0 @@ | |||
| 1 | From 99b8b8f92e3785ff05f30c9c1e4a722593dfc492 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <b55597@freescale.com> | ||
| 3 | Date: Wed, 9 Mar 2016 13:00:39 +0800 | ||
| 4 | Subject: [PATCH 17/26] glwindow: work around for no frame when imxplayer use | ||
| 5 | glimagesink | ||
| 6 | |||
| 7 | change parent window of internal_window in window_show function. | ||
| 8 | |||
| 9 | Upstream Status: Inappropriate [i.MX specific] | ||
| 10 | |||
| 11 | Signed-off-by: Haihua Hu <b55597@freescale.com> | ||
| 12 | --- | ||
| 13 | gst-libs/gst/gl/x11/gstglwindow_x11.c | 14 +++++++++++--- | ||
| 14 | 1 file changed, 11 insertions(+), 3 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c | ||
| 17 | index d08b757..bc7b9c0 100644 | ||
| 18 | --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c | ||
| 19 | +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c | ||
| 20 | @@ -322,13 +322,13 @@ gst_gl_window_x11_set_window_handle (GstGLWindow * window, guintptr id) | ||
| 21 | g_main_context_get_thread_default ()); | ||
| 22 | } | ||
| 23 | |||
| 24 | - XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr); | ||
| 25 | + /*XGetWindowAttributes (window_x11->device, window_x11->parent_win, &attr); | ||
| 26 | |||
| 27 | XResizeWindow (window_x11->device, window_x11->internal_win_id, | ||
| 28 | attr.width, attr.height); | ||
| 29 | |||
| 30 | XReparentWindow (window_x11->device, window_x11->internal_win_id, | ||
| 31 | - window_x11->parent_win, 0, 0); | ||
| 32 | + window_x11->parent_win, 0, 0);*/ | ||
| 33 | |||
| 34 | XSync (window_x11->device, FALSE); | ||
| 35 | } | ||
| 36 | @@ -359,7 +359,7 @@ _show_window (GstGLWindow * window) | ||
| 37 | GstGLWindowX11 *window_x11 = GST_GL_WINDOW_X11 (window); | ||
| 38 | guint width = window_x11->priv->preferred_width; | ||
| 39 | guint height = window_x11->priv->preferred_height; | ||
| 40 | - XWindowAttributes attr; | ||
| 41 | + XWindowAttributes attr, parent_attr; | ||
| 42 | |||
| 43 | XGetWindowAttributes (window_x11->device, window_x11->internal_win_id, &attr); | ||
| 44 | |||
| 45 | @@ -371,6 +371,14 @@ _show_window (GstGLWindow * window) | ||
| 46 | XResizeWindow (window_x11->device, window_x11->internal_win_id, | ||
| 47 | attr.width, attr.height); | ||
| 48 | XSync (window_x11->device, FALSE); | ||
| 49 | + }else{ | ||
| 50 | + XGetWindowAttributes (window_x11->device, window_x11->parent_win, &parent_attr); | ||
| 51 | + | ||
| 52 | + XResizeWindow (window_x11->device, window_x11->internal_win_id, | ||
| 53 | + parent_attr.width, parent_attr.height); | ||
| 54 | + | ||
| 55 | + XReparentWindow (window_x11->device, window_x11->internal_win_id, | ||
| 56 | + window_x11->parent_win, 0, 0); | ||
| 57 | } | ||
| 58 | |||
| 59 | XMapWindow (window_x11->device, window_x11->internal_win_id); | ||
| 60 | -- | ||
| 61 | 1.9.1 | ||
| 62 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glcolorconvert-fix-MRT-cannot-work-in-GLES3.0.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glcolorconvert-fix-MRT-cannot-work-in-GLES3.0.patch deleted file mode 100644 index d80d67e13..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0007-glcolorconvert-fix-MRT-cannot-work-in-GLES3.0.patch +++ /dev/null | |||
| @@ -1,132 +0,0 @@ | |||
| 1 | From f705c7bbc8274b6824a9063161263cb16af9d15d Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <jared.hu@nxp.com> | ||
| 3 | Date: Mon, 14 Nov 2016 10:53:27 +0800 | ||
| 4 | Subject: [PATCH 18/26] glcolorconvert: fix MRT cannot work in GLES3.0 | ||
| 5 | |||
| 6 | use glBlitFramebuffer for textures copy if it is available | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 9 | |||
| 10 | Signed-off-by: Haihua Hu <jared.hu@nxp.com> | ||
| 11 | --- | ||
| 12 | gst-libs/gst/gl/glprototypes/fbo.h | 6 ++--- | ||
| 13 | gst-libs/gst/gl/gstglmemory.c | 54 ++++++++++++++++++++++++++++++++------ | ||
| 14 | 2 files changed, 49 insertions(+), 11 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/gst-libs/gst/gl/glprototypes/fbo.h b/gst-libs/gst/gl/glprototypes/fbo.h | ||
| 17 | index d142483..789f289 100644 | ||
| 18 | --- a/gst-libs/gst/gl/glprototypes/fbo.h | ||
| 19 | +++ b/gst-libs/gst/gl/glprototypes/fbo.h | ||
| 20 | @@ -102,9 +102,9 @@ GST_GL_EXT_FUNCTION (GLboolean, IsFramebuffer, | ||
| 21 | GST_GL_EXT_END () | ||
| 22 | |||
| 23 | GST_GL_EXT_BEGIN (offscreen_blit, | ||
| 24 | - GST_GL_API_NONE, | ||
| 25 | - 255, 255, | ||
| 26 | - 255, 255, /* not in either GLES */ | ||
| 27 | + GST_GL_API_OPENGL3 | GST_GL_API_GLES2, | ||
| 28 | + 3, 0, | ||
| 29 | + 3, 0,/* enable to avoid using glCopyTexImage2D for texture copying */ | ||
| 30 | "EXT\0ANGLE\0", | ||
| 31 | "framebuffer_blit\0") | ||
| 32 | GST_GL_EXT_FUNCTION (void, BlitFramebuffer, | ||
| 33 | diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c | ||
| 34 | index 73c3b59..6f9794f 100644 | ||
| 35 | --- a/gst-libs/gst/gl/gstglmemory.c | ||
| 36 | +++ b/gst-libs/gst/gl/gstglmemory.c | ||
| 37 | @@ -69,6 +69,12 @@ GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY); | ||
| 38 | #ifndef GL_TEXTURE_EXTERNAL_OES | ||
| 39 | #define GL_TEXTURE_EXTERNAL_OES 0x8D65 | ||
| 40 | #endif | ||
| 41 | +#ifndef GL_READ_FRAMEBUFFER | ||
| 42 | +#define GL_READ_FRAMEBUFFER 0x8CA8 | ||
| 43 | +#endif | ||
| 44 | +#ifndef GL_DRAW_FRAMEBUFFER | ||
| 45 | +#define GL_DRAW_FRAMEBUFFER 0x8CA9 | ||
| 46 | +#endif | ||
| 47 | |||
| 48 | G_DEFINE_TYPE (GstGLMemoryAllocator, gst_gl_memory_allocator, | ||
| 49 | GST_TYPE_GL_BASE_MEMORY_ALLOCATOR); | ||
| 50 | @@ -626,7 +632,7 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id, | ||
| 51 | guint out_gl_format, out_tex_target; | ||
| 52 | GstMapInfo sinfo; | ||
| 53 | guint src_tex_id; | ||
| 54 | - guint fbo; | ||
| 55 | + guint fbo[2]; | ||
| 56 | |||
| 57 | gl = src->mem.context->gl_vtable; | ||
| 58 | out_tex_target = gst_gl_texture_target_to_gl (out_target); | ||
| 59 | @@ -659,31 +665,63 @@ gst_gl_memory_copy_teximage (GstGLMemory * src, guint tex_id, | ||
| 60 | |||
| 61 | /* FIXME: try and avoid creating and destroying fbo's every copy... */ | ||
| 62 | /* create a framebuffer object */ | ||
| 63 | - gl->GenFramebuffers (1, &fbo); | ||
| 64 | - gl->BindFramebuffer (GL_FRAMEBUFFER, fbo); | ||
| 65 | + gl->GenFramebuffers (2, &fbo[0]); | ||
| 66 | + gl->BindFramebuffer (GL_READ_FRAMEBUFFER, fbo[0]); | ||
| 67 | |||
| 68 | - gl->FramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | ||
| 69 | + gl->FramebufferTexture2D (GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | ||
| 70 | gst_gl_texture_target_to_gl (src->tex_target), src_tex_id, 0); | ||
| 71 | |||
| 72 | -// if (!gst_gl_context_check_framebuffer_status (src->context)) | ||
| 73 | -// goto fbo_error; | ||
| 74 | + if (!gst_gl_context_check_framebuffer_status (src->mem.context)) | ||
| 75 | + goto fbo_error; | ||
| 76 | + | ||
| 77 | + gl->BindFramebuffer (GL_DRAW_FRAMEBUFFER, fbo[1]); | ||
| 78 | + | ||
| 79 | + gl->FramebufferTexture2D (GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, | ||
| 80 | + gst_gl_texture_target_to_gl (src->tex_target), tex_id, 0); | ||
| 81 | |||
| 82 | + if (!gst_gl_context_check_framebuffer_status (src->mem.context)) | ||
| 83 | + goto fbo_error; | ||
| 84 | + | ||
| 85 | + /* | ||
| 86 | gl->BindTexture (out_tex_target, tex_id); | ||
| 87 | gst_gl_query_start_log (GST_GL_BASE_MEMORY_CAST (src)->query, | ||
| 88 | GST_CAT_GL_MEMORY, GST_LEVEL_LOG, NULL, "%s", "CopyTexImage2D took"); | ||
| 89 | gl->CopyTexImage2D (out_tex_target, 0, out_gl_format, 0, 0, out_width, | ||
| 90 | out_height, 0); | ||
| 91 | gst_gl_query_end (GST_GL_BASE_MEMORY_CAST (src)->query); | ||
| 92 | - | ||
| 93 | + */ | ||
| 94 | + | ||
| 95 | + /* | ||
| 96 | + * glCopyTexImage2D cannot work without internal_format | ||
| 97 | + * we cannot get the internal_format in this function | ||
| 98 | + * so use glBlitFramebuffer for texture copy | ||
| 99 | + */ | ||
| 100 | + GST_CAT_LOG(GST_CAT_GL_MEMORY,"Use BlitFramebuffer copy texture %d into %d", | ||
| 101 | + src_tex_id, tex_id); | ||
| 102 | + gl->ReadBuffer ( GL_COLOR_ATTACHMENT0 ); | ||
| 103 | + gl->BlitFramebuffer ( 0, 0, out_width, out_height, | ||
| 104 | + 0, 0, out_width, out_height, | ||
| 105 | + GL_COLOR_BUFFER_BIT, GL_LINEAR ); | ||
| 106 | gl->BindTexture (out_tex_target, 0); | ||
| 107 | gl->BindFramebuffer (GL_FRAMEBUFFER, 0); | ||
| 108 | |||
| 109 | - gl->DeleteFramebuffers (1, &fbo); | ||
| 110 | + gl->DeleteFramebuffers (2, &fbo[0]); | ||
| 111 | |||
| 112 | gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo); | ||
| 113 | |||
| 114 | return TRUE; | ||
| 115 | |||
| 116 | +fbo_error: | ||
| 117 | + { | ||
| 118 | + gl->BindTexture (out_tex_target, 0); | ||
| 119 | + gl->BindFramebuffer (GL_FRAMEBUFFER, 0); | ||
| 120 | + | ||
| 121 | + gl->DeleteFramebuffers (2, &fbo[0]); | ||
| 122 | + | ||
| 123 | + gst_memory_unmap (GST_MEMORY_CAST (src), &sinfo); | ||
| 124 | + | ||
| 125 | + return FALSE; | ||
| 126 | + } | ||
| 127 | error: | ||
| 128 | return FALSE; | ||
| 129 | } | ||
| 130 | -- | ||
| 131 | 1.9.1 | ||
| 132 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend deleted file mode 100644 index 7d852d84b..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.10.%.bbappend +++ /dev/null | |||
| @@ -1,21 +0,0 @@ | |||
| 1 | # Vivante EGL headers require the correct preprocessor | ||
| 2 | # defines to be set for each platform | ||
| 3 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
| 4 | |||
| 5 | PACKAGECONFIG_GL_imxgpu2d = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl x11', 'opengl', '', d)}" | ||
| 6 | |||
| 7 | PACKAGECONFIG_GL_imxgpu3d = "${@bb.utils.contains('DISTRO_FEATURES', 'opengl', 'gles2', '', d)}" | ||
| 8 | |||
| 9 | |||
| 10 | SRC_URI_append_imxgpu2d = " \ | ||
| 11 | file://0001-glplugin-Change-wayland-default-res-to-1024x768.patch \ | ||
| 12 | file://0002-Support-fb-backend-for-gl-plugins.patch \ | ||
| 13 | file://0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch \ | ||
| 14 | file://0004-MMFMWK-6930-glplugin-Accelerate-gldownload-with.patch \ | ||
| 15 | file://0005-glcolorconvert-convert-YUV-to-RGB-use-directviv.patch \ | ||
| 16 | file://0006-glwindow-work-around-for-no-frame-when-imxplayer-use.patch \ | ||
| 17 | file://0007-glcolorconvert-fix-MRT-cannot-work-in-GLES3.0.patch \ | ||
| 18 | " | ||
| 19 | |||
| 20 | |||
| 21 | PACKAGE_ARCH_imxgpu2d = "${MACHINE_SOCARCH}" | ||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch deleted file mode 100755 index 1f54fc192..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0001-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch +++ /dev/null | |||
| @@ -1,58 +0,0 @@ | |||
| 1 | From f19e83a1a69a3dbbeb16dc4bcee3fb87317bb65b Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Song Bing <b06498@freescale.com> | ||
| 3 | Date: Mon, 11 Jan 2016 14:51:17 +0800 | ||
| 4 | Subject: [PATCH] MMFMWK-7030 [Linux_MX6QP_ARD]IMXCameraApp:When Enabled "save | ||
| 5 | time to image" item, preview, find the time can not display | ||
| 6 | completely. 100% | ||
| 7 | |||
| 8 | As IPU need 8 pixels alignment, add one workaround in base text overlay | ||
| 9 | to generate 8 pixels alignment text video buffer. The side effect should | ||
| 10 | cause all text a little smaller. | ||
| 11 | |||
| 12 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 13 | |||
| 14 | Signed-off-by: Song Bing b06498@freescale.com | ||
| 15 | --- | ||
| 16 | ext/pango/gstbasetextoverlay.c | 12 ++++++++++-- | ||
| 17 | 1 file changed, 10 insertions(+), 2 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/ext/pango/gstbasetextoverlay.c b/ext/pango/gstbasetextoverlay.c | ||
| 20 | index 3e98aa1..de64c92 100755 | ||
| 21 | --- a/ext/pango/gstbasetextoverlay.c | ||
| 22 | +++ b/ext/pango/gstbasetextoverlay.c | ||
| 23 | @@ -1545,7 +1545,7 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay, | ||
| 24 | gint unscaled_width, unscaled_height; | ||
| 25 | gint width, height; | ||
| 26 | gboolean full_width = FALSE; | ||
| 27 | - double scalef = 1.0; | ||
| 28 | + double scalef = 1.0, scalefx, scalefy; | ||
| 29 | double a, r, g, b; | ||
| 30 | gdouble shadow_offset = 0.0; | ||
| 31 | gdouble outline_offset = 0.0; | ||
| 32 | @@ -1673,6 +1673,14 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay, | ||
| 33 | height = ceil (height * overlay->render_scale); | ||
| 34 | scalef *= overlay->render_scale; | ||
| 35 | |||
| 36 | + /* i.MX special, will cause text a little small */ | ||
| 37 | + scalefx = scalef * ((gdouble)GST_ROUND_DOWN_8 (width)) / width; | ||
| 38 | + scalefy = scalef * ((gdouble)GST_ROUND_DOWN_8 (height)) / height; | ||
| 39 | + width = GST_ROUND_DOWN_8 (width); | ||
| 40 | + height = GST_ROUND_DOWN_8 (height); | ||
| 41 | + GST_DEBUG_OBJECT (overlay, "Rendering with width %d and height %d " | ||
| 42 | + , width, height); | ||
| 43 | + | ||
| 44 | if (width <= 0 || height <= 0) { | ||
| 45 | g_mutex_unlock (GST_BASE_TEXT_OVERLAY_GET_CLASS (overlay)->pango_lock); | ||
| 46 | GST_DEBUG_OBJECT (overlay, | ||
| 47 | @@ -1689,7 +1697,7 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay, | ||
| 48 | /* Prepare the transformation matrix. Note that the transformation happens | ||
| 49 | * in reverse order. So for horizontal text, we will translate and then | ||
| 50 | * scale. This is important to understand which scale shall be used. */ | ||
| 51 | - cairo_matrix_init_scale (&cairo_matrix, scalef, scalef); | ||
| 52 | + cairo_matrix_init_scale (&cairo_matrix, scalefx, scalefy); | ||
| 53 | |||
| 54 | if (overlay->use_vertical_render) { | ||
| 55 | gint tmp; | ||
| 56 | -- | ||
| 57 | 1.7.9.5 | ||
| 58 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-Remove-dependence-on-imx-plugin-git.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-Remove-dependence-on-imx-plugin-git.patch deleted file mode 100755 index 80009a9ac..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0002-Remove-dependence-on-imx-plugin-git.patch +++ /dev/null | |||
| @@ -1,433 +0,0 @@ | |||
| 1 | From 950fe3a224eb5339c946193413f9373c333ea1f0 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Haihua Hu <jared.hu@nxp.com> | ||
| 3 | Date: Fri, 5 Aug 2016 17:08:40 +0800 | ||
| 4 | Subject: [PATCH] [MMFMWK-7259] Remove dependence on imx plugin git. | ||
| 5 | |||
| 6 | Add physical memory allocator | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 9 | |||
| 10 | Signed-off-by: Haihua Hu <jared.hu@nxp.com> | ||
| 11 | --- | ||
| 12 | gst-libs/gst/allocators/Makefile.am | 6 +- | ||
| 13 | gst-libs/gst/allocators/gstallocatorphymem.c | 314 +++++++++++++++++++++++++++ | ||
| 14 | gst-libs/gst/allocators/gstallocatorphymem.h | 64 ++++++ | ||
| 15 | 3 files changed, 382 insertions(+), 2 deletions(-) | ||
| 16 | create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.c | ||
| 17 | create mode 100755 gst-libs/gst/allocators/gstallocatorphymem.h | ||
| 18 | |||
| 19 | diff --git a/gst-libs/gst/allocators/Makefile.am b/gst-libs/gst/allocators/Makefile.am | ||
| 20 | index 5c11b8a..13ffd9c 100644 | ||
| 21 | --- a/gst-libs/gst/allocators/Makefile.am | ||
| 22 | +++ b/gst-libs/gst/allocators/Makefile.am | ||
| 23 | @@ -5,13 +5,15 @@ libgstallocators_@GST_API_VERSION@_includedir = $(includedir)/gstreamer-@GST_API | ||
| 24 | libgstallocators_@GST_API_VERSION@_include_HEADERS = \ | ||
| 25 | allocators.h \ | ||
| 26 | gstfdmemory.h \ | ||
| 27 | - gstdmabuf.h | ||
| 28 | + gstdmabuf.h \ | ||
| 29 | + gstallocatorphymem.h | ||
| 30 | |||
| 31 | noinst_HEADERS = | ||
| 32 | |||
| 33 | libgstallocators_@GST_API_VERSION@_la_SOURCES = \ | ||
| 34 | gstfdmemory.c \ | ||
| 35 | - gstdmabuf.c | ||
| 36 | + gstdmabuf.c \ | ||
| 37 | + gstallocatorphymem.c | ||
| 38 | |||
| 39 | libgstallocators_@GST_API_VERSION@_la_LIBADD = $(GST_LIBS) $(LIBM) | ||
| 40 | libgstallocators_@GST_API_VERSION@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) | ||
| 41 | diff --git a/gst-libs/gst/allocators/gstallocatorphymem.c b/gst-libs/gst/allocators/gstallocatorphymem.c | ||
| 42 | new file mode 100755 | ||
| 43 | index 0000000..cf5995e | ||
| 44 | --- /dev/null | ||
| 45 | +++ b/gst-libs/gst/allocators/gstallocatorphymem.c | ||
| 46 | @@ -0,0 +1,314 @@ | ||
| 47 | +/* | ||
| 48 | + * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved. | ||
| 49 | + * | ||
| 50 | + * This library is free software; you can redistribute it and/or | ||
| 51 | + * modify it under the terms of the GNU Library General Public | ||
| 52 | + * License as published by the Free Software Foundation; either | ||
| 53 | + * version 2 of the License, or (at your option) any later version. | ||
| 54 | + * | ||
| 55 | + * This library is distributed in the hope that it will be useful, | ||
| 56 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 57 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 58 | + * Library General Public License for more details. | ||
| 59 | + * | ||
| 60 | + * You should have received a copy of the GNU Library General Public | ||
| 61 | + * License along with this library; if not, write to the | ||
| 62 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 63 | + * Boston, MA 02111-1307, USA. | ||
| 64 | + */ | ||
| 65 | + | ||
| 66 | +#include <stdio.h> | ||
| 67 | +#include <string.h> | ||
| 68 | +#include "gstallocatorphymem.h" | ||
| 69 | + | ||
| 70 | +typedef struct { | ||
| 71 | + GstMemory mem; | ||
| 72 | + guint8 *vaddr; | ||
| 73 | + guint8 *paddr; | ||
| 74 | + PhyMemBlock block; | ||
| 75 | +} GstMemoryPhy; | ||
| 76 | + | ||
| 77 | +static int | ||
| 78 | +default_copy (GstAllocatorPhyMem *allocator, PhyMemBlock *dst_mem, | ||
| 79 | + PhyMemBlock *src_mem, guint offset, guint size) | ||
| 80 | +{ | ||
| 81 | + GST_WARNING ("No default copy implementation for physical memory allocator.\n"); | ||
| 82 | + return -1; | ||
| 83 | +} | ||
| 84 | + | ||
| 85 | +static gpointer | ||
| 86 | +gst_phymem_map (GstMemory * mem, gsize maxsize, GstMapFlags flags) | ||
| 87 | +{ | ||
| 88 | + GstMemoryPhy *phymem = (GstMemoryPhy*) mem; | ||
| 89 | + | ||
| 90 | + if (GST_MEMORY_IS_READONLY(mem) && (flags & GST_MAP_WRITE)) { | ||
| 91 | + GST_ERROR("memory is read only"); | ||
| 92 | + return NULL; | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return phymem->vaddr; | ||
| 96 | +} | ||
| 97 | + | ||
| 98 | +static void | ||
| 99 | +gst_phymem_unmap (GstMemory * mem) | ||
| 100 | +{ | ||
| 101 | + return; | ||
| 102 | +} | ||
| 103 | + | ||
| 104 | +static GstMemory * | ||
| 105 | +gst_phymem_copy (GstMemory * mem, gssize offset, gssize size) | ||
| 106 | +{ | ||
| 107 | + GstAllocatorPhyMemClass *klass; | ||
| 108 | + GstMemoryPhy *src_mem = (GstMemoryPhy *)mem; | ||
| 109 | + | ||
| 110 | + GstMemoryPhy *dst_mem = g_slice_alloc(sizeof(GstMemoryPhy)); | ||
| 111 | + if(dst_mem == NULL) { | ||
| 112 | + GST_ERROR("Can't allocate for GstMemoryPhy structure.\n"); | ||
| 113 | + return NULL; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(mem->allocator)); | ||
| 117 | + if(klass == NULL) { | ||
| 118 | + GST_ERROR("Can't get class from allocator object.\n"); | ||
| 119 | + return NULL; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + if(klass->copy_phymem((GstAllocatorPhyMem*)mem->allocator, | ||
| 123 | + &dst_mem->block, &src_mem->block, offset, size) < 0) { | ||
| 124 | + GST_WARNING ("Copy phymem %d failed.\n", size); | ||
| 125 | + return NULL; | ||
| 126 | + } | ||
| 127 | + | ||
| 128 | + GST_DEBUG ("copied phymem, vaddr(%p), paddr(%p), size(%d).\n", | ||
| 129 | + dst_mem->block.vaddr, dst_mem->block.paddr, dst_mem->block.size); | ||
| 130 | + | ||
| 131 | + dst_mem->vaddr = dst_mem->block.vaddr; | ||
| 132 | + dst_mem->paddr = dst_mem->block.paddr; | ||
| 133 | + | ||
| 134 | + gst_memory_init (GST_MEMORY_CAST (dst_mem), | ||
| 135 | + mem->mini_object.flags&(~GST_MEMORY_FLAG_READONLY), | ||
| 136 | + mem->allocator, NULL, mem->maxsize, mem->align, | ||
| 137 | + mem->offset, mem->size); | ||
| 138 | + | ||
| 139 | + return (GstMemory*)dst_mem; | ||
| 140 | +} | ||
| 141 | + | ||
| 142 | +static GstMemory * | ||
| 143 | +gst_phymem_share (GstMemory * mem, gssize offset, gssize size) | ||
| 144 | +{ | ||
| 145 | + GST_ERROR("Not implemented mem_share in gstallocatorphymem.\n"); | ||
| 146 | + return NULL; | ||
| 147 | +} | ||
| 148 | + | ||
| 149 | +static gboolean | ||
| 150 | +gst_phymem_is_span (GstMemory * mem1, GstMemory * mem2, gsize * offset) | ||
| 151 | +{ | ||
| 152 | + return FALSE; | ||
| 153 | +} | ||
| 154 | + | ||
| 155 | +static gpointer | ||
| 156 | +gst_phymem_get_phy (GstMemory * mem) | ||
| 157 | +{ | ||
| 158 | + GstMemoryPhy *phymem = (GstMemoryPhy*) mem; | ||
| 159 | + | ||
| 160 | + return phymem->paddr; | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +static GstMemory * | ||
| 164 | +base_alloc (GstAllocator * allocator, gsize size, | ||
| 165 | + GstAllocationParams * params) | ||
| 166 | +{ | ||
| 167 | + GstAllocatorPhyMemClass *klass; | ||
| 168 | + GstMemoryPhy *mem; | ||
| 169 | + gsize maxsize, aoffset, offset, align, padding; | ||
| 170 | + guint8 *data; | ||
| 171 | + | ||
| 172 | + mem = g_slice_alloc(sizeof(GstMemoryPhy)); | ||
| 173 | + if(mem == NULL) { | ||
| 174 | + GST_ERROR("Can allocate for GstMemoryPhy structure.\n"); | ||
| 175 | + return NULL; | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator)); | ||
| 179 | + if(klass == NULL) { | ||
| 180 | + GST_ERROR("Can't get class from allocator object.\n"); | ||
| 181 | + return NULL; | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + GST_DEBUG ("allocate params, prefix (%d), padding (%d), align (%d), flags (%x).\n", | ||
| 185 | + params->prefix, params->padding, params->align, params->flags); | ||
| 186 | + | ||
| 187 | + maxsize = size + params->prefix + params->padding; | ||
| 188 | + mem->block.size = maxsize; | ||
| 189 | + if(klass->alloc_phymem((GstAllocatorPhyMem*)allocator, &mem->block) < 0) { | ||
| 190 | + GST_ERROR("Allocate phymem %d failed.\n", maxsize); | ||
| 191 | + return NULL; | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + GST_DEBUG ("allocated phymem, vaddr(%p), paddr(%p), size(%d).\n", | ||
| 195 | + mem->block.vaddr, mem->block.paddr, mem->block.size); | ||
| 196 | + | ||
| 197 | + data = mem->block.vaddr; | ||
| 198 | + offset = params->prefix; | ||
| 199 | + align = params->align; | ||
| 200 | + /* do alignment */ | ||
| 201 | + if ((aoffset = ((guintptr)data & align))) { | ||
| 202 | + aoffset = (align + 1) - aoffset; | ||
| 203 | + data += aoffset; | ||
| 204 | + maxsize -= aoffset; | ||
| 205 | + } | ||
| 206 | + mem->vaddr = mem->block.vaddr + aoffset; | ||
| 207 | + mem->paddr = mem->block.paddr + aoffset; | ||
| 208 | + | ||
| 209 | + GST_DEBUG ("aligned vaddr(%p), paddr(%p), size(%d).\n", | ||
| 210 | + mem->block.vaddr, mem->block.paddr, mem->block.size); | ||
| 211 | + | ||
| 212 | + if (offset && (params->flags & GST_MEMORY_FLAG_ZERO_PREFIXED)) | ||
| 213 | + memset (data, 0, offset); | ||
| 214 | + | ||
| 215 | + padding = maxsize - (offset + size); | ||
| 216 | + if (padding && (params->flags & GST_MEMORY_FLAG_ZERO_PADDED)) | ||
| 217 | + memset (data + offset + size, 0, padding); | ||
| 218 | + | ||
| 219 | + gst_memory_init (GST_MEMORY_CAST (mem), params->flags, allocator, NULL, maxsize, align, offset, size); | ||
| 220 | + | ||
| 221 | + return (GstMemory*)mem; | ||
| 222 | +} | ||
| 223 | + | ||
| 224 | +static void | ||
| 225 | +base_free (GstAllocator * allocator, GstMemory * mem) | ||
| 226 | +{ | ||
| 227 | + GstAllocatorPhyMemClass *klass; | ||
| 228 | + GstMemoryPhy *phymem; | ||
| 229 | + | ||
| 230 | + klass = GST_ALLOCATOR_PHYMEM_CLASS(G_OBJECT_GET_CLASS(allocator)); | ||
| 231 | + if(klass == NULL) { | ||
| 232 | + GST_ERROR("Can't get class from allocator object, can't free %p\n", mem); | ||
| 233 | + return; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + phymem = (GstMemoryPhy*)mem; | ||
| 237 | + | ||
| 238 | + GST_DEBUG ("free phymem, vaddr(%p), paddr(%p), size(%d).\n", | ||
| 239 | + phymem->block.vaddr, phymem->block.paddr, phymem->block.size); | ||
| 240 | + | ||
| 241 | + klass->free_phymem((GstAllocatorPhyMem*)allocator, &phymem->block); | ||
| 242 | + g_slice_free1(sizeof(GstMemoryPhy), mem); | ||
| 243 | + | ||
| 244 | + return; | ||
| 245 | +} | ||
| 246 | + | ||
| 247 | +static int | ||
| 248 | +default_alloc (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem) | ||
| 249 | +{ | ||
| 250 | + GST_ERROR ("No default allocating implementation for physical memory allocation.\n"); | ||
| 251 | + return -1; | ||
| 252 | +} | ||
| 253 | + | ||
| 254 | +static int | ||
| 255 | +default_free (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem) | ||
| 256 | +{ | ||
| 257 | + GST_ERROR ("No default free implementation for physical memory allocation.\n"); | ||
| 258 | + return -1; | ||
| 259 | +} | ||
| 260 | + | ||
| 261 | +G_DEFINE_TYPE (GstAllocatorPhyMem, gst_allocator_phymem, GST_TYPE_ALLOCATOR); | ||
| 262 | + | ||
| 263 | +static void | ||
| 264 | +gst_allocator_phymem_class_init (GstAllocatorPhyMemClass * klass) | ||
| 265 | +{ | ||
| 266 | + GstAllocatorClass *allocator_class; | ||
| 267 | + | ||
| 268 | + allocator_class = (GstAllocatorClass *) klass; | ||
| 269 | + | ||
| 270 | + allocator_class->alloc = base_alloc; | ||
| 271 | + allocator_class->free = base_free; | ||
| 272 | + klass->alloc_phymem = default_alloc; | ||
| 273 | + klass->free_phymem = default_free; | ||
| 274 | + klass->copy_phymem = default_copy; | ||
| 275 | +} | ||
| 276 | + | ||
| 277 | +static void | ||
| 278 | +gst_allocator_phymem_init (GstAllocatorPhyMem * allocator) | ||
| 279 | +{ | ||
| 280 | + GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator); | ||
| 281 | + | ||
| 282 | + alloc->mem_map = gst_phymem_map; | ||
| 283 | + alloc->mem_unmap = gst_phymem_unmap; | ||
| 284 | + alloc->mem_copy = gst_phymem_copy; | ||
| 285 | + alloc->mem_share = gst_phymem_share; | ||
| 286 | + alloc->mem_is_span = gst_phymem_is_span; | ||
| 287 | +} | ||
| 288 | + | ||
| 289 | + | ||
| 290 | +//global functions | ||
| 291 | + | ||
| 292 | +gboolean | ||
| 293 | +gst_buffer_is_phymem (GstBuffer *buffer) | ||
| 294 | +{ | ||
| 295 | + gboolean ret = FALSE; | ||
| 296 | + PhyMemBlock * memblk; | ||
| 297 | + GstMemory *mem = gst_buffer_get_memory (buffer, 0); | ||
| 298 | + if(mem == NULL) { | ||
| 299 | + GST_ERROR ("Not get memory from buffer.\n"); | ||
| 300 | + return FALSE; | ||
| 301 | + } | ||
| 302 | + | ||
| 303 | + if(GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) { | ||
| 304 | + if (NULL == ((GstMemoryPhy*)mem)->block.paddr) { | ||
| 305 | + GST_WARNING("physical address in memory block is invalid"); | ||
| 306 | + ret = FALSE; | ||
| 307 | + } else { | ||
| 308 | + ret = TRUE; | ||
| 309 | + } | ||
| 310 | + } | ||
| 311 | + | ||
| 312 | + gst_memory_unref (mem); | ||
| 313 | + | ||
| 314 | + return ret; | ||
| 315 | +} | ||
| 316 | + | ||
| 317 | +PhyMemBlock * | ||
| 318 | +gst_buffer_query_phymem_block (GstBuffer *buffer) | ||
| 319 | +{ | ||
| 320 | + GstMemory *mem; | ||
| 321 | + GstMemoryPhy *memphy; | ||
| 322 | + PhyMemBlock *memblk; | ||
| 323 | + | ||
| 324 | + mem = gst_buffer_get_memory (buffer, 0); | ||
| 325 | + if(mem == NULL) { | ||
| 326 | + GST_ERROR ("Not get memory from buffer.\n"); | ||
| 327 | + return NULL; | ||
| 328 | + } | ||
| 329 | + | ||
| 330 | + if(!GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) { | ||
| 331 | + gst_memory_unref (mem); | ||
| 332 | + return NULL; | ||
| 333 | + } | ||
| 334 | + | ||
| 335 | + memphy = (GstMemoryPhy*) mem; | ||
| 336 | + memblk = &memphy->block; | ||
| 337 | + | ||
| 338 | + gst_memory_unref (mem); | ||
| 339 | + | ||
| 340 | + return memblk; | ||
| 341 | +} | ||
| 342 | + | ||
| 343 | +PhyMemBlock * | ||
| 344 | +gst_memory_query_phymem_block (GstMemory *mem) | ||
| 345 | +{ | ||
| 346 | + GstMemoryPhy *memphy; | ||
| 347 | + PhyMemBlock *memblk; | ||
| 348 | + | ||
| 349 | + if (!mem) | ||
| 350 | + return NULL; | ||
| 351 | + | ||
| 352 | + if (!GST_IS_ALLOCATOR_PHYMEM(mem->allocator)) | ||
| 353 | + return NULL; | ||
| 354 | + | ||
| 355 | + memphy = (GstMemoryPhy*) mem; | ||
| 356 | + memblk = &memphy->block; | ||
| 357 | + | ||
| 358 | + return memblk; | ||
| 359 | +} | ||
| 360 | + | ||
| 361 | diff --git a/gst-libs/gst/allocators/gstallocatorphymem.h b/gst-libs/gst/allocators/gstallocatorphymem.h | ||
| 362 | new file mode 100755 | ||
| 363 | index 0000000..f0833ae | ||
| 364 | --- /dev/null | ||
| 365 | +++ b/gst-libs/gst/allocators/gstallocatorphymem.h | ||
| 366 | @@ -0,0 +1,64 @@ | ||
| 367 | +/* | ||
| 368 | + * Copyright (c) 2013-2015, Freescale Semiconductor, Inc. All rights reserved. | ||
| 369 | + * | ||
| 370 | + * This library is free software; you can redistribute it and/or | ||
| 371 | + * modify it under the terms of the GNU Library General Public | ||
| 372 | + * License as published by the Free Software Foundation; either | ||
| 373 | + * version 2 of the License, or (at your option) any later version. | ||
| 374 | + * | ||
| 375 | + * This library is distributed in the hope that it will be useful, | ||
| 376 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 377 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 378 | + * Library General Public License for more details. | ||
| 379 | + * | ||
| 380 | + * You should have received a copy of the GNU Library General Public | ||
| 381 | + * License along with this library; if not, write to the | ||
| 382 | + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 383 | + * Boston, MA 02111-1307, USA. | ||
| 384 | + */ | ||
| 385 | + | ||
| 386 | +#ifndef __ALLOCATOR_PHYMEM_H__ | ||
| 387 | +#define __ALLOCATOR_PHYMEM_H__ | ||
| 388 | + | ||
| 389 | +#include <gst/gst.h> | ||
| 390 | +#include <gst/gstallocator.h> | ||
| 391 | + | ||
| 392 | +#define PAGE_ALIGN(x) (((x) + 4095) & ~4095) | ||
| 393 | + | ||
| 394 | +#define GST_TYPE_ALLOCATOR_PHYMEM (gst_allocator_phymem_get_type()) | ||
| 395 | +#define GST_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMem)) | ||
| 396 | +#define GST_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_ALLOCATOR_PHYMEM, GstAllocatorPhyMemClass)) | ||
| 397 | +#define GST_IS_ALLOCATOR_PHYMEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_ALLOCATOR_PHYMEM)) | ||
| 398 | +#define GST_IS_ALLOCATOR_PHYMEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_ALLOCATOR_PHYMEM)) | ||
| 399 | + | ||
| 400 | +typedef struct _GstAllocatorPhyMem GstAllocatorPhyMem; | ||
| 401 | +typedef struct _GstAllocatorPhyMemClass GstAllocatorPhyMemClass; | ||
| 402 | + | ||
| 403 | +/* also change gst-libs/gst/gl/gstglvivdirecttexture.c in gst-plugins-bad git | ||
| 404 | + * if changed below structure */ | ||
| 405 | +typedef struct { | ||
| 406 | + guint8 *vaddr; | ||
| 407 | + guint8 *paddr; | ||
| 408 | + guint8 *caddr; | ||
| 409 | + gsize size; | ||
| 410 | + gpointer *user_data; | ||
| 411 | +} PhyMemBlock; | ||
| 412 | + | ||
| 413 | +struct _GstAllocatorPhyMem { | ||
| 414 | + GstAllocator parent; | ||
| 415 | +}; | ||
| 416 | + | ||
| 417 | +struct _GstAllocatorPhyMemClass { | ||
| 418 | + GstAllocatorClass parent_class; | ||
| 419 | + int (*alloc_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem); | ||
| 420 | + int (*free_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *phy_mem); | ||
| 421 | + int (*copy_phymem) (GstAllocatorPhyMem *allocator, PhyMemBlock *det_mem, | ||
| 422 | + PhyMemBlock *src_mem, guint offset, guint size); | ||
| 423 | +}; | ||
| 424 | + | ||
| 425 | +GType gst_allocator_phymem_get_type (void); | ||
| 426 | +gboolean gst_buffer_is_phymem (GstBuffer *buffer); | ||
| 427 | +PhyMemBlock *gst_buffer_query_phymem_block (GstBuffer *buffer); | ||
| 428 | +PhyMemBlock *gst_memory_query_phymem_block (GstMemory *mem); | ||
| 429 | + | ||
| 430 | +#endif | ||
| 431 | -- | ||
| 432 | 1.9.1 | ||
| 433 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0003-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0003-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch deleted file mode 100644 index 398c4913a..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/0003-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch +++ /dev/null | |||
| @@ -1,35 +0,0 @@ | |||
| 1 | From 7847d85e7f37a4a40e483f3b3095c7f8a9fdf5ee Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Mingke Wang <mingke.wang@freescale.com> | ||
| 3 | Date: Thu, 19 Mar 2015 14:15:25 +0800 | ||
| 4 | Subject: [PATCH 02/13] gstplaysink: don't set async of custom text-sink to | ||
| 5 | false | ||
| 6 | |||
| 7 | Setting async to false leads to A/V sync problem when seeking. | ||
| 8 | The preroll need to use GAP event instead of set async to false. | ||
| 9 | |||
| 10 | Upstream-Status: Inappropriate [i.MX specific] | ||
| 11 | |||
| 12 | Signed-off-by: Mingke Wang <mingke.wang@freescale.com> | ||
| 13 | --- | ||
| 14 | gst/playback/gstplaysink.c | 2 +- | ||
| 15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 16 | mode change 100644 => 100755 gst/playback/gstplaysink.c | ||
| 17 | |||
| 18 | diff --git a/gst/playback/gstplaysink.c b/gst/playback/gstplaysink.c | ||
| 19 | old mode 100644 | ||
| 20 | new mode 100755 | ||
| 21 | index eaac018..02d019e | ||
| 22 | --- a/gst/playback/gstplaysink.c | ||
| 23 | +++ b/gst/playback/gstplaysink.c | ||
| 24 | @@ -2430,7 +2430,7 @@ gen_text_chain (GstPlaySink * playsink) | ||
| 25 | G_TYPE_BOOLEAN); | ||
| 26 | if (elem) { | ||
| 27 | /* make sure the sparse subtitles don't participate in the preroll */ | ||
| 28 | - g_object_set (elem, "async", FALSE, NULL); | ||
| 29 | + //g_object_set (elem, "async", FALSE, NULL); | ||
| 30 | GST_DEBUG_OBJECT (playsink, "adding custom text sink"); | ||
| 31 | gst_bin_add (bin, chain->sink); | ||
| 32 | /* NOTE streamsynchronizer needs streams decoupled */ | ||
| 33 | -- | ||
| 34 | 1.9.1 | ||
| 35 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstplaybin-remove-flag-deinterlace.patch b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstplaybin-remove-flag-deinterlace.patch deleted file mode 100644 index f2377761e..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base/gstplaybin-remove-flag-deinterlace.patch +++ /dev/null | |||
| @@ -1,31 +0,0 @@ | |||
| 1 | From 9cfb86cd100904f0ef2626f348695bd2d3416c6a Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Jian Li <jian.li@freescale.com> | ||
| 3 | Date: Mon, 23 Jun 2014 14:14:07 +0800 | ||
| 4 | Subject: [PATCH] gstplaybin remove default deinterlace flag | ||
| 5 | |||
| 6 | - remove default deinterlace flag in playbin for i.MX SoCs | ||
| 7 | |||
| 8 | Upstream-Status: Inappropriate [platform specific] | ||
| 9 | |||
| 10 | Signed-off-by: Jian Li <jian.li@freescale.com> | ||
| 11 | --- | ||
| 12 | gst/playback/gstplaybin2.c | 3 +-- | ||
| 13 | 1 file changed, 1 insertion(+), 2 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/gst/playback/gstplaybin2.c b/gst/playback/gstplaybin2.c | ||
| 16 | index fc02ca3..c342438 100644 | ||
| 17 | --- a/gst/playback/gstplaybin2.c | ||
| 18 | +++ b/gst/playback/gstplaybin2.c | ||
| 19 | @@ -511,8 +511,7 @@ struct _GstPlayBinClass | ||
| 20 | #define DEFAULT_SUBURI NULL | ||
| 21 | #define DEFAULT_SOURCE NULL | ||
| 22 | #define DEFAULT_FLAGS GST_PLAY_FLAG_AUDIO | GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_TEXT | \ | ||
| 23 | - GST_PLAY_FLAG_SOFT_VOLUME | GST_PLAY_FLAG_DEINTERLACE | \ | ||
| 24 | - GST_PLAY_FLAG_SOFT_COLORBALANCE | ||
| 25 | + GST_PLAY_FLAG_SOFT_VOLUME | ||
| 26 | #define DEFAULT_N_VIDEO 0 | ||
| 27 | #define DEFAULT_CURRENT_VIDEO -1 | ||
| 28 | #define DEFAULT_N_AUDIO 0 | ||
| 29 | -- | ||
| 30 | 1.7.9.5 | ||
| 31 | |||
diff --git a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.10.%.bbappend b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.10.%.bbappend deleted file mode 100644 index e6c080eca..000000000 --- a/recipes-multimedia/gstreamer/gstreamer1.0-plugins-base_1.10.%.bbappend +++ /dev/null | |||
| @@ -1,16 +0,0 @@ | |||
| 1 | FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" | ||
| 2 | |||
| 3 | GST_IMX_PATCHES = " file://gstplaybin-remove-flag-deinterlace.patch \ | ||
| 4 | file://0001-MMFMWK-7030-Linux_MX6QP_ARD-IMXCameraApp-When-Enable.patch \ | ||
| 5 | file://0002-Remove-dependence-on-imx-plugin-git.patch \ | ||
| 6 | file://0003-gstplaysink-don-t-set-async-of-custom-text-sink-to-f.patch \ | ||
| 7 | " | ||
| 8 | |||
| 9 | GST_IMX_PATCHES_TO_APPEND = "" | ||
| 10 | GST_IMX_PATCHES_TO_APPEND_imxpxp = "${GST_IMX_PATCHES}" | ||
| 11 | GST_IMX_PATCHES_TO_APPEND_imxvpu = "${GST_IMX_PATCHES}" | ||
| 12 | |||
| 13 | SRC_URI_append = "${GST_IMX_PATCHES_TO_APPEND}" | ||
| 14 | |||
| 15 | PACKAGE_ARCH_imxpxp = "${MACHINE_SOCARCH}" | ||
| 16 | PACKAGE_ARCH_imxvpu = "${MACHINE_SOCARCH}" | ||
