Commit graph

1418 commits

Author SHA1 Message Date
Matthew Waters
49291bc927 glmemorypbo: only create a pbo memory if the context actually supports it
e.g. GL <= 2.0 does not support pbo usage and GL 2.1 only supports pbo upload.
2015-12-30 12:16:29 +11:00
Matthew Waters
6917b3b35a glmemory: small code reformat
makes the alloc_params selections fit on a single line.
2015-12-30 12:16:29 +11:00
Sebastian Dröge
aaa660ac9d glbasememory: Remove bogus NULL check
CID 1346534
2015-12-29 18:01:30 +02:00
Sebastian Dröge
22a0914cce gl: Add \0 terminators for the Apple sync extension
Otherwise GL initialization might check for extensions forever and never finishes.
2015-12-28 15:53:59 +02:00
Sebastian Dröge
3d0257e1b6 glcontext: Add some debug output when the GL thread is actually running 2015-12-28 14:41:59 +02:00
Vineeth TM
572b9788f5 glbufferpool: Fix build error
When GST_GL_HAVE_PLATFORM_EGL is not defined, then info variable
will not be used and this results in build error

https://bugzilla.gnome.org/show_bug.cgi?id=759913
2015-12-27 21:54:50 -05:00
Sebastian Dröge
c4e5423f3b glmemorypbo: Comment out unused functions to fix compilation with clang
It's not clear if these are intentionally unused or the code should be
changed, but this fixes compilation for the time being at least.

See https://bugzilla.gnome.org/show_bug.cgi?id=759679
2015-12-23 09:51:05 +01:00
Sebastian Dröge
626bcccff9 glcontext: Signal context creation from inside the context loop and use g_thread_join() instead of a custom condition variable
Also protect against spurious condition variable wakeups during context
creation.
2015-12-21 12:16:35 +01:00
Sebastian Dröge
d81eea5de1 glwindow: Hide navigation specific internal API and add API to asynchronously send navigation events
Exposing the navigation thread's main context, GSourceFuncs and structs called
key_event and mouse_event is exposing a bit too much of the internals. Let's
just go with two functions to asynchronously send navigation events on the
window with the same API as the synchronous ones.
2015-12-21 11:27:09 +01:00
Sebastian Dröge
0952b3f986 glwindow: Use g_thread_join() instead of a custom condition variable for waiting for the navigation thread to finish
Also hide some internal functions and fields while we're at it and fix
a race condition with the startup condition variable.
2015-12-21 11:09:04 +01:00
Haihua Hu
62d79ae326 glwindow: Fix memory leak of navigation thread
When stopping the navigation thread, call g_thread_join() to release
the resources hold by it.

https://bugzilla.gnome.org/show_bug.cgi?id=758820
2015-12-21 10:42:41 +01:00
Nicolas Dufresne
937e249b44 glconvert: Fix compilation of GRAY16_LE/BE shader 2015-12-18 15:56:34 -05:00
Nicolas Dufresne
420a175b4f glupload: Add dmabuf upload method.
This upload method detect and optimize uploads of DMABuf memory. This is
done by creating and caching EGLImages wrapper around DMABuf. The
EGLImages are then binded to a texture which get converter using
standard shader.

Example pipeline:

GST_GL_PLATFORM=egl \
gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! \
               video/x-raw,format=NV12 ! glimagesink

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Nicolas Dufresne
7b335c4dd5 eglimagememory: Also import BGR16, ABGR, xBGR, AYUV, GRAY16_LE/BE and Y444
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Nicolas Dufresne
b17a732d5f eglimagememory: Add RGB/BGR DMABuf importation support
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Lubosz Sarnecki
1cd9786598 eglimagememory: Methods to create GstGLMemory from dmabufs
Maps GstVideoFormats to suitable DRM fourccs which work with
glcolorconvert, using gst_gl_memory_alloc(). We require mostly
only 4 formats to be supported by the driver. We require DRM
equivalent to RGB16, RGBA, R8 and RG88. This way it's compatible with
DesktopGL, since GL_TEXTURE_2D is used and limit driver requirements.
With this we can virtually support all formats the glcolorconvert
supports.

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Lubosz Sarnecki
41738ca83b build: Add dmabuf build condition.
configure.ac: Build dmabuf when EGL and drm_fourcc.h is available.
gl: Link gst-allocators.

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Lubosz Sarnecki
eb73cf3c2e gstglcontext_egl: Expose gst_gl_context_egl_get_error_string.
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:33 -05:00
Alessandro Decina
6961945110 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.
2015-12-18 14:25:32 +11:00
Matthew Waters
d8dacd50bf 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.
2015-12-18 01:02:25 +11:00
Matthew Waters
4d88848fae glbuffer: add a name to the allocator 2015-12-17 15:50:40 +11:00
Matthew Waters
5dcd500257 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
2015-12-17 15:44:22 +11:00
Matthew Waters
779dc3132c glmemorypbo: remove our own alloc()/wrapped()/etc functions
replaced by equivalent functionality within gst_gl_base_memory_alloc()
2015-12-17 13:49:56 +11:00
Matthew Waters
78fb4326eb glmemory: document gst_gl_memory_init 2015-12-17 13:49:56 +11:00
Matthew Waters
9fa1dd2e29 glbuffer: remove unneeded gst_gl_buffer_alloc()
Replaced by gst_gl_base_memory_alloc()
2015-12-17 13:49:56 +11:00
Matthew Waters
b8b4d8db51 glbasememory: document some functions 2015-12-17 13:49:56 +11:00
Matthew Waters
3aaec5b1d6 glmemory: add a default copy implementation
Subclasses still need to override this to copy into the correct memory type.
2015-12-17 13:49:56 +11:00
Matthew Waters
7c90b0435d 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.
2015-12-17 13:49:56 +11:00
Matthew Waters
d2c5fc3e87 glmemorypbo: implement GstGLBaseMemory:alloc
Uses the GstGLVideoAllocationParams parameters
2015-12-17 13:49:56 +11:00
Matthew Waters
bfb4c446bc glbuffer: implements GstGLBaseMemory::alloc
Create GstGLBufferAllocationParams which is subclass of GstGLAllocationParams
2015-12-17 13:49:56 +11:00
Matthew Waters
650e5c4fe5 glmemory: implement GstGLBaseMemory::alloc
- Create GstGLVideoAllocationParams which is a GstGLAllocationParams subclass.
- Make it possible to allocate glmemory objects directly if no frills are
  needed.
2015-12-17 13:49:55 +11:00
Matthew Waters
bd61e1274c 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.
2015-12-17 13:49:55 +11:00
Matthew Waters
640476fcba Revert "glbuffer: Don't pass allocation params"
This reverts commit 052f41e5c2.

This is incorrect and will affect any other glbuffer user that needs/wants to
perform data alignment.
2015-12-17 11:06:34 +11:00
Nicolas Dufresne
052f41e5c2 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.
2015-12-16 12:07:17 -05:00
Alessandro Decina
c1720963e4 glupload: fix allocator name after GLMemory API changes 2015-12-16 17:03:03 +11:00
Nicolas Dufresne
4c19b415bd 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.
2015-12-15 19:28:22 -05:00
Xavier Claessens
598ddaee72 bad: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 14:45:38 -05:00
Luis de Bethencourt
91eb51dda1 glviewconvert: check pointer before dereferencing
priv->primary_out could be NULL, check before dereferencing it in
GST_BUFFER_FLAG_SET ()

CID 1308945
2015-12-14 12:32:14 +00:00
Matthew Waters
41c3cb30d4 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.
2015-12-14 18:22:58 +11:00
Matthew Waters
5d0d2ec6ca glbuffer: remove buffer specific transfer flags
Instead rely on GstGLBaseMemory's transfer handling
2015-12-14 18:22:27 +11:00
Matthew Waters
b12f2be4b1 glmemorypbo: map/unmap pbo memory correctly for state tracking
Otherwise some downloads will fail to occur from the PBO.
2015-12-14 18:22:07 +11:00
Matthew Waters
359d0a31ee glformat: add compatibility definitions for OES/rectangle textures 2015-12-14 17:05:31 +11:00
Matthew Waters
4c8f264686 glbasebuffer: remove unsed memory subclass
The functionality has been split into GstGLBaseMemory and GstGLBuffer.
2015-12-14 16:35:34 +11:00
Matthew Waters
2b7495bbc1 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.
2015-12-14 16:35:32 +11:00
Matthew Waters
6cf8da132b 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.
2015-12-14 16:34:54 +11:00
Matthew Waters
27e724df8f 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
2015-12-14 13:55:16 +11:00
Matthew Waters
51636b451c 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.
2015-12-14 13:55:16 +11:00
Matthew Waters
3591c6bfa0 gluploadmeta; remove convenience helper API
It was not really useful as if one knows about libgstgl, one can just use
GLMemory objects directly.
2015-12-14 13:55:16 +11:00
Matthew Waters
50337e601e 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.
2015-12-14 13:55:16 +11:00
Alessandro Decina
1d862db9c1 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.
2015-12-10 14:46:27 +11:00
Alessandro Decina
11ca761c5d glbufferpool: relax check for multiple texture targets
Only complain about multiple texture targets when _different_ texture targets
are configured.
2015-12-10 14:46:27 +11:00
Alessandro Decina
5cd0601dd5 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.
2015-12-10 14:46:27 +11:00
Matthew Waters
44c5985edd 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.
2015-12-08 18:08:28 +11:00
Nicolas Dufresne
d84d1708b7 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
2015-12-04 17:08:46 -05:00
Matthew Waters
c8099e6e71 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
2015-12-02 22:52:20 +11:00
Matthew Waters
0b11eba96a 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
2015-12-02 22:52:20 +11:00
Reynaldo H. Verdejo Pinochet
c564a043d1 Drop usage of deprecated g-ir-scanner --strip-prefix flag 2015-12-02 00:20:01 -08:00
Reynaldo H. Verdejo Pinochet
86ec812429 Remove unnecessary NULL checks before g_free()
g_free() is NULL-safe
2015-11-18 16:05:42 -08:00
Sebastian Dröge
74ab40470c 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";
             ^
2015-11-17 17:09:51 +02:00
Sebastian Dröge
e2ea7843f9 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]
 }
 ^
2015-11-17 17:08:14 +02:00
Matthew Waters
67327615df 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
2015-11-17 15:27:26 +11:00
Matthew Waters
79f4efb02a glviewconvert: add support rectangle/external-oes textures
https://bugzilla.gnome.org/show_bug.cgi?id=757285
2015-11-17 15:27:26 +11:00
Vineeth TM
6eae0c7e18 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
2015-11-13 17:00:46 +11:00
Matthew Waters
babd066b89 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
2015-11-13 17:00:46 +11:00
Vineeth TM
4c9ac5e474 glsl: free str while returning error
https://bugzilla.gnome.org/show_bug.cgi?id=758039
2015-11-13 17:00:46 +11:00
Vineeth TM
550ecade4d 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
2015-11-12 21:23:21 +11:00
Vineeth TM
591401f9e8 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
2015-11-12 21:23:21 +11:00
Vineeth TM
ba4802e1e5 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
2015-11-12 21:23:21 +11:00
Vineeth TM
b8adc98ddc glcolorconvert: Fix frag_prog and frag_body memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=757974
2015-11-12 21:23:21 +11:00
Matthew Waters
aada44cc09 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
2015-11-11 23:42:02 +11:00
Matthew Waters
50b59150fd 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
2015-11-11 15:16:37 +11:00
Matthew Waters
f24e768cc3 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.
2015-11-11 14:41:38 +11:00
Matthew Waters
8d8063060e 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.
2015-11-11 11:29:35 +11:00
Matthew Waters
21bd8ee536 glshaderstrings: fixup the external-oes fragment shader
The wrong sampler type was used
s/sampler2DExternalOES/samplerExternalOES/
2015-11-11 01:27:21 +11:00
Matthew Waters
87137e3353 glcolorconvert: try to keep the same texture-target if possible
Fixes issues attempting to passthrough external-oes textures
2015-11-10 23:41:24 +11:00
Matthew Waters
6c97be6dfa 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()
2015-11-10 22:47:42 +11:00
Matthew Waters
149a92f250 glcolorconvert: properly use the other texture-target on fixation 2015-11-10 22:47:42 +11:00
Matthew Waters
3d5ed23a72 glslstage: add debug as to why _set_strings() failed 2015-11-10 22:47:42 +11:00
Matthew Waters
776ccf87b5 glsl: fix check for glsl version against GL context inversion
Any GLSL version that was less than the provided GL version would fail
2015-11-10 22:47:42 +11:00
Matthew Waters
ec318cf36d gl: forward declare some enums
Specifically the GstGLTextureTarget enum
2015-11-10 15:42:35 +11:00
Matthew Waters
8acafe6f9f 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
2015-11-10 15:42:35 +11:00
Matthew Waters
8ae7cc4ee6 glcolorconvert: wait on the sync meta for input buffers 2015-11-10 15:42:35 +11:00
Matthew Waters
df69943726 glcolorconvert: use the correct oes target string in the template caps 2015-11-10 15:42:35 +11:00
Tim-Philipp Müller
edab4deb3a glshader, tsdemux: simplify code
Jus use _delete_link() instead of _remove_link() + _free1()
2015-11-06 13:00:55 +00:00
Alessandro Decina
614ea95690 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.
2015-11-02 12:10:44 +11:00
Matthew Waters
dd738842e4 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...)
2015-10-31 23:32:55 +11:00
Matthew Waters
d07c59170a 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.
2015-10-30 14:40:35 +11:00
Matthew Waters
8106a0931a glcolorconvert: follow the correct texture target names 2015-10-30 14:38:05 +11:00
Matthew Waters
d707038101 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.
2015-10-30 14:24:54 +11:00
Matthew Waters
b429654a37 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.
2015-10-30 14:24:54 +11:00
Matthew Waters
ccce217502 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.
2015-10-30 14:24:53 +11:00
Matthew Waters
e61d504556 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.
2015-10-30 14:24:53 +11:00
Matthew Waters
ff87ffe6e6 glcolorconvert: order the caps template so that RGBA is first
glcolorconvert ! glcolorconvert would sometimes negotiated RGB
(the first list entry) otherwise.
2015-10-30 14:24:53 +11:00
Matthew Waters
e96f454b30 glbufferpool: move typedef's into the forward decleration file
Otherwise, for example, clang will warn about typedef redefinitions
being a C11 feature.
2015-10-30 14:24:53 +11:00
Julien Isorce
704d49b9c7 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.
2015-10-28 14:41:54 +00:00
Matthew Waters
8b0b68c4e8 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.
2015-10-26 18:26:18 +11:00
Matthew Waters
09976e021b 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.
2015-10-26 18:24:59 +11:00
Matthew Waters
0af0237c4a gl: fix usage of string.h and stdio.h functions without including the headers
e.g:
gstglcontext_egl.c:613:7: error: implicit declaration of function 'strcmp'
[-Werror=implicit-function-declaration]
   if (strcmp (G_MODULE_SUFFIX, "so") == 0)
2015-10-21 04:53:08 +11:00
Matthew Waters
80c5e60f9a gl: remove unneeded shader variable parsing code 2015-10-21 04:05:00 +11:00
Matthew Waters
3dfc6899ad gl: be consistent in gobject boilerpate
GST_GL_IS_* vs GST_IS_GL_*

git grep -l 'GST_GL_IS_' | xargs sed -i 's/GST_GL_IS_/GST_IS_GL_/g'
2015-10-19 15:15:30 +11:00
Matthew Waters
9d92326fe5 glslstage: add brackets around pointer dereference referencing an array
While technically, i is always 0 and *vertex_sources[i++] is equivalant
to (*vertex_sources)[i++].  Be future-proof in the case of code
moves/changes/etc.

CID 1327406
2015-10-16 02:57:19 +11:00
Matthew Waters
b25807c382 glshader: port to using GstGLSLStage objects for string management
A GstGLShader is now simply a collection of stages that are
compiled and linked together into a program.  The uniform/attribute
interface has remained the same.
2015-10-15 21:27:57 +11:00
Matthew Waters
cc7d1098ab glsl: add a shader stage object GstGLSLStage
Represents a stage (vertex, geometry, fragment, etc) in the shader
pipeline.
2015-10-15 21:27:57 +11:00
Matthew Waters
c79cbbdcc1 gl/shader/variables: include generic gl.h header
Otherwise we may miss some forward declarations

Fixes build error: undefined reference to GstGLSLStage
2015-10-15 21:27:57 +11:00
Matthew Waters
2e8642cc4c gl: add some GLSL utility functions
Specifically parsing/setting GLSL versions and the shader related
function table.
2015-10-15 21:27:57 +11:00
Guillaume Desmottes
5b30a8e9b2 gl: fix leak in gst_gl_insert_debug_marker()
The string allocated by g_vasprintf() was leaked.

Reproduced using the
validate.file.compositor.simple.play_15s.synchronized validate scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=756492
2015-10-14 09:55:47 +11:00
Matthew Waters
83c2262849 gl: move debugging related functions to their own file 2015-10-02 01:01:42 +10:00
Antoine Jacoutot
a1d39d385d gl: Pass GL_CFLAGS to g-ir-scanner
This unbreaks building when some headers are under a non-standard path.
e.g. /usr/X11R6/include as on OpenBSD.

https://bugzilla.gnome.org/show_bug.cgi?id=755850
2015-09-30 09:59:53 +01:00
Matthew Waters
b8cb829e46 glcontext: fixup strstr lengths so we don't overrun 2015-09-30 15:17:38 +10:00
Matthew Waters
49e6516550 glupload: remove useless release_buffer
It's a leftover from when we weren't outputting GstBuffer's and
returning raw texture id's.
2015-09-30 13:36:09 +10:00
Matthew Waters
6fc9630a91 glutils: use gst_element_set_context for setting display/other_context
1. So we get tracking inside GstElement properly when e.g. adding to a bin
2. Removes redundant code.  Now only one place where
   GstContext->GstGLDisplay/GstGLContext transformation occurs
3. Fixes a memory leak in the process
4. Make the retrieval of debug categories thread safe
2015-09-30 12:39:47 +10:00
Matthew Waters
b7aed13e71 gl/eagl: use the default GL context debug category 2015-09-29 15:38:38 +10:00
Matthew Waters
6d2104aa7c gl: set the context on the element on a context query
Otherwise it's possible to lose the context information if the
context is only propagated through queries.
2015-09-28 22:31:09 +10:00
Matthew Waters
609977a56b gl: chain up to the parent class for GstElement::set_context
https://bugzilla.gnome.org/show_bug.cgi?id=705579
2015-09-28 22:24:04 +10:00
Matthew Waters
2195dad288 gl: sprinkle some debug markers to ease debugging 2015-09-28 16:47:00 +10:00
Matthew Waters
5bf38301e1 gl/utils: add a function to insert a debug marker
These markers are visible in tools that record the GL function calls
such as apitrace, et al.

Makes it easier to match up GL draw commands with specific elements.
2015-09-28 16:47:00 +10:00
Matthew Waters
bfe8e42323 gl: add some debugging prototypes 2015-09-28 16:47:00 +10:00
Matthew Waters
27422da056 glwindow: remove unused draw_unlocked function
The functionality is provided by draw anyway and is leftover from
X11's specific threading requirements that no longer apply.
2015-09-28 16:44:05 +10:00
Julien Isorce
b10fe76cbf glfilter: use GL_ELEMENT_ARRAY_BUFFER for vbo indices
Fixes this error with chromium gpu process:
GL_INVALID_OPERATION, glBindBuffer: buffer bound to more than 1 target

https://bugzilla.gnome.org/show_bug.cgi?id=755618
2015-09-25 20:42:39 +10:00
Julien Isorce
04856e6c8a glmemory: fix texture leak in _gl_mem_copy
https://bugzilla.gnome.org/show_bug.cgi?id=755456
2015-09-25 20:41:33 +10:00
Matthew Waters
46e83f5d50 gl/dispmanx: fix rendering with recent resize state tracking
557ca6fda5 didn't change to the
necessary gst_gl_window_resize() call for the dispmanx backend.
2015-09-21 18:11:21 +10:00
Matthew Waters
f82840ce88 gl/caopengllayer: fix non-existent selector warning
557ca6fda5 introduced the queueResize
call without implementing the selector
2015-09-17 22:44:41 +10:00
Jan Schmidt
0f0bf863fa glwindow: Fix g_return_val_if_fail in a void function 2015-09-17 21:52:38 +10:00
Matthew Waters
3addb6bbf4 glwindow: add API to request a resize event on the next draw
- glimagesink needs to be able to resize the viewport on aspect ratio
  changes resulting from either caps changes or 3d output mode changes.
- Performing a glViewport outside the GstGLWindow::resize callback
  will not have the winsys' stack of viewports required to correctly
  place the output frame.

Provide a function to request a resize on the next draw event from the
winsys.

Also track size changes inside the base GstGLWindow class rather
than in each subclass.

https://bugzilla.gnome.org/show_bug.cgi?id=755111
2015-09-17 20:26:23 +10:00
Matthew Waters
1625f74632 gl/x11: store the correct dimension from the resize events
small typo s/width/height/
2015-09-17 20:21:43 +10:00
Vineeth T M
00438fdff0 gl: Fix GError leaks during failures
https://bugzilla.gnome.org/show_bug.cgi?id=755140
2015-09-17 11:52:55 +02:00
Tim-Philipp Müller
fe8de1857a gl: bufferpool take into account video stride alignment requirements
when allocating memory. Fixes crashes with avdec_h265 in the AVX2
code path which requires 32-byte stride alignment, but the
GstAllocationParams only specified a 16-byte alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=754120
2015-09-15 16:11:23 +01:00
Matthew Waters
591494ff54 gl/api: use public rather than private define
HAVE_IOS is only defined for the build of this module so
attempting to use gstgl in iOS would result in incorrect GL
includes.
Use GST_GL_HAVE_PLATFORM_EAGL instead for choosing the iOS GL
header.
2015-09-10 00:33:19 +10:00
Sebastian Dröge
bab55828ae gl/eagl: Also unbind renderbuffer after setting up framebuffer
https://bugzilla.gnome.org/show_bug.cgi?id=754757
2015-09-09 10:10:47 +03:00
Sebastian Dröge
c97144b23b gl/eagl: Don't make context uncurrent just to make it current again in the next line
Also binding the framebuffer again is unnecessary then as it was just bound a
few lines before while the context was current.

https://bugzilla.gnome.org/show_bug.cgi?id=754757
2015-09-09 10:10:46 +03:00
Tim-Philipp Müller
1cb3e8c591 gtk, qt, gl: fix typo in debug and error messages 2015-08-31 18:06:31 +01:00
Sebastian Dröge
5c106c0c2a gl/eagl: Unref context after setting a window handle
gst_gl_window_get_context() returns a new reference.

Hopefully fixes https://bugzilla.gnome.org/show_bug.cgi?id=753758
2015-08-25 10:09:14 +03:00
Nicolas Dufresne
206638c439 gl: Let base transform relay the meta api for us
During allocation query, when this element is not passthrough, it must
relay the overlay compostion meta and it's parameters. Fortunatly, base
transform can do this for us.

https://bugzilla.gnome.org/show_bug.cgi?id=753850
2015-08-22 22:15:36 -07:00
Justin Kim
85834d6bbc glcontext: add specific error message when missing GL_SHADING_LANGUAGE_VERSION
GL_SHADING_LANGUAGE_VERSION was introduced since ES 2.0, but in some
android emulator doesn't support this feature. To prevent confusion for
developer, the error message need to be more clear.

https://bugzilla.gnome.org/show_bug.cgi?id=753905
2015-08-21 18:14:15 +10:00
Matthew Waters
40d2693d07 glbasefilter: only call gl_{stop,start} if the context changed
Removes the redundant GL object creation/deletion on every
decide_allocation call which is being called for every caps change.

Thus reduces the required GL state changes on reconfigure events
which are being sent by glimagesink/xvimagesink
2015-08-20 23:25:35 +10:00
Nicolas Dufresne
a31a753bfd glupload: Recalculate offset and size in raw upload
As we only expose the mapped portion of the frame into the GL
memory object (and not the original padding) we need to
re-calculate the size and offset.
2015-08-16 18:13:27 +02:00
Nicolas Dufresne
e6bd7d2792 gloverlaycompositor: Also disable the blend when done 2015-08-15 15:55:08 +02:00
Nicolas Dufresne
f935b2c547 glsink: Enable sync meta on pools we offer
As the upload is asynchronous, we need to enable the sync meta to
gain correct rendering. The buffer pool receiver don't know about
that.
2015-08-15 15:55:08 +02:00
Sebastian Dröge
f4a76139db opengl: Change GLclampd to double
GLclampd does not exist on GLES, only desktop GL.
2015-08-15 10:03:07 +02:00
Martin Kelly
591b2e2c68 opengl: add missing ClearDepth prototype
The ClearDepth call is missing.

https://bugzilla.gnome.org/show_bug.cgi?id=753639
2015-08-15 09:28:12 +02:00
Nicolas Dufresne
9720c07f23 gl: Add opengl_version.h to the list of sources
Adding this private header to the list of sources. We don't want to make
this header public, but we need it in the list of sources otherwise it
won't be included in the tarball. This fixes make distcheck.

This regression was introduced by commit 1a6fe3db
2015-08-10 14:51:02 -04:00
Matthew Waters
b7777b9181 gl: use gles2 shaders everywhere
This effectively limits a glfilter subclass to be > GL(ES) 2.0.
rather than a possible GL 1.4.
2015-08-10 16:38:32 +02:00
Matthew Waters
1a6fe3db40 glcontext/wgl: implement gl3 core profile context selection 2015-08-10 15:46:13 +02:00
Nicolas Dufresne
d6baf8dcc7 gloverlaycompositor: Add shader to convert BGRA/ARGB -> RGBA
Depending on the bytes order we will get BGRA (little) and ARGB (big)
from the composition overlay buffer while our GL code expects RGBA. Add
a fragment shader that do this conversion.

https://bugzilla.gnome.org/show_bug.cgi?id=752842
2015-08-08 16:32:53 -04:00
Matthew Waters
69a90b5bfe gl/syncmeta: implement synchronisation without glFenceSync
Uses glFinish as that's the best we have for lesser OpenGL versions.
2015-08-08 17:30:42 +02:00
Matthew Waters
83995c0935 context/glx: only use glXCreateContextAttribs for OpenGL 3 contexts
mesa for example when creating a GL 3.1 compatibility context
overrides our context profile selection to create a core context.
2015-08-08 15:32:17 +02:00
Sebastian Dröge
b21f01276c glupload: Remove debug output from gst_gl_upload_transform_caps()
We can't know if the GstGLUpload type is initialized at this point already,
and thus our debug category might not be initialized yet... and cause an
assertion here.

As we don't print debug output for any of the other transform functions, let's
defer this problem for now.
2015-07-29 19:11:58 +01:00
Nicolas Dufresne
f79cad55e2 glupload: Add fixme about using bufferpool for raw
http://bugzilla.gnome.org/show_bug.cgi?id=752937
2015-07-28 08:59:48 -04:00
Nicolas Dufresne
adbd9d3c05 glupload: Keep input frame mapped as long as needed
When performing a raw upload, we need to keep the raw data mapped as
long as needed.

https://bugzilla.gnome.org/show_bug.cgi?id=752937
2015-07-28 08:54:29 -04:00
Nicolas Dufresne
eb4d3c352a Revert "glupload: memcpy on raw data upload"
This reverts commit 82c0189b28.

https://bugzilla.gnome.org/show_bug.cgi?id=752937
2015-07-28 08:54:29 -04:00