summaryrefslogtreecommitdiffstats
path: root/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad
diff options
context:
space:
mode:
authorYuqing Zhu <carol.zhu@nxp.com>2016-12-22 18:26:38 +0800
committerOtavio Salvador <otavio@ossystems.com.br>2017-01-11 10:56:36 -0200
commit591fc3b5c43518893fa928090b612c5a30fb215f (patch)
treec1f44438d2fc5fef0f03fab8490f327b9bbdfecb /recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad
parentf2fbc0edb25f6d275888113e601c6913c252ef56 (diff)
downloadmeta-freescale-591fc3b5c43518893fa928090b612c5a30fb215f.tar.gz
gstreamer1.0-plugins-bad: Add directviv to glimagesink to improve playback performance
1.Add a physical buffer uploader in glupload plugin and using viv direct texture to bind physical continious buffer with texture to avoid memory copy from videobuffer to texture to gain good performance. 2.Reduce glimagesink load latency by override glimagesink ALLOCATION query to avoid memory copy. 3.Add configure check for directviv feature. Signed-off-by: Yuqing Zhu <carol.zhu@nxp.com> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad')
-rw-r--r--recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch535
1 files changed, 535 insertions, 0 deletions
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
new file mode 100644
index 00000000..162bcbed
--- /dev/null
+++ b/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0003-Add-directviv-to-glimagesink-to-improve-playback-per.patch
@@ -0,0 +1,535 @@
1From 989d63bdf9397ba3630a3d6b9fc934b78ef62823 Mon Sep 17 00:00:00 2001
2From: Haihua Hu <b55597@freescale.com>
3Date: Tue, 13 Oct 2015 09:33:54 +0800
4Subject: [PATCH 12/26] Add directviv to glimagesink to improve playback
5 performance
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
101.Add a physical buffer uploader in glupload plugin and using viv direct
11 texture to bind physical continious buffer with texture to avoid memory
12 copy from videobuffer to texture to gain good performance.
132.Reduce glimagesink load latency by override glimagesink ALLOCATION query to
14 avoid memory copy.
153.Add configure check for directviv feature
16
17Upstream-Status: Inappropriate [i.MX specific]
18
19Signed-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
32diff --git a/configure.ac b/configure.ac
33index 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")
90diff --git a/ext/gl/gstglimagesink.c b/ext/gl/gstglimagesink.c
91index 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;
106diff --git a/gst-libs/gst/gl/Makefile.am b/gst-libs/gst/gl/Makefile.am
107index 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 \
132diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h
133index 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>
144diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c
145index 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;
334diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.c b/gst-libs/gst/gl/gstglvivdirecttexture.c
335new file mode 100644
336index 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+
489diff --git a/gst-libs/gst/gl/gstglvivdirecttexture.h b/gst-libs/gst/gl/gstglvivdirecttexture.h
490new file mode 100644
491index 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--
5341.9.1
535