diff options
author | Khem Raj <raj.khem@gmail.com> | 2016-07-29 17:58:16 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-08-04 15:22:21 +0100 |
commit | 50008ffeb95901a430160003c5823676b52615a6 (patch) | |
tree | 4d70d301fede5b1b4f800a2370bc731ce9be5693 | |
parent | a09a7b71cef054d86feb3de1ae394515929ded3d (diff) | |
download | poky-50008ffeb95901a430160003c5823676b52615a6.tar.gz |
gstreamer1.0-plugins-bad: Backport GstGLMemoryEGL implementation
Backports fix for
https://bugzilla.gnome.org/show_bug.cgi?id=760916
(From OE-Core rev: 3715cdec309b5b62035798e77a9a77b98a9f779a)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-gl-implement-GstGLMemoryEGL.patch | 495 | ||||
-rw-r--r-- | meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.2.bb | 1 |
2 files changed, 496 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-gl-implement-GstGLMemoryEGL.patch b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-gl-implement-GstGLMemoryEGL.patch new file mode 100644 index 0000000000..a67381cfef --- /dev/null +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/0008-gl-implement-GstGLMemoryEGL.patch | |||
@@ -0,0 +1,495 @@ | |||
1 | From 806bbe75b0b6947f589bce3960c28fee51b5c6c2 Mon Sep 17 00:00:00 2001 | ||
2 | From: Gwang Yoon Hwang <yoon@igalia.com> | ||
3 | Date: Thu, 21 Jan 2016 22:18:17 +0900 | ||
4 | Subject: [PATCH] gl: implement GstGLMemoryEGL | ||
5 | |||
6 | Because current GstEGLImageMemory does not inherit GstGLMemory, GLUpload | ||
7 | allocates additional GLMemory and upload the decoded contents from the decoder | ||
8 | which uses EGLImage (e.g. gst-omx in RPi). | ||
9 | |||
10 | This work adds GstGLMemoryEGL to avoid this overhead. Decoders allocate | ||
11 | GstGLMemoryEGL and decode its contents to the EGLImage of GstGLMemoryEGL. And | ||
12 | GLUpload uses this memory without allocation of additional textures and blit | ||
13 | operations. | ||
14 | |||
15 | https://bugzilla.gnome.org/show_bug.cgi?id=760916 | ||
16 | --- | ||
17 | Upstream-Status: Backport | ||
18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
19 | |||
20 | gst-libs/gst/gl/egl/Makefile.am | 2 + | ||
21 | gst-libs/gst/gl/egl/gstgldisplay_egl.c | 2 + | ||
22 | gst-libs/gst/gl/egl/gstglmemoryegl.c | 241 +++++++++++++++++++++++++++++++++ | ||
23 | gst-libs/gst/gl/egl/gstglmemoryegl.h | 108 +++++++++++++++ | ||
24 | gst-libs/gst/gl/gstgl_fwd.h | 4 + | ||
25 | gst-libs/gst/gl/gstgldisplay.c | 2 + | ||
26 | gst-libs/gst/gl/gstglupload.c | 8 ++ | ||
27 | 7 files changed, 367 insertions(+) | ||
28 | create mode 100644 gst-libs/gst/gl/egl/gstglmemoryegl.c | ||
29 | create mode 100644 gst-libs/gst/gl/egl/gstglmemoryegl.h | ||
30 | |||
31 | diff --git a/gst-libs/gst/gl/egl/Makefile.am b/gst-libs/gst/gl/egl/Makefile.am | ||
32 | index b808178..878f16c 100644 | ||
33 | --- a/gst-libs/gst/gl/egl/Makefile.am | ||
34 | +++ b/gst-libs/gst/gl/egl/Makefile.am | ||
35 | @@ -5,6 +5,7 @@ noinst_LTLIBRARIES = libgstgl-egl.la | ||
36 | libgstgl_egl_la_SOURCES = \ | ||
37 | gstgldisplay_egl.c \ | ||
38 | gstglcontext_egl.c \ | ||
39 | + gstglmemoryegl.c \ | ||
40 | gsteglimagememory.c | ||
41 | |||
42 | noinst_HEADERS = | ||
43 | @@ -13,6 +14,7 @@ libgstgl_eglincludedir = $(includedir)/gstreamer-@GST_API_VERSION@/gst/gl/egl | ||
44 | libgstgl_eglinclude_HEADERS = \ | ||
45 | gstgldisplay_egl.h \ | ||
46 | gstglcontext_egl.h \ | ||
47 | + gstglmemoryegl.h \ | ||
48 | gsteglimagememory.h \ | ||
49 | gstegl.h | ||
50 | |||
51 | diff --git a/gst-libs/gst/gl/egl/gstgldisplay_egl.c b/gst-libs/gst/gl/egl/gstgldisplay_egl.c | ||
52 | index 9acf4f0..20816c2 100644 | ||
53 | --- a/gst-libs/gst/gl/egl/gstgldisplay_egl.c | ||
54 | +++ b/gst-libs/gst/gl/egl/gstgldisplay_egl.c | ||
55 | @@ -24,6 +24,7 @@ | ||
56 | |||
57 | #include <gst/gl/egl/gstgldisplay_egl.h> | ||
58 | #include <gst/gl/egl/gsteglimagememory.h> | ||
59 | +#include <gst/gl/egl/gstglmemoryegl.h> | ||
60 | |||
61 | GST_DEBUG_CATEGORY_STATIC (gst_gl_display_debug); | ||
62 | #define GST_CAT_DEFAULT gst_gl_display_debug | ||
63 | @@ -51,6 +52,7 @@ gst_gl_display_egl_init (GstGLDisplayEGL * display_egl) | ||
64 | display_egl->foreign_display = FALSE; | ||
65 | |||
66 | gst_egl_image_memory_init (); | ||
67 | + gst_gl_memory_egl_init_once (); | ||
68 | } | ||
69 | |||
70 | static void | ||
71 | diff --git a/gst-libs/gst/gl/egl/gstglmemoryegl.c b/gst-libs/gst/gl/egl/gstglmemoryegl.c | ||
72 | new file mode 100644 | ||
73 | index 0000000..03cf432 | ||
74 | --- /dev/null | ||
75 | +++ b/gst-libs/gst/gl/egl/gstglmemoryegl.c | ||
76 | @@ -0,0 +1,241 @@ | ||
77 | +/* | ||
78 | + * GStreamer | ||
79 | + * Copyright (C) 2012 Collabora Ltd. | ||
80 | + * @author: Sebastian Dröge <sebastian.droege@collabora.co.uk> | ||
81 | + * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.com> | ||
82 | + * Copyright (C) 2015 Igalia | ||
83 | + * Author: Gwang Yoon Hwang <yoon@igalia.com> | ||
84 | + * | ||
85 | + * This library is free software; you can redistribute it and/or | ||
86 | + * modify it under the terms of the GNU Library General Public | ||
87 | + * License as published by the Free Software Foundation; either | ||
88 | + * version 2 of the License, or (at your option) any later version. | ||
89 | + * | ||
90 | + * This library is distributed in the hope that it will be useful, | ||
91 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
92 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
93 | + * Library General Public License for more details. | ||
94 | + * | ||
95 | + * You should have received a copy of the GNU Library General Public | ||
96 | + * License along with this library; if not, write to the | ||
97 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
98 | + * Boston, MA 02110-1301, USA. | ||
99 | + */ | ||
100 | + | ||
101 | +#ifdef HAVE_CONFIG_H | ||
102 | +#include "config.h" | ||
103 | +#endif | ||
104 | + | ||
105 | +#include <string.h> | ||
106 | + | ||
107 | +#include <gst/gl/egl/gstglmemoryegl.h> | ||
108 | + | ||
109 | +static GstAllocator *_gl_memory_egl_allocator; | ||
110 | + | ||
111 | +GST_DEBUG_CATEGORY_STATIC (GST_CAT_GL_MEMORY); | ||
112 | +#define GST_CAT_DEFAULT GST_CAT_GL_MEMORY | ||
113 | + | ||
114 | +#define parent_class gst_gl_memory_egl_allocator_parent_class | ||
115 | +G_DEFINE_TYPE (GstGLMemoryEGLAllocator, gst_gl_memory_egl_allocator, | ||
116 | + GST_TYPE_GL_MEMORY_ALLOCATOR); | ||
117 | + | ||
118 | +gboolean | ||
119 | +gst_is_gl_memory_egl (GstMemory * mem) | ||
120 | +{ | ||
121 | + return mem != NULL && mem->allocator != NULL | ||
122 | + && g_type_is_a (G_OBJECT_TYPE (mem->allocator), | ||
123 | + GST_TYPE_GL_MEMORY_EGL_ALLOCATOR); | ||
124 | +} | ||
125 | + | ||
126 | +static GstGLMemoryEGL * | ||
127 | +_gl_mem_get_parent (GstGLMemoryEGL * gl_mem) | ||
128 | +{ | ||
129 | + GstGLMemoryEGL *parent = (GstGLMemoryEGL *)gl_mem->mem.mem.mem.parent; | ||
130 | + return parent ? parent : gl_mem; | ||
131 | +} | ||
132 | + | ||
133 | +EGLImageKHR | ||
134 | +gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem) | ||
135 | +{ | ||
136 | + g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)), | ||
137 | + EGL_NO_IMAGE_KHR); | ||
138 | + return _gl_mem_get_parent(mem)->image; | ||
139 | +} | ||
140 | + | ||
141 | +EGLDisplay | ||
142 | +gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem) | ||
143 | +{ | ||
144 | + g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)), NULL); | ||
145 | + return GST_GL_CONTEXT_EGL(_gl_mem_get_parent(mem))->egl_display; | ||
146 | +} | ||
147 | + | ||
148 | +GstVideoGLTextureOrientation | ||
149 | +gst_gl_memory_egl_get_orientation (GstGLMemoryEGL * mem) | ||
150 | +{ | ||
151 | + g_return_val_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem)), | ||
152 | + GST_VIDEO_GL_TEXTURE_ORIENTATION_X_NORMAL_Y_NORMAL); | ||
153 | + | ||
154 | + return _gl_mem_get_parent(mem)->orientation; | ||
155 | +} | ||
156 | + | ||
157 | +void | ||
158 | +gst_gl_memory_egl_set_orientation (GstGLMemoryEGL * mem, | ||
159 | + GstVideoGLTextureOrientation orientation) | ||
160 | +{ | ||
161 | + g_return_if_fail (gst_is_gl_memory_egl (GST_MEMORY_CAST (mem))); | ||
162 | + | ||
163 | + _gl_mem_get_parent(mem)->orientation = orientation; | ||
164 | +} | ||
165 | + | ||
166 | +static GstMemory * | ||
167 | +_gl_mem_alloc (GstAllocator * allocator, gsize size, | ||
168 | + GstAllocationParams * params) | ||
169 | +{ | ||
170 | + g_warning ("Use gst_gl_base_memory_allocator_alloc() to allocate from this " | ||
171 | + "GstGLMemoryEGL allocator"); | ||
172 | + | ||
173 | + return NULL; | ||
174 | +} | ||
175 | + | ||
176 | +static void | ||
177 | +_gl_mem_destroy (GstGLMemoryEGL * mem) | ||
178 | +{ | ||
179 | + /* Shared memory should not destroy all the data */ | ||
180 | + if (!mem->mem.mem.mem.parent) { | ||
181 | + GstGLContextEGL *context = GST_GL_CONTEXT_EGL(mem->mem.mem.context); | ||
182 | + context->eglDestroyImage (context->egl_display, mem->image); | ||
183 | + } | ||
184 | + | ||
185 | + GST_GL_BASE_MEMORY_ALLOCATOR_CLASS (parent_class)->destroy ((GstGLBaseMemory | ||
186 | + *) mem); | ||
187 | +} | ||
188 | + | ||
189 | +static void | ||
190 | +_gl_mem_init (GstGLMemoryEGL * mem, GstAllocator * allocator, | ||
191 | + GstMemory * parent, GstGLContext * context, GstGLTextureTarget target, | ||
192 | + GstAllocationParams * params, GstVideoInfo * info, | ||
193 | + guint plane, GstVideoAlignment * valign, gpointer user_data, | ||
194 | + GDestroyNotify notify) | ||
195 | +{ | ||
196 | + gst_gl_memory_init ((GstGLMemory *) mem, allocator, parent, | ||
197 | + context, target, params, info, plane, valign, user_data, notify); | ||
198 | +} | ||
199 | + | ||
200 | +static GstGLMemoryEGL * | ||
201 | +_gl_mem_egl_alloc (GstGLBaseMemoryAllocator * allocator, | ||
202 | + GstGLVideoAllocationParams * params) | ||
203 | +{ | ||
204 | + guint alloc_flags = params->parent.alloc_flags; | ||
205 | + GstGLMemoryEGL *mem; | ||
206 | + | ||
207 | + g_return_val_if_fail (alloc_flags & GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_VIDEO, | ||
208 | + NULL); | ||
209 | + g_return_val_if_fail ((alloc_flags & | ||
210 | + GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_GPU_HANDLE) == 0, NULL); | ||
211 | + g_return_val_if_fail ((alloc_flags & | ||
212 | + GST_GL_ALLOCATION_PARAMS_ALLOC_FLAG_WRAP_SYSMEM) == 0, NULL); | ||
213 | + | ||
214 | + mem = g_new0 (GstGLMemoryEGL, 1); | ||
215 | + mem->image = EGL_NO_IMAGE_KHR; | ||
216 | + | ||
217 | + _gl_mem_init (mem, GST_ALLOCATOR_CAST (allocator), NULL, | ||
218 | + params->parent.context, params->target, params->parent.alloc_params, | ||
219 | + params->v_info, params->plane, params->valign, params->parent.user_data, | ||
220 | + params->parent.notify); | ||
221 | + | ||
222 | + return mem; | ||
223 | +} | ||
224 | + | ||
225 | +static gboolean | ||
226 | +_gl_mem_create (GstGLMemoryEGL * gl_mem, GError ** error) | ||
227 | +{ | ||
228 | + GstGLContextEGL *context = GST_GL_CONTEXT_EGL (gl_mem->mem.mem.context); | ||
229 | + GstGLBaseMemoryAllocatorClass *alloc_class; | ||
230 | + | ||
231 | + if (!gst_gl_context_check_feature (GST_GL_CONTEXT (context), | ||
232 | + "EGL_KHR_image_base")) { | ||
233 | + g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_WRONG_API, | ||
234 | + "EGL_KHR_image_base is not supported"); | ||
235 | + return FALSE; | ||
236 | + } | ||
237 | + | ||
238 | + alloc_class = GST_GL_BASE_MEMORY_ALLOCATOR_CLASS (parent_class); | ||
239 | + if (!alloc_class->create ((GstGLBaseMemory *) gl_mem, error)) | ||
240 | + return FALSE; | ||
241 | + | ||
242 | + gl_mem->image = context->eglCreateImage (context->egl_display, | ||
243 | + context->egl_context, EGL_GL_TEXTURE_2D_KHR, | ||
244 | + (EGLClientBuffer) GSIZE_TO_POINTER (gl_mem->mem.tex_id), NULL); | ||
245 | + | ||
246 | + GST_TRACE ("Generating EGLImage handle:%p from a texture:%u", | ||
247 | + gl_mem->image, gl_mem->mem.tex_id); | ||
248 | + | ||
249 | + if (eglGetError () != EGL_SUCCESS) { | ||
250 | + g_set_error (error, GST_GL_CONTEXT_ERROR, GST_GL_CONTEXT_ERROR_FAILED, | ||
251 | + "Failed to create EGLImage"); | ||
252 | + return FALSE; | ||
253 | + } | ||
254 | + | ||
255 | + return TRUE; | ||
256 | +} | ||
257 | + | ||
258 | +static GstMemory * | ||
259 | +_gl_mem_copy (GstGLMemoryEGL * src, gssize offset, gssize size) | ||
260 | +{ | ||
261 | + GST_CAT_ERROR (GST_CAT_GL_MEMORY, "GstGLMemoryEGL does not support copy"); | ||
262 | + return NULL; | ||
263 | +} | ||
264 | + | ||
265 | +static void | ||
266 | +gst_gl_memory_egl_allocator_class_init (GstGLMemoryEGLAllocatorClass * klass) | ||
267 | +{ | ||
268 | + GstGLBaseMemoryAllocatorClass *gl_base; | ||
269 | + GstGLMemoryAllocatorClass *gl_tex; | ||
270 | + GstAllocatorClass *allocator_class; | ||
271 | + | ||
272 | + gl_tex = (GstGLMemoryAllocatorClass *) klass; | ||
273 | + gl_base = (GstGLBaseMemoryAllocatorClass *) klass; | ||
274 | + allocator_class = (GstAllocatorClass *) klass; | ||
275 | + | ||
276 | + gl_base->alloc = (GstGLBaseMemoryAllocatorAllocFunction) _gl_mem_egl_alloc; | ||
277 | + gl_base->create = (GstGLBaseMemoryAllocatorCreateFunction) _gl_mem_create; | ||
278 | + gl_base->destroy = (GstGLBaseMemoryAllocatorDestroyFunction) _gl_mem_destroy; | ||
279 | + gl_tex->copy = (GstGLBaseMemoryAllocatorCopyFunction) _gl_mem_copy; | ||
280 | + | ||
281 | + allocator_class->alloc = _gl_mem_alloc; | ||
282 | +} | ||
283 | + | ||
284 | +static void | ||
285 | +gst_gl_memory_egl_allocator_init (GstGLMemoryEGLAllocator * allocator) | ||
286 | +{ | ||
287 | + GstAllocator *alloc = GST_ALLOCATOR_CAST (allocator); | ||
288 | + | ||
289 | + alloc->mem_type = GST_GL_MEMORY_EGL_ALLOCATOR_NAME; | ||
290 | + | ||
291 | + GST_OBJECT_FLAG_SET (allocator, GST_ALLOCATOR_FLAG_CUSTOM_ALLOC); | ||
292 | +} | ||
293 | + | ||
294 | +/** | ||
295 | + * gst_gl_memory_egl_init_once: | ||
296 | + * | ||
297 | + * Initializes the GL Memory allocator. It is safe to call this function | ||
298 | + * multiple times. This must be called before any other GstGLMemoryEGL operation. | ||
299 | + */ | ||
300 | +void | ||
301 | +gst_gl_memory_egl_init_once (void) | ||
302 | +{ | ||
303 | + static volatile gsize _init = 0; | ||
304 | + | ||
305 | + if (g_once_init_enter (&_init)) { | ||
306 | + gst_gl_memory_init_once (); | ||
307 | + | ||
308 | + GST_DEBUG_CATEGORY_INIT (GST_CAT_GL_MEMORY, "glmemory", 0, | ||
309 | + "OpenGL Texture with EGLImage memory"); | ||
310 | + | ||
311 | + _gl_memory_egl_allocator = g_object_new (GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, NULL); | ||
312 | + | ||
313 | + gst_allocator_register (GST_GL_MEMORY_EGL_ALLOCATOR_NAME, | ||
314 | + gst_object_ref (_gl_memory_egl_allocator)); | ||
315 | + g_once_init_leave (&_init, 1); | ||
316 | + } | ||
317 | +} | ||
318 | diff --git a/gst-libs/gst/gl/egl/gstglmemoryegl.h b/gst-libs/gst/gl/egl/gstglmemoryegl.h | ||
319 | new file mode 100644 | ||
320 | index 0000000..7256d33 | ||
321 | --- /dev/null | ||
322 | +++ b/gst-libs/gst/gl/egl/gstglmemoryegl.h | ||
323 | @@ -0,0 +1,108 @@ | ||
324 | +/* | ||
325 | + * GStreamer | ||
326 | + * Copyright (C) 2012 Collabora Ltd. | ||
327 | + * @author: Sebastian Dröge <sebastian.droege@collabora.co.uk> | ||
328 | + * Copyright (C) 2014 Julien Isorce <julien.isorce@gmail.com> | ||
329 | + * | ||
330 | + * This library is free software; you can redistribute it and/or | ||
331 | + * modify it under the terms of the GNU Library General Public | ||
332 | + * License as published by the Free Software Foundation; either | ||
333 | + * version 2 of the License, or (at your option) any later version. | ||
334 | + * | ||
335 | + * This library is distributed in the hope that it will be useful, | ||
336 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
337 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
338 | + * Library General Public License for more details. | ||
339 | + * | ||
340 | + * You should have received a copy of the GNU Library General Public | ||
341 | + * License along with this library; if not, write to the | ||
342 | + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, | ||
343 | + * Boston, MA 02110-1301, USA. | ||
344 | + */ | ||
345 | + | ||
346 | +#ifndef _GST_GL_MEMORY_EGL_H_ | ||
347 | +#define _GST_GL_MEMORY_EGL_H_ | ||
348 | + | ||
349 | +#include <gst/gst.h> | ||
350 | +#include <gst/gstallocator.h> | ||
351 | +#include <gst/gstmemory.h> | ||
352 | +#include <gst/video/video.h> | ||
353 | + | ||
354 | +#include <gst/gl/gl.h> | ||
355 | +#include "gstglcontext_egl.h" | ||
356 | + | ||
357 | +#include <gst/gl/gstglmemory.h> | ||
358 | + | ||
359 | +G_BEGIN_DECLS | ||
360 | + | ||
361 | +#define GST_TYPE_GL_MEMORY_EGL_ALLOCATOR (gst_gl_memory_egl_allocator_get_type()) | ||
362 | +GType gst_gl_memory_egl_allocator_get_type(void); | ||
363 | + | ||
364 | +#define GST_IS_GL_MEMORY_EGL_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR)) | ||
365 | +#define GST_IS_GL_MEMORY_EGL_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR)) | ||
366 | +#define GST_GL_MEMORY_EGL_ALLOCATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, GstGLMemoryEGLAllocatorClass)) | ||
367 | +#define GST_GL_MEMORY_EGL_ALLOCATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, GstGLMemoryEGLAllocator)) | ||
368 | +#define GST_GL_MEMORY_EGL_ALLOCATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_GL_MEMORY_EGL_ALLOCATOR, GstGLAllocatorClass)) | ||
369 | +#define GST_GL_MEMORY_EGL_ALLOCATOR_CAST(obj) ((GstGLMemoryEGLAllocator *)(obj)) | ||
370 | + | ||
371 | +typedef void (*GstEGLImageDestroyNotify) (GstGLContextEGL * context, | ||
372 | + gpointer data); | ||
373 | + | ||
374 | +typedef struct _GstEGLImageMemory GstEGLImageMemory; | ||
375 | + | ||
376 | + | ||
377 | +/** | ||
378 | + * GstGLMemoryEGL: | ||
379 | + * | ||
380 | + * Private instance | ||
381 | + */ | ||
382 | +struct _GstGLMemoryEGL | ||
383 | +{ | ||
384 | + GstGLMemory mem; | ||
385 | + | ||
386 | + EGLImageKHR image; | ||
387 | + GstVideoGLTextureOrientation orientation; | ||
388 | +}; | ||
389 | + | ||
390 | +/** | ||
391 | + * GST_GL_MEMORY_EGL_ALLOCATOR: | ||
392 | + * | ||
393 | + * The name of the GL Memory EGL allocator | ||
394 | + */ | ||
395 | +#define GST_GL_MEMORY_EGL_ALLOCATOR_NAME "GLMemoryEGL" | ||
396 | + | ||
397 | +void gst_gl_memory_egl_init_once (void); | ||
398 | +gboolean gst_is_gl_memory_egl (GstMemory * mem); | ||
399 | + | ||
400 | +EGLImageKHR gst_gl_memory_egl_get_image (GstGLMemoryEGL * mem); | ||
401 | +EGLDisplay gst_gl_memory_egl_get_display (GstGLMemoryEGL * mem); | ||
402 | + | ||
403 | +GstVideoGLTextureOrientation gst_gl_memory_egl_get_orientation | ||
404 | + (GstGLMemoryEGL * mem); | ||
405 | + | ||
406 | +void gst_gl_memory_egl_set_orientation (GstGLMemoryEGL * mem, | ||
407 | + GstVideoGLTextureOrientation orientation); | ||
408 | + | ||
409 | +/** | ||
410 | + * GstGLAllocator | ||
411 | + * | ||
412 | + * Opaque #GstGLAllocator struct | ||
413 | + */ | ||
414 | +struct _GstGLMemoryEGLAllocator | ||
415 | +{ | ||
416 | + GstGLMemoryAllocator parent; | ||
417 | +}; | ||
418 | + | ||
419 | +/** | ||
420 | + * GstGLAllocatorClass: | ||
421 | + * | ||
422 | + * The #GstGLAllocatorClass only contains private data | ||
423 | + */ | ||
424 | +struct _GstGLMemoryEGLAllocatorClass | ||
425 | +{ | ||
426 | + GstGLMemoryAllocatorClass parent_class; | ||
427 | +}; | ||
428 | + | ||
429 | +G_END_DECLS | ||
430 | + | ||
431 | +#endif /* _GST_GL_MEMORY_EGL_H_ */ | ||
432 | diff --git a/gst-libs/gst/gl/gstgl_fwd.h b/gst-libs/gst/gl/gstgl_fwd.h | ||
433 | index fb64ff6..73e17bd 100644 | ||
434 | --- a/gst-libs/gst/gl/gstgl_fwd.h | ||
435 | +++ b/gst-libs/gst/gl/gstgl_fwd.h | ||
436 | @@ -55,6 +55,10 @@ typedef struct _GstGLMemoryPBO GstGLMemoryPBO; | ||
437 | typedef struct _GstGLMemoryPBOAllocator GstGLMemoryPBOAllocator; | ||
438 | typedef struct _GstGLMemoryPBOAllocatorClass GstGLMemoryPBOAllocatorClass; | ||
439 | |||
440 | +typedef struct _GstGLMemoryEGL GstGLMemoryEGL; | ||
441 | +typedef struct _GstGLMemoryEGLAllocator GstGLMemoryEGLAllocator; | ||
442 | +typedef struct _GstGLMemoryEGLAllocatorClass GstGLMemoryEGLAllocatorClass; | ||
443 | + | ||
444 | typedef struct _GstGLSLStage GstGLSLStage; | ||
445 | typedef struct _GstGLSLStagePrivate GstGLSLStagePrivate; | ||
446 | typedef struct _GstGLSLStageClass GstGLSLStageClass; | ||
447 | diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c | ||
448 | index 60dec6a..34770d0 100644 | ||
449 | --- a/gst-libs/gst/gl/gstgldisplay.c | ||
450 | +++ b/gst-libs/gst/gl/gstgldisplay.c | ||
451 | @@ -68,6 +68,7 @@ | ||
452 | #if GST_GL_HAVE_PLATFORM_EGL | ||
453 | #include <gst/gl/egl/gstgldisplay_egl.h> | ||
454 | #include <gst/gl/egl/gsteglimagememory.h> | ||
455 | +#include <gst/gl/egl/gstglmemoryegl.h> | ||
456 | #endif | ||
457 | |||
458 | GST_DEBUG_CATEGORY_STATIC (gst_context); | ||
459 | @@ -144,6 +145,7 @@ gst_gl_display_init (GstGLDisplay * display) | ||
460 | |||
461 | #if GST_GL_HAVE_PLATFORM_EGL | ||
462 | gst_egl_image_memory_init (); | ||
463 | + gst_gl_memory_egl_init_once (); | ||
464 | #endif | ||
465 | } | ||
466 | |||
467 | diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c | ||
468 | index 16ed5ea..73a9029 100644 | ||
469 | --- a/gst-libs/gst/gl/gstglupload.c | ||
470 | +++ b/gst-libs/gst/gl/gstglupload.c | ||
471 | @@ -29,6 +29,7 @@ | ||
472 | |||
473 | #if GST_GL_HAVE_PLATFORM_EGL | ||
474 | #include "egl/gsteglimagememory.h" | ||
475 | +#include "egl/gstglmemoryegl.h" | ||
476 | #endif | ||
477 | |||
478 | #if GST_GL_HAVE_DMABUF | ||
479 | @@ -301,6 +302,13 @@ _gl_memory_upload_propose_allocation (gpointer impl, GstQuery * decide_query, | ||
480 | context)); | ||
481 | gst_query_add_allocation_param (query, allocator, ¶ms); | ||
482 | gst_object_unref (allocator); | ||
483 | + | ||
484 | +#if GST_GL_HAVE_PLATFORM_EGL | ||
485 | + allocator = | ||
486 | + GST_ALLOCATOR (gst_allocator_find (GST_GL_MEMORY_EGL_ALLOCATOR_NAME)); | ||
487 | + gst_query_add_allocation_param (query, allocator, ¶ms); | ||
488 | + gst_object_unref (allocator); | ||
489 | +#endif | ||
490 | } | ||
491 | |||
492 | n_pools = gst_query_get_n_allocation_pools (query); | ||
493 | -- | ||
494 | 2.5.0 | ||
495 | |||
diff --git a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.2.bb b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.2.bb index d0912b2a8c..fb974a5eda 100644 --- a/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.2.bb +++ b/meta/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad_1.8.2.bb | |||
@@ -18,6 +18,7 @@ SRC_URI = " \ | |||
18 | file://0005-glshader-add-glBindFragDataLocation.patch \ | 18 | file://0005-glshader-add-glBindFragDataLocation.patch \ |
19 | file://0006-glcolorconvert-GLES3-deprecates-texture2D-and-it-doe.patch \ | 19 | file://0006-glcolorconvert-GLES3-deprecates-texture2D-and-it-doe.patch \ |
20 | file://0007-glplugin-gleffects-fix-little-rectangel-appears-at-t.patch \ | 20 | file://0007-glplugin-gleffects-fix-little-rectangel-appears-at-t.patch \ |
21 | file://0008-gl-implement-GstGLMemoryEGL.patch \ | ||
21 | " | 22 | " |
22 | SRC_URI[md5sum] = "83abc2e70684e7b195f18ca2992ef6e8" | 23 | SRC_URI[md5sum] = "83abc2e70684e7b195f18ca2992ef6e8" |
23 | SRC_URI[sha256sum] = "d7995317530c8773ec088f94d9320909d41da61996b801ebacce9a56af493f97" | 24 | SRC_URI[sha256sum] = "d7995317530c8773ec088f94d9320909d41da61996b801ebacce9a56af493f97" |