Commit graph

1960 commits

Author SHA1 Message Date
Matthew Waters 3ee2183038 glupload: keep the parent buffer around when converting EGLImage to 2D textures
e.g. receiving and releasing a buffer from OMX too early will potentially
cause textures to be overwritten while/before they are displayed.
2017-12-09 19:32:19 +00:00
Matthew Waters 458c3067e4 glbasemixer: chain up to the parent implementation 2017-12-09 19:32:19 +00:00
Alessandro Decina 5c506cd857 libgstgl: cocoa, eagl: use libdispatch to schedule GL calls
Use libdispatch instead of GMainLoop to dispatch GL calls. libdispatch is more
optimized and cuts a lot of poll()/pthread_* overhead.
2017-12-09 19:32:19 +00:00
Alessandro Decina 3d124f498a glwindow: reduce the number of GMutexes and GConds in send_message()
Don't create many short lived locks/conds in gst_gl_window_send_message. This is
a micro optimization to save a bunch of pthread_* calls which are expensive on
OSX/iOS and possibly other platforms.
2017-12-09 19:32:19 +00:00
Matthew Waters 7f8e09523f videoaggregator: repect the result of find_best_format in the default update_caps
We weren't using the result of find_best_format at all.

Also, move the find_best_format usage to the default update_caps() to make
sure that it is also overridable.

https://bugzilla.gnome.org/show_bug.cgi?id=764363
2017-12-09 19:32:19 +00:00
Matthew Waters aae649dc75 glvideomixer: add support for the affine transformation meta 2017-12-09 19:32:18 +00:00
Matthew Waters 9829245b2b glimagesink: support the affine transformation meta for any texture target 2017-12-09 19:32:18 +00:00
Matthew Waters b9f77bf92b glmixer: set the current texture to 0 before mapping
If we fail mapping, we don't want to use undefined video data in the subclass.
2017-12-09 19:32:18 +00:00
Matthew Waters 366d7ac90b glmixerbin: proxy the start-time-* properties from aggregator 2017-12-09 19:32:18 +00:00
Matthew Waters b1a60af720 eglimage: perform eglCreateImage in the gl thread
while calling eglCreateImage without a GL context current in the executing
thread works on the RPi, some other implementations will return errors.

Marshall the eglCreateImage to the GL thread to appease these implementations.
2017-12-09 19:32:18 +00:00
Matthew Waters cbf3a986ca glviewconvert: support outputting to multiple draw buffers on GLES3
A similar change that was done to glcolorconvert adding the necessary shader
mangling.
2017-12-09 19:32:18 +00:00
Matthew Waters 85cddc0891 glcolorconvert: implement multiple render targets for GLES3
There are numerous slight differences required between Desktop GL and GLES3 for
multiple render targets.

1. gl_FragData doesn't exist at all and one is required to use
   'layout (location = ?) out ...' instead.
2. gl_FragColor doesn't exist, same as 1
3. texture2D() has been deprecated

Fortunately most of these have been taken care of with GL3 and the shader
mangling already exists so just expand the conditions they are used in.  The
gl_FragData issue requires a new mangle pass though.  We also use this new
pass on desktop GL for consistency.
2017-12-09 19:32:18 +00:00
Matthew Waters e5c43ab7fb gl/build: add missing '\' at the end of the line in MakeFile.am
Otherwise the following elements aren't included in the correct variable.

Fixes error in 'make distcheck' failing to find gstgltestsrc.h
2017-12-09 19:32:18 +00:00
Matthew Waters 597e98b64a glcolorconvert: don't use the predefined variable name sample
Using 'sample' as a variable name is an error in GLES3
2017-12-09 19:32:18 +00:00
Matthew Waters e3b5214ac6 gl/examples: fix switchvideooverlay for wayland
and call XInitThreads() for X11
2017-12-09 19:32:18 +00:00
Matthew Waters df6a85725f gl/examples: remove duplicated videooverlay example
filtervideooverlay proved the exact same example (only with a extra glfiltercube).
2017-12-09 19:32:18 +00:00
Matthew Waters ed1ff251db gl/examples/3d: additions for wayland support 2017-12-09 19:32:18 +00:00
Matthew Waters 79935c7ee3 gldifferencematte: port to gl3/gles2 2017-12-09 19:32:18 +00:00
Matthew Waters cdcd234613 gltestsrc: port to gles2/gl3
This makes gltestsrc work everywhere \o/

- workaround RPi returning invalid values for positive coords in the
  checker shader
- reduce the number of iterations in the mandelbrot shader for gles2

https://bugzilla.gnome.org/show_bug.cgi?id=751540
2017-12-09 19:32:18 +00:00
Matthew Waters 55eaa869ea gltestsrc: port smpte pattern to shaders
Loosely based on patch by
Lubosz Sarnecki <lubosz.sarnecki@collabora.co.uk>

https://bugzilla.gnome.org/show_bug.cgi?id=751540
2017-12-09 19:32:18 +00:00
Matthew Waters b7ab7aa349 gltestsrc: implement the circular method
https://bugzilla.gnome.org/show_bug.cgi?id=759801
2017-12-09 19:32:18 +00:00
Matthew Waters 309005b12d gltestsrc: add a generic src framework
Any unsupported pattern (circular) results in an error
2017-12-09 19:32:18 +00:00
Matthew Waters 5a68528419 glsterosplit: remove internal glupload/glcolorconvert
They are provided separately as elements and no other element contains the
internal references to glupload/glcolorconvert.
2017-12-09 19:32:18 +00:00
Matthew Waters 97e66be37d gl: add support for building against GLES3 headers
with a fallback to GLES2 headers if available.
2017-12-09 19:32:18 +00:00
Matthew Waters 0c2890cd34 glmemory: add checking the read implementation format/type on gles2 platforms
By default, reading GL_RED or GL_RG us unsupported by glReadPixels unless
exposed through GL_COLOR_READ_IMPLEMENTATION_FORMAT/TYPE.  This allows
downloading multiple-planar video frames where possible.
2017-12-09 19:32:18 +00:00
Matthew Waters f1737c8ad7 glbasememory: rollback map state when subclass map fails
Otherwise our state doesn't reflect reality.
2017-12-09 19:32:18 +00:00
Matthew Waters 99dfbf8ed9 glmemorypbo: unmap pbo memory on pbo read error
Otherwise we are returning failure with a dangling map!

Also only unset the NEED_DOWNLOAD flag in download_transfer() if the read actually
succeeds.
2017-12-09 19:32:18 +00:00
Matthew Waters ccbf43987f glshader: add glBindFragDataLocation
There are some cases where it's needed for binding in/out variables in shaders.
e.g. glsl 150 (gl 3.2) doesn't support the 'layout (location = ?)' specifiers in
the shader source so we have to bind them ourselves.
2017-12-09 19:32:18 +00:00
Vineeth TM e92bbb2a83 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2017-12-09 19:32:18 +00:00
Sebastian Dröge 82a39d2227 gl/gtk: Fix compiler warning in example
fxtest.c: In function ‘main’:
fxtest.c:190:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
   GtkWidget *window;
   ^~~~~~~~~
2017-12-09 19:32:18 +00:00
Matthew Waters b5e8763a07 gl/proto: sync operations are available on GLES 3.0
Without the GST_GL_API_GLES2 bit set, we will not even attempt to look
for the function pointers in the core library and will fallback to
glFlush/glFinish.
2017-12-09 19:32:18 +00:00
Matthew Waters b1bfcac299 glmemory: unset GL_UNPACK_ROW_LENGTH in opengl3
If the user uploads their own texture without setting the unpack length, then
then the result will have the appearance of stride mismanagement due to
an incorrect row length.
2017-12-09 19:32:18 +00:00
Matthew Waters 015ec7587f gl/examples/qt: restrict the GL API to opengl where needed
Until the examples are ported to opengl3/gles2, they will not work with any
other GL api.
2017-12-09 19:32:18 +00:00
Matthew Waters d2542993dd gl/examples/gtk: call XInitThreads
Fixes some sporadic X11 threading assertions.
2017-12-09 19:32:18 +00:00
Matthew Waters 2ba61c9049 glutils: remove custom code for setting caps features
Just use gst_caps_set_features() instead.
2017-12-09 19:32:17 +00:00
Matthew Waters d5cc277601 glfilter: only allow the same src/sink caps when we are in passthrough mode
If we are given caps with extra features (like the overlay composition
features), we can only deal with that when we are in passthrough mode.

Previously we were bailing entirely and not allowing passthrough filter elements
with things like textoverlay.

Fixes the following pipeline (assuming glfilter supports passthrough):
gl ! textoverlay ! glfilter ! ... ! glimagesinkelement

https://bugzilla.gnome.org/show_bug.cgi?id=763756
2017-12-09 19:32:17 +00:00
Matthew Waters 356494d967 glupload: deal with the ANY caps feature correctly
When transforming, xplode it out into the necessary caps features both
with and without the passthough features.

Fixes negotiation in the following class of pipelines:

gl ! textoverlay ! glupload ! glimagesinkelement

https://bugzilla.gnome.org/show_bug.cgi?id=763756
2017-12-09 19:32:17 +00:00
Matthew Waters c7da2adf7f glstereo{mix,split}: allow running on GLES 2/3
It's mostly supported for GLES 2.x, fully supported on GLES 3.x
2017-12-09 19:32:17 +00:00
Matthew Waters d1b3b63c1c gleffects; give each effect a unique long name and description
Gives applications that scrape the factory details more detailed and unique
details on the exact element.

https://bugzilla.gnome.org/show_bug.cgi?id=760566
2017-12-09 19:32:17 +00:00
Matthew Waters fdca1dec0d glshader: some compatibility changes for GL 1.4
GL 1.4 (with GL_ARB_shader_objects) doesn't have glIsProgram or glIsShader
equivalents.  As they are simply assertions, skip them when there isn't a
valid function pointer.
2017-12-09 19:32:17 +00:00
Matthew Waters c1d49430ec glfilterapp: update for the use of shaders
Fixes black output when placed in pipelines (using the default drawing).

https://bugzilla.gnome.org/show_bug.cgi?id=763365
2017-12-09 19:32:17 +00:00
Matthew Waters 4406730633 glfilter: retrieve the shader attributes from the GL thread
Otherwise we will receive bogus values

https://bugzilla.gnome.org/show_bug.cgi?id=763365
2017-12-09 19:32:17 +00:00
Matthew Waters 34e12a8837 gl/examples/cube*: choose opengl by default
The examples don't work with any other GL API.

Also fix the yuv example to not translate the cube out of the clipping area.
2017-12-09 19:32:17 +00:00
Matthew Waters c3e362a8a9 gl/examples/fxtest: add needed glupload to the pipeline
Fixes a negotiation failure in the example
2017-12-09 19:32:17 +00:00
Vineeth TM cd696a0b79 glimagesink: Fix window memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=763356
2017-12-09 19:32:17 +00:00
Matthew Waters 7b2ab7279f glvideomixer: signal continuation in reset
We want to iterate over all the pads, not just the first one.  Fix by returning
TRUE in the GstAggregatorPadForeachFunc.

Removes a GST_IS_GL_CONTEXT() assertion on shutdown with >2 inputs
using gst-launch.
2017-12-09 19:32:17 +00:00
Matthew Waters eb1a9bb9b0 gldisplay: make readding the same context a no-op
With e38af23044 returning the correct contexts,
gst_gl_display_add_context() was susceptible to causing infinte loops when
adding the same GstGLContext more than once.  Fix and add a test for
gst_gl_display_add_context().

Fixes glvideomixer gst-validate tests.
2017-12-09 19:32:17 +00:00
Sebastian Dröge 95415270f0 Revert "libgstgl: cocoa, eagl: don't marshal GL calls to the context thread"
This reverts commit 797d6415df.

We're frozen for 1.8.0 release and this change might have bigger impact.
2017-12-09 19:32:17 +00:00
Alessandro Decina 90889bc73f libgstgl: cocoa, eagl: don't marshal GL calls to the context thread
Execute GL calls without marshalling them to the context thread. In the cocoa
and eagl backends calling gst_gl_context_activate is cheap and therefore calling
it on the current thread and serializing GL calls with a per-context lock is
more efficient (faster and has less overhead) than marshalling everything to the
context thread.

This optimization cuts a large overhead in g_poll (continuously waking up the
context thread) and in g_mutex_*/g_cond_* (waiting for results from the context
thread).
2017-12-09 19:32:17 +00:00
Mark Nauwelaerts 6d343abec8 gldisplay: really retrieve glcontext for a specific thread
When requesting a glcontext (regardless of thread), the result was correct.
However, when requesting current glcontext on a specific thread, it could
come up with a glcontext active on another thread.

https://bugzilla.gnome.org/show_bug.cgi?id=763168
2017-12-09 19:32:17 +00:00