platform/upstream/gstreamer.git
6 years agoglmemory: add gst_gl_memory_allocator_get_default
Alessandro Decina [Fri, 18 Dec 2015 02:17:34 +0000 (13:17 +1100)]
glmemory: add gst_gl_memory_allocator_get_default

Add gst_gl_memory_allocator_get_default to get the default allocator based on
the opengl version. Allows us to stop hardcoding the PBO allocator which isn't
supported on gles2.

Fixes GL upload on iOS9 among other things.

6 years agoglimagesink: don't deadlock on resize
Matthew Waters [Fri, 18 Dec 2015 00:49:25 +0000 (11:49 +1100)]
glimagesink: don't deadlock on resize

Performing any GL function marshalling off the GL thread with glimagesink's
render lock is prone to deadlocks between the GL thread and the non-GL thread.

What can happen is this:
1. non-GL thread attempts to function marshal to the GL thread.
2. while 1 is happening, the winsys gives an event (say resize)
3. This calls back into glimagesink which taks the render lock.
4. As the GL function marshalling is attempting to run on the GL
   and already has glimagesink's render lock locked.  This deadlocks
   as the threads are waiting for each other.

6 years agoglbasememory: don't unconditionally add the alignment bytes to the size
Matthew Waters [Tue, 15 Dec 2015 03:14:36 +0000 (14:14 +1100)]
glbasememory: don't unconditionally add the alignment bytes to the size

e.g when wrapping a data pointer we don't want to map/unmap off the end of
pointer with the alignment bytes.

Instead track that information separately as maxsize is used for mapping by
GstMemory and thus represents a size without any alignment padding bytes.

6 years agoglbuffer: add a name to the allocator
Matthew Waters [Thu, 17 Dec 2015 04:50:40 +0000 (15:50 +1100)]
glbuffer: add a name to the allocator

6 years agogl*memory*: reverse the parameter order of user_data and destroy notify
Matthew Waters [Thu, 17 Dec 2015 04:23:13 +0000 (15:23 +1100)]
gl*memory*: reverse the parameter order of user_data and destroy notify

The convention is to have the destroy notify last after any user data

6 years agoglmemorypbo: remove our own alloc()/wrapped()/etc functions
Matthew Waters [Wed, 16 Dec 2015 07:41:06 +0000 (18:41 +1100)]
glmemorypbo: remove our own alloc()/wrapped()/etc functions

replaced by equivalent functionality within gst_gl_base_memory_alloc()

6 years agoglmemory: document gst_gl_memory_init
Matthew Waters [Wed, 16 Dec 2015 07:39:32 +0000 (18:39 +1100)]
glmemory: document gst_gl_memory_init

6 years agoglbuffer: remove unneeded gst_gl_buffer_alloc()
Matthew Waters [Wed, 16 Dec 2015 07:38:19 +0000 (18:38 +1100)]
glbuffer: remove unneeded gst_gl_buffer_alloc()

Replaced by gst_gl_base_memory_alloc()

6 years agoglbasememory: document some functions
Matthew Waters [Wed, 16 Dec 2015 07:37:11 +0000 (18:37 +1100)]
glbasememory: document some functions

6 years agoglmemory: add a default copy implementation
Matthew Waters [Wed, 16 Dec 2015 07:36:13 +0000 (18:36 +1100)]
glmemory: add a default copy implementation

Subclasses still need to override this to copy into the correct memory type.

6 years agoglbufferpool: use gst_gl_base_memory_alloc as a generic GL allocation framework
Matthew Waters [Wed, 16 Dec 2015 07:32:40 +0000 (18:32 +1100)]
glbufferpool: use gst_gl_base_memory_alloc as a generic GL allocation framework

Requires the usage of GstGLVideoAllocationParams however any user can set their
own parameters along with an allocator which will be used to allocate the
correct memory type.

6 years agoglmemorypbo: implement GstGLBaseMemory:alloc
Matthew Waters [Wed, 16 Dec 2015 07:30:59 +0000 (18:30 +1100)]
glmemorypbo: implement GstGLBaseMemory:alloc

Uses the GstGLVideoAllocationParams parameters

6 years agoglbuffer: implements GstGLBaseMemory::alloc
Matthew Waters [Wed, 16 Dec 2015 07:23:31 +0000 (18:23 +1100)]
glbuffer: implements GstGLBaseMemory::alloc

Create GstGLBufferAllocationParams which is subclass of GstGLAllocationParams

6 years agoglmemory: implement GstGLBaseMemory::alloc
Matthew Waters [Wed, 16 Dec 2015 07:20:17 +0000 (18:20 +1100)]
glmemory: implement GstGLBaseMemory::alloc

- Create GstGLVideoAllocationParams which is a GstGLAllocationParams subclass.
- Make it possible to allocate glmemory objects directly if no frills are
  needed.

6 years agoglbasememory: add a generic interface for allocating GL memories
Matthew Waters [Wed, 16 Dec 2015 07:13:21 +0000 (18:13 +1100)]
glbasememory: add a generic interface for allocating GL memories

This is made possible by a subclassable GstGLAllocationParams that holds
the allocation parameters

Every allocation would now go through gst_gl_base_memory_alloc with the
allocation parameters now being specified in a single struct to allow
extension by different allocators.

6 years agoRevert "glbuffer: Don't pass allocation params"
Matthew Waters [Thu, 17 Dec 2015 00:06:34 +0000 (11:06 +1100)]
Revert "glbuffer: Don't pass allocation params"

This reverts commit 052f41e5c293ec17c038467ed1e7b92b04d494b0.

This is incorrect and will affect any other glbuffer user that needs/wants to
perform data alignment.

6 years agoglbuffer: Don't pass allocation params
Nicolas Dufresne [Wed, 16 Dec 2015 16:56:08 +0000 (11:56 -0500)]
glbuffer: Don't pass allocation params

The imported memory has already been allocated, passing allocation
parameters with alignment confuses the memory which endup with a
size different from maxsize and lead to overrun when the memory
is being copied.

6 years agoglupload: fix allocator name after GLMemory API changes
Alessandro Decina [Tue, 15 Dec 2015 03:17:16 +0000 (14:17 +1100)]
glupload: fix allocator name after GLMemory API changes

6 years agogl: Allow using non-system mesa with both GL and GLES
Nicolas Dufresne [Wed, 16 Dec 2015 00:25:16 +0000 (19:25 -0500)]
gl: Allow using non-system mesa with both GL and GLES

GCC automatically disable redundance warnings for system headers. As
soon as we start using a non-system installed mesa, we would start
having issues. The test for both wasn't setting any flags, so it would
work but then fail at runtime.

This is being fixed by disabling in the code (where needed only) that
GCC warning. The test is also fixed to avoid the false positive we had.

6 years agoplugins-bad: Fix example pipelines
Vineeth TM [Mon, 14 Dec 2015 02:09:46 +0000 (11:09 +0900)]
plugins-bad: Fix example pipelines

rename gst-launch --> gst-launch-1.0
replace old elements with new elements(ffmpegcolorspace -> videoconvert, ffenc_** -> avenc_**)
fix caps in examples

https://bugzilla.gnome.org/show_bug.cgi?id=759432

6 years agobad: Add g_autoptr() support to all types
Xavier Claessens [Mon, 14 Dec 2015 19:44:31 +0000 (14:44 -0500)]
bad: Add g_autoptr() support to all types

https://bugzilla.gnome.org/show_bug.cgi?id=754464

6 years agoglviewconvert: check pointer before dereferencing
Luis de Bethencourt [Mon, 14 Dec 2015 12:31:52 +0000 (12:31 +0000)]
glviewconvert: check pointer before dereferencing

priv->primary_out could be NULL, check before dereferencing it in
GST_BUFFER_FLAG_SET ()

CID 1308945

6 years agoclutter: Fix compilation error in GL examples
Sebastian Dröge [Mon, 14 Dec 2015 08:38:41 +0000 (09:38 +0100)]
clutter: Fix compilation error in GL examples

Include gst/gl.h instead of specific headers to prevent such problems also in
the future.

In file included from ../../../../gst-libs/gst/gl/gl.h:47:0,
                 from ../../../../gst-libs/gst/gl/gstglbasememory.h:137,
                 from ../../../../gst-libs/gst/gl/gstglmemory.h:29,
                 from cluttershare.c:39:
../../../../gst-libs/gst/gl/gstglmemorypbo.h:51:20: error: field ‘mem’ has incomplete type
   GstGLMemory      mem;
                    ^
../../../../gst-libs/gst/gl/gstglmemorypbo.h:124:24: error: field ‘parent’ has incomplete type
   GstGLMemoryAllocator parent;
                        ^
../../../../gst-libs/gst/gl/gstglmemorypbo.h:134:29: error: field ‘parent_class’ has incomplete type
   GstGLMemoryAllocatorClass parent_class;
                             ^

6 years agotests: update for glmemory api changes
Matthew Waters [Mon, 14 Dec 2015 07:41:30 +0000 (18:41 +1100)]
tests: update for glmemory api changes

6 years agoglbuffer: bind/unbind on map/unmap for GL mappings
Matthew Waters [Mon, 14 Dec 2015 07:20:23 +0000 (18:20 +1100)]
glbuffer: bind/unbind on map/unmap for GL mappings

Bind the handle to the GL target on map/unmap to save the caller from
handling this themselves.

6 years agoglbuffer: remove buffer specific transfer flags
Matthew Waters [Mon, 14 Dec 2015 07:19:37 +0000 (18:19 +1100)]
glbuffer: remove buffer specific transfer flags

Instead rely on GstGLBaseMemory's transfer handling

6 years agoglmemorypbo: map/unmap pbo memory correctly for state tracking
Matthew Waters [Mon, 14 Dec 2015 07:18:20 +0000 (18:18 +1100)]
glmemorypbo: map/unmap pbo memory correctly for state tracking

Otherwise some downloads will fail to occur from the PBO.

6 years agotests/glmemory: include the generic gl header
Matthew Waters [Mon, 14 Dec 2015 07:15:42 +0000 (18:15 +1100)]
tests/glmemory: include the generic gl header

Including gstglmemory.h directly results in the compiler complaining
about incomplete types.

6 years agoglformat: add compatibility definitions for OES/rectangle textures
Matthew Waters [Mon, 14 Dec 2015 06:05:31 +0000 (17:05 +1100)]
glformat: add compatibility definitions for OES/rectangle textures

6 years agoglbasebuffer: remove unsed memory subclass
Matthew Waters [Mon, 14 Dec 2015 02:49:18 +0000 (13:49 +1100)]
glbasebuffer: remove unsed memory subclass

The functionality has been split into GstGLBaseMemory and GstGLBuffer.

6 years agoglmemory: base classify and add the pbo memory on top
Matthew Waters [Mon, 14 Dec 2015 02:43:59 +0000 (13:43 +1100)]
glmemory: base classify and add the pbo memory on top

The base class is useful for having multiple backing memory types other
than the default.  e.g. IOSurface, EGLImage, dmabuf?

The PBO transfer logic is now inside GstGLMemoryPBO which uses GstGLBuffer
to manage the PBO memory.

This also moves the format utility functions into their own file.

6 years agogl: add a GL buffer based GstMemory
Matthew Waters [Mon, 14 Dec 2015 02:08:10 +0000 (13:08 +1100)]
gl: add a GL buffer based GstMemory

Heavily based on GstGLBaseBuffer that is a subclass of GstGLBaseMemory.
Provides GPU and CPU accessible GL buffer objects by GL handle or by
sysmem data pointer.

6 years agogl: add a base memory object
Matthew Waters [Mon, 14 Dec 2015 01:59:02 +0000 (12:59 +1100)]
gl: add a base memory object

It handles the following
- GstAllocationParams -> gst_memory_init transformation
- Makes sure that map/unmap/create/destroy happen on the GL thread with
  a GL context current.
- Holds a possible sysmem accessible data pointer with alignment.
- Holds the need upload/download transfer state

6 years agogl: add convenience function for the start of a video frame
Matthew Waters [Mon, 14 Dec 2015 01:26:01 +0000 (12:26 +1100)]
gl: add convenience function for the start of a video frame

Get's the start of the video frame based on a GstVideoInfo and
GstVideoAlignment.

6 years agogluploadmeta; remove convenience helper API
Matthew Waters [Fri, 11 Dec 2015 05:07:36 +0000 (16:07 +1100)]
gluploadmeta; remove convenience helper API

It was not really useful as if one knows about libgstgl, one can just use
GLMemory objects directly.

6 years agogldownload: remove helper api from the library
Matthew Waters [Fri, 11 Dec 2015 04:39:57 +0000 (15:39 +1100)]
gldownload: remove helper api from the library

It was never used by anyone and is not needed anymore with the element
and GstGLMemory's transparent support for downloading textures.

6 years agogltransformation: clear to transparent
Matthew Waters [Fri, 11 Dec 2015 22:33:38 +0000 (09:33 +1100)]
gltransformation: clear to transparent

Otherwise composition will result in a black frame outside the transformed
video.

6 years agolibgstgl: gstglcontext_cocoa: kCGLPFAStereo has been deprecated in 10.11
Alessandro Decina [Thu, 10 Dec 2015 03:41:44 +0000 (14:41 +1100)]
libgstgl: gstglcontext_cocoa: kCGLPFAStereo has been deprecated in 10.11

Also since the version scheme has changed (to include the micro number) since
10.10, use the MAC_OS_X_VERSION_* macro to avoid confusion.

6 years agoglbufferpool: relax check for multiple texture targets
Alessandro Decina [Thu, 10 Dec 2015 01:41:00 +0000 (12:41 +1100)]
glbufferpool: relax check for multiple texture targets

Only complain about multiple texture targets when _different_ texture targets
are configured.

6 years agoglmemory: take subsampling into account for rectangle textures
Alessandro Decina [Thu, 10 Dec 2015 01:33:52 +0000 (12:33 +1100)]
glmemory: take subsampling into account for rectangle textures

Rectangle textures don't use normalized coordinates so subsampling needs to be
factored in explicitly.

Fixes YUV => RGB conversion for rectangle textures.

6 years agoglproto: include function definitions for GL_APPLE_sync
Matthew Waters [Tue, 8 Dec 2015 05:35:45 +0000 (16:35 +1100)]
glproto: include function definitions for GL_APPLE_sync

Provides a performance improvement on iOS where we were falling back to glFinish
on settting sync points.

6 years agoglupload: Only offer custom allocator with caps features
Nicolas Dufresne [Tue, 1 Dec 2015 23:09:25 +0000 (18:09 -0500)]
glupload: Only offer custom allocator with caps features

To use GLMemory and EGLImage allocators, one need to know the
libgstgl API. This is only expected if the associated caps features
have been negotiated. Generic element that otherwise receive those
allocators may fail, resulting in broken pieline. We don't want to
force all generic element to check if the allocator is a custom
allocator or a normal allocator (which implement the _alloc method).

https://bugzilla.gnome.org/show_bug.cgi?id=758877

6 years agoglcolorconvert: improve the YUY2/UYVY->RGBA conversion shader
Matthew Waters [Wed, 2 Dec 2015 11:42:39 +0000 (22:42 +1100)]
glcolorconvert: improve the YUY2/UYVY->RGBA conversion shader

Don't offset the y-axis.  We only need to offset on the x-axis.

Removes a sawtooth pattern on horizontal and vertical edges.

https://bugzilla.gnome.org/show_bug.cgi?id=755486

6 years agoglcolorconvert: improve RGBA->YUY2/UYVY conversion shader
Matthew Waters [Wed, 2 Dec 2015 11:40:06 +0000 (22:40 +1100)]
glcolorconvert: improve RGBA->YUY2/UYVY conversion shader

We should only average the chroma samples not the luma sample.

https://bugzilla.gnome.org/show_bug.cgi?id=758904

6 years agoDrop usage of deprecated g-ir-scanner --strip-prefix flag
Reynaldo H. Verdejo Pinochet [Wed, 2 Dec 2015 07:20:45 +0000 (23:20 -0800)]
Drop usage of deprecated g-ir-scanner --strip-prefix flag

6 years agoRemove unnecessary NULL checks before g_free()
Reynaldo H. Verdejo Pinochet [Tue, 17 Nov 2015 23:23:17 +0000 (15:23 -0800)]
Remove unnecessary NULL checks before g_free()

g_free() is NULL-safe

6 years agoglimagesink: Remove unused variable
Sebastian Dröge [Tue, 17 Nov 2015 15:17:50 +0000 (17:17 +0200)]
glimagesink: Remove unused variable

gstglimagesink.c: In function 'gst_glimage_sink_on_draw':
gstglimagesink.c:1959:18: error: unused variable 'sync_meta' [-Werror=unused-variable]
   GstGLSyncMeta *sync_meta = NULL;
                  ^

6 years agoglviewconvert: String literals are const
Sebastian Dröge [Tue, 17 Nov 2015 15:09:51 +0000 (17:09 +0200)]
glviewconvert: String literals are const

gstglviewconvert.c: In function '_mangle_extensions':
gstglviewconvert.c:1511:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
     ext_str = "#extension GL_OES_EGL_image_external : require\n";
             ^

6 years agoglsyncmeta: Actually return the newly created meta from gst_buffer_add_gl_sync_meta()
Sebastian Dröge [Tue, 17 Nov 2015 15:08:14 +0000 (17:08 +0200)]
glsyncmeta: Actually return the newly created meta from gst_buffer_add_gl_sync_meta()

gstglsyncmeta.c  -fPIC -DPIC -o .libs/libgstgl_1.0_la-gstglsyncmeta.o
gstglsyncmeta.c: In function 'gst_buffer_add_gl_sync_meta':
gstglsyncmeta.c:131:1: error: control reaches end of non-void function [-Werror=return-type]
 }
 ^

6 years agoglimagesink: wait on the correct sync meta when rendering
Matthew Waters [Mon, 16 Nov 2015 04:46:41 +0000 (15:46 +1100)]
glimagesink: wait on the correct sync meta when rendering

6 years agoglsyncmeta: add vfuncs for all operations
Matthew Waters [Mon, 2 Nov 2015 06:57:29 +0000 (17:57 +1100)]
glsyncmeta: add vfuncs for all operations

there could be other ways/requirements for synchronising two GPU command
streams (whether GL or platform specific).

e.g. glfencesync/eglwaitnative/cond/etc

6 years agoglimagesink: add support for rendering external-oes textures
Matthew Waters [Tue, 10 Nov 2015 04:37:05 +0000 (15:37 +1100)]
glimagesink: add support for rendering external-oes textures

https://bugzilla.gnome.org/show_bug.cgi?id=757285

6 years agoglviewconvert: add support rectangle/external-oes textures
Matthew Waters [Tue, 10 Nov 2015 03:54:02 +0000 (14:54 +1100)]
glviewconvert: add support rectangle/external-oes textures

https://bugzilla.gnome.org/show_bug.cgi?id=757285

6 years agoglimagesink: Fix structure memory leak
Vineeth TM [Tue, 17 Nov 2015 00:08:52 +0000 (09:08 +0900)]
glimagesink: Fix structure memory leak

https://bugzilla.gnome.org/show_bug.cgi?id=758205

6 years agoglsl: fix possible string overrun in gst_glsl_version_profile_from_string
Vineeth TM [Fri, 13 Nov 2015 01:41:58 +0000 (10:41 +0900)]
glsl: fix possible string overrun in gst_glsl_version_profile_from_string

given a NULL-terminated string, s.
s[i] = '\0';
i++;
does not guarentee that s[i] is NULL terminated and thus string operations
could read off the end of the array.

https://bugzilla.gnome.org/show_bug.cgi?id=758039

6 years agoglshader: don't read invalid list pointers (use after free)
Matthew Waters [Fri, 13 Nov 2015 05:50:22 +0000 (16:50 +1100)]
glshader: don't read invalid list pointers (use after free)

gst_gl_shader_detach_unlocked already removes the list entry so attempting to
use the element to iterate to the next stage could read invalid data.

Based on patch by Vineeth TM <vineeth.tm@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=758039

6 years agotests:glsl: version_profile_s string leak
Vineeth TM [Fri, 13 Nov 2015 01:44:26 +0000 (10:44 +0900)]
tests:glsl: version_profile_s string leak

https://bugzilla.gnome.org/show_bug.cgi?id=758039

6 years agoglsl: free str while returning error
Vineeth TM [Fri, 13 Nov 2015 01:56:10 +0000 (10:56 +0900)]
glsl: free str while returning error

https://bugzilla.gnome.org/show_bug.cgi?id=758039

6 years agotests:glupload: fix caps memory leak
Vineeth TM [Fri, 13 Nov 2015 02:04:34 +0000 (11:04 +0900)]
tests:glupload: fix caps memory leak

https://bugzilla.gnome.org/show_bug.cgi?id=758039

6 years agoglslstage: Fix vertex_sources memory leak
Vineeth TM [Thu, 12 Nov 2015 07:36:03 +0000 (16:36 +0900)]
glslstage: Fix vertex_sources memory leak

vertex_sources is being allocated but not freed resulting in leak

https://bugzilla.gnome.org/show_bug.cgi?id=757974

6 years agoglcolorconvert: remove unnecessary free
Vineeth TM [Thu, 12 Nov 2015 07:26:00 +0000 (16:26 +0900)]
glcolorconvert: remove unnecessary free

version_str is already being freed. So no need to call again

https://bugzilla.gnome.org/show_bug.cgi?id=757974

6 years agoglcolorconvert: Fix string leak
Vineeth TM [Thu, 12 Nov 2015 07:18:35 +0000 (16:18 +0900)]
glcolorconvert: Fix string leak

String got using gst_glsl_version_profile_to_string, is allocated
memory and should be freed

https://bugzilla.gnome.org/show_bug.cgi?id=757974

6 years agoglcolorconvert: Fix frag_prog and frag_body memory leak
Vineeth TM [Thu, 12 Nov 2015 07:02:45 +0000 (16:02 +0900)]
glcolorconvert: Fix frag_prog and frag_body memory leak

https://bugzilla.gnome.org/show_bug.cgi?id=757974

6 years agoglcolorconvert: mangle gl_FragColor for GL3
Matthew Waters [Wed, 11 Nov 2015 12:39:35 +0000 (23:39 +1100)]
glcolorconvert: mangle gl_FragColor for GL3

Some drivers don't provide the compatibility definition and we need to provide
our own 'out vec4' variable to put the results of the fragment shader into.

https://bugzilla.gnome.org/show_bug.cgi?id=757938

6 years agotests:glcolorconvert: Fix caps memory leak
Vineeth TM [Wed, 11 Nov 2015 07:06:25 +0000 (16:06 +0900)]
tests:glcolorconvert: Fix caps memory leak

Output caps being got from video info is not getting freed

https://bugzilla.gnome.org/show_bug.cgi?id=757929

6 years agoglviewconvert: remove set_format
Matthew Waters [Tue, 10 Nov 2015 02:52:30 +0000 (13:52 +1100)]
glviewconvert: remove set_format

We need the caps to be able to
1. check the caps features
2. get the requested texture-target on input/output

6 years agoglimagesink: fix a memory leak if the view conversion fails
Matthew Waters [Tue, 10 Nov 2015 23:31:07 +0000 (10:31 +1100)]
glimagesink: fix a memory leak if the view conversion fails

6 years agoglimagesink: balance the creation/destruction of the overlay compositor
Matthew Waters [Wed, 11 Nov 2015 02:37:59 +0000 (13:37 +1100)]
glimagesink: balance the creation/destruction of the overlay compositor

Fixes some leaks/possible segfault on when failing to create the compositor.

6 years agoglshader: properly unref the stages on failure
Matthew Waters [Wed, 11 Nov 2015 01:23:30 +0000 (12:23 +1100)]
glshader: properly unref the stages on failure

When failing in the varargs functions, all the stage objects not handled need to
be unreffed to prevent a leak.

6 years agoglslstage: properly return an error when we could not create the shader stage
Matthew Waters [Wed, 11 Nov 2015 00:29:35 +0000 (11:29 +1100)]
glslstage: properly return an error when we could not create the shader stage

While it was erroring out correctly later, there were GLib warnings about
setting a GError over the top of another GError.

6 years agoglshaderstrings: fixup the external-oes fragment shader
Matthew Waters [Tue, 10 Nov 2015 14:05:20 +0000 (01:05 +1100)]
glshaderstrings: fixup the external-oes fragment shader

The wrong sampler type was used
s/sampler2DExternalOES/samplerExternalOES/

6 years agoglcolorconvert: try to keep the same texture-target if possible
Matthew Waters [Tue, 10 Nov 2015 12:41:24 +0000 (23:41 +1100)]
glcolorconvert: try to keep the same texture-target if possible

Fixes issues attempting to passthrough external-oes textures

6 years agoglcolorconvert: fix rendering rectangular textures with GL3
Matthew Waters [Tue, 10 Nov 2015 11:41:57 +0000 (22:41 +1100)]
glcolorconvert: fix rendering rectangular textures with GL3

Rectangular textures are unavailable in unextended
GLES2 #version 100 shaders.

Fixes
texture-target=rectangle ! glcolorconvert ! texture-target=2D

There's a couple of differences between GL3 and GLES2/GL

- varying -> in or out depending on the stage (vertex/fragment)
- attribute -> in
- filtered texture access is a single function, texture()

6 years agoglcolorconvert: properly use the other texture-target on fixation
Matthew Waters [Tue, 10 Nov 2015 09:20:29 +0000 (20:20 +1100)]
glcolorconvert: properly use the other texture-target on fixation

6 years agoglslstage: add debug as to why _set_strings() failed
Matthew Waters [Tue, 10 Nov 2015 09:15:56 +0000 (20:15 +1100)]
glslstage: add debug as to why _set_strings() failed

6 years agoglsl: fix check for glsl version against GL context inversion
Matthew Waters [Tue, 10 Nov 2015 09:13:53 +0000 (20:13 +1100)]
glsl: fix check for glsl version against GL context inversion

Any GLSL version that was less than the provided GL version would fail

6 years agogl: forward declare some enums
Matthew Waters [Tue, 10 Nov 2015 02:13:50 +0000 (13:13 +1100)]
gl: forward declare some enums

Specifically the GstGLTextureTarget enum

6 years agoglslstage: expose the default shader strings as public
Matthew Waters [Tue, 10 Nov 2015 02:11:37 +0000 (13:11 +1100)]
glslstage: expose the default shader strings as public

Add some other simple strings for external-oes textures or transforming
the texture coordinates with a transformation matrix

6 years agoglcolorconvert: wait on the sync meta for input buffers
Matthew Waters [Thu, 5 Nov 2015 16:05:31 +0000 (03:05 +1100)]
glcolorconvert: wait on the sync meta for input buffers

6 years agoglimagesink: wait on the provided sync meta provided to glimagesink
Matthew Waters [Wed, 4 Nov 2015 13:13:01 +0000 (00:13 +1100)]
glimagesink: wait on the provided sync meta provided to glimagesink

6 years agoglcolorconvert: use the correct oes target string in the template caps
Matthew Waters [Sun, 8 Nov 2015 11:14:01 +0000 (22:14 +1100)]
glcolorconvert: use the correct oes target string in the template caps

6 years agoglshader, tsdemux: simplify code
Tim-Philipp Müller [Fri, 6 Nov 2015 12:31:09 +0000 (12:31 +0000)]
glshader, tsdemux: simplify code

Jus use _delete_link() instead of _remove_link() + _free1()

6 years agoglmixerbin: fix minor leak
Tim-Philipp Müller [Fri, 6 Nov 2015 12:30:12 +0000 (12:30 +0000)]
glmixerbin: fix minor leak

Don't leak removed list node.

6 years agogstglutils: fix shader compilation on Mountain Lion
Alessandro Decina [Mon, 2 Nov 2015 01:10:44 +0000 (12:10 +1100)]
gstglutils: fix shader compilation on Mountain Lion

Make gst_gl_context_gen_shader/_compile_shader assume GST_GLSL_PROFILE_ES |
GST_GLSL_PROFILE_COMPATIBILITY as the profile. Without this, the shader compiler
doesn't inject the #version tag resulting in a compilation error on Mountain
Lion.

This is a workaround for old code using gst_gl_context_gen_shader. New code
should use the gst_glsl_stage_* API directly which allows the caller to
explicitly specify version/profile.

6 years agoglbufferpool: explicitly initialize a possibly uninitialized variable
Matthew Waters [Sat, 31 Oct 2015 12:28:20 +0000 (23:28 +1100)]
glbufferpool: explicitly initialize a possibly uninitialized variable

The ret variable may be uninitialized and so its contents were undefined and
the results were erratic (failing with glvideomixer, succeeding in other cases)

P.S. No idea why gcc/clang et al never picked up on this like they normally do
(probably due to some optimisation pass figuring out it's only set once...)

6 years agogl/tests: update for glmemory api changes
Matthew Waters [Fri, 30 Oct 2015 04:00:23 +0000 (15:00 +1100)]
gl/tests: update for glmemory api changes

6 years agoglcolorconvert: remove unused ret variable
Matthew Waters [Fri, 30 Oct 2015 03:43:23 +0000 (14:43 +1100)]
glcolorconvert: remove unused ret variable

6 years agoglslstage: remove typedefs from the header
Matthew Waters [Fri, 30 Oct 2015 03:40:35 +0000 (14:40 +1100)]
glslstage: remove typedefs from the header

They are already defined in the forward decleration header and defining them
more than once will give an error with OSX's clang about typedef redefinition
being a C11 feature.

6 years agoglcolorconvert: follow the correct texture target names
Matthew Waters [Fri, 30 Oct 2015 03:38:05 +0000 (14:38 +1100)]
glcolorconvert: follow the correct texture target names

6 years agoglupload: explicitly configure the texture target on the gl buffer pool
Matthew Waters [Thu, 29 Oct 2015 14:42:42 +0000 (01:42 +1100)]
glupload: explicitly configure the texture target on the gl buffer pool

If we don't, then the pool could end up allocating 2D textures when the
caps explictly state they should be rectangle textures.

6 years agoglbufferpool: add bufferpool options for the various texture targets
Matthew Waters [Thu, 29 Oct 2015 14:27:36 +0000 (01:27 +1100)]
glbufferpool: add bufferpool options for the various texture targets

This was chosen over relying solely on the caps as glupload needs to propose an
allocation and set the texture target based on the output caps.  Setting the
caps in the config is currently pointless as they are overwritten in a lot of
element's decide_allocation functions.

This provides a mechanism for the buffer pool to be configured for a certain
texture target when none has been configured.

6 years agoglcolorconvert: add support for converting texture targets
Matthew Waters [Thu, 29 Oct 2015 02:04:31 +0000 (13:04 +1100)]
glcolorconvert: add support for converting texture targets

Solved with a simple shader templating mechanism and string replacements
of the necessary sampler types/texture accesses and texture coordinate
mangling for rectangular and external-oes textures.

6 years agoglmemory: add support for rectangle textures
Matthew Waters [Wed, 28 Oct 2015 13:44:26 +0000 (00:44 +1100)]
glmemory: add support for rectangle textures

Add the various tokens/strings for the differnet texture types (2D, rect, oes)

Changes the GLmemory api to include the GstGLTextureTarget in all relevant
functions.

Update the relevant caps/templates for 2D only textures.

6 years agoglcolorconvert: order the caps template so that RGBA is first
Matthew Waters [Thu, 29 Oct 2015 14:45:13 +0000 (01:45 +1100)]
glcolorconvert: order the caps template so that RGBA is first

glcolorconvert ! glcolorconvert would sometimes negotiated RGB
(the first list entry) otherwise.

6 years agoglbufferpool: move typedef's into the forward decleration file
Matthew Waters [Thu, 29 Oct 2015 14:16:02 +0000 (01:16 +1100)]
glbufferpool: move typedef's into the forward decleration file

Otherwise, for example, clang will warn about typedef redefinitions
being a C11 feature.

6 years agoglslstage: initialize output params to 0 before calling gl functions
Julien Isorce [Wed, 28 Oct 2015 14:41:54 +0000 (14:41 +0000)]
glslstage: initialize output params to 0 before calling gl functions

The client side API of the Chromium's GPU Process has asserts
in debug mode that check that output params are initialized to 0.

6 years agoopengl: build/provide glstereomix/split on gles only systems
Matthew Waters [Mon, 26 Oct 2015 13:36:41 +0000 (00:36 +1100)]
opengl: build/provide glstereomix/split on gles only systems

6 years agoglcolorconvert: allow outputting multiple textures for gles3 contexts
Matthew Waters [Mon, 26 Oct 2015 07:26:18 +0000 (18:26 +1100)]
glcolorconvert: allow outputting multiple textures for gles3 contexts

the USING_GLES2 includes all GLES3 contexts as well which does support
drawing to multiple buffers.  Instead make or decision solely based on
whether glDrawBuffers is available or not.

6 years agoglviewconvert: expose the element on gles2 platforms
Matthew Waters [Mon, 26 Oct 2015 06:36:21 +0000 (17:36 +1100)]
glviewconvert: expose the element on gles2 platforms

We can do everything with gles3 however gles2 restricts us not allowing
separated or frame-by-frame multiview modes due to multiple draw buffers.

6 years agoglshaderelement: free the vertex and fragment strings on finalize
Matthew Waters [Tue, 20 Oct 2015 18:34:18 +0000 (05:34 +1100)]
glshaderelement: free the vertex and fragment strings on finalize

Fixes a memory leak when using the vertex/fragment properties.