Commit graph

933 commits

Author SHA1 Message Date
Matthew Waters
aeb60d850d Revert accidental push: "gltestsrc: implement checkers pattern with GLSL"
This reverts commit eae09179f0.
2017-12-09 19:31:47 +00:00
Matthew Waters
817417c005 glcontext: detect the sharegroup case where the context are in different chains
In the end they will lead to the same root context in the tree so check that
for equality.
2017-12-09 19:31:47 +00:00
Wang Xin-yu (王昕宇)
14f297b61c gltestsrc: implement checkers pattern with GLSL 2017-12-09 19:31:47 +00:00
Matthew Waters
80be2d046b glfilter: silence a warning with empty input caps
discovered with the doublecube example

gst_caps_get_features: assertion 'index < GST_CAPS_LEN (caps)' failed
2017-12-09 19:31:47 +00:00
Matthew Waters
b2df178d41 examples/gl: update for signal signature change 2017-12-09 19:31:47 +00:00
Matthew Waters
7d99c66ca5 gloverlay: fix zero output frames with YUY2/UYVY
also, be nice and disable blending for other elements
2017-12-09 19:31:47 +00:00
Matthew Waters
0e89ab4c91 gloverlay: protect desktop gl specific tokens with #if 2017-12-09 19:31:47 +00:00
Matthew Waters
f4afec4657 gloverlay: free the image memory every time the location changes
fixes a memory leak
2017-12-09 19:31:47 +00:00
Sebastian Dröge
17fa8eac04 gloverlay: Include into the build with GLES2 only too 2017-12-09 19:31:47 +00:00
Matthew Waters
1c4e5c2aeb gltestsrc: free the shader on stop 2017-12-09 19:31:47 +00:00
Matthew Waters
f5006bdf09 glvideomixer: fix blending with low-alpha sources
We also need to apply the blend paramaters to the alpha channel otherwise
the output of the blend will appear black at low alpha values (< 0.2).
2017-12-09 19:31:46 +00:00
Matthew Waters
96208c1694 gloverlay: reimplement everything
- update for shaders
 - add alpha property
 - image placement properties shamelessly borrowed from gdkpixbufoverlay
 - image placement properties are GstController able
 - use GstGLMemory for the overlay image data
 - add support for gles2
2017-12-09 19:31:46 +00:00
Sebastian Dröge
ec0d04acec gl/cocoa: Switch from our custom main loop to a GMainLoop
Simplifies code a lot and makes it more similar to the other backends.
2017-12-09 19:31:46 +00:00
Sebastian Dröge
6c8f7f9dd5 gl/cocoa: Clear the current GL context when it should happen 2017-12-09 19:31:46 +00:00
Matthew Waters
07489f7b76 glvideomixer: skip input frames with an alpha of 0 2017-12-09 19:31:46 +00:00
Matthew Waters
ae919f4475 gl: download whenever we have sysmem capsfeatures
Otherwise we could pass on a RGBA formatted buffer and downstream would
misinterpret that as some other video format.

Fixes pipelines of the form

    gleffects ! tee ! xvimagesink
2017-12-09 19:31:46 +00:00
Lubosz Sarnecki
3fcfcbbb87 gltestsrc: add Mandelbrot fractal pattern.
https://bugzilla.gnome.org/show_bug.cgi?id=735131
2017-12-09 19:31:46 +00:00
Lubosz Sarnecki
67732e4883 gltestsrc: implement snow pattern with GLSL.
https://bugzilla.gnome.org/show_bug.cgi?id=735131
2017-12-09 19:31:46 +00:00
Matthew Waters
ccf8f014f0 glupload: fallback to upload if contexts cannot share GL resources
Fixes pipelines of the form

    gleffects ! tee ! glimagesink

as tee does not pass on the allocation query.
2017-12-09 19:31:46 +00:00
Matthew Waters
14630fac38 glcontext: add gst_gl_context_can_share
Which determines whether two GstGLContext's can share sharable
OpenGL resources.
2017-12-09 19:31:46 +00:00
Matthew Waters
d946559238 gl/tests: update for upload API changes 2017-12-09 19:31:46 +00:00
Sebastian Dröge
9dd4f40ad6 gl: Let gst_gl_context_get_thread() return a new reference to the GThread
Otherwise it might go away in the meantime and the caller has some random pointer.
2017-12-09 19:31:46 +00:00
Anuj Jaiswal
e9e84da30a gl: consecutive return, break statement
Signed-off-by: Anuj Jaiswal <anuj.jaiswal@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=736939
2017-12-09 19:31:46 +00:00
Matthew Waters
678e7b49b2 gl/debug: desktop GL does not have the KHR suffixes 2017-12-09 19:31:46 +00:00
Matthew Waters
821bc8da5b examples/gl/gtk: use the sync bus callback to set the window handle
And output error messages.
2017-12-09 19:31:46 +00:00
Tim-Philipp Müller
9cccbb315c gl: add since markers for new API 2017-12-09 19:31:46 +00:00
Matthew Waters
a793bda9b4 glmemory: add debug line for freeing textures 2017-12-09 19:31:46 +00:00
Matthew Waters
6491af9ffc glupload: provide the output buffer that is rendered into
Allows callers to properly reference count the buffers used for
rendering.

Fixes a redraw race in glimagesink where the previous buffer
(the one used for redraw operations) is freed as soon as the next
buffer is uploaded.

1. glimagesink uploads in _prepare() to texture n
1.1 glupload holds buffer n
2. glimagesink _render()s texture n
3. glimagesink uploads texture n+1
3.1 glupload free previous buffer which deletes texture n
3.2 glupload holds buffer n+1
4. glwindow resize/expose
5. glimagesink redraws with texture n

The race is that the buffer n (the one used for redrawing) is freed as soon as
the buffer n+1 arrives.  There could be any amount of time and number of
redraws between this event and when buffer n+1 is actually rendered and thus
replaces buffer n as the redraw source.

https://bugzilla.gnome.org/show_bug.cgi?id=736740
2017-12-09 19:31:46 +00:00
Matthew Waters
4e75ceba46 glcontext: add API to retreive the thread that context is active in 2017-12-09 19:31:46 +00:00
Sanjay NM
4f6e9f4e41 gl: Removed unreachable break, unused variable
https://bugzilla.gnome.org/show_bug.cgi?id=736957
2017-12-09 19:31:46 +00:00
Ognyan Tonchev
7e21e35eac glfilter: do not leak pool in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=736732
2017-12-09 19:31:46 +00:00
Ognyan Tonchev
3a70f04113 gltestsrc: do not leak pool in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=736730
2017-12-09 19:31:46 +00:00
Ognyan Tonchev
276b682559 glmixer: do not leak pool in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=736729
2017-12-09 19:31:46 +00:00
Vasilis Liaskovitis
f803a9e746 GstGLWindow: Introduce navigation thread
This thread dispatches navigation events. It is needed to avoid deadlocks
between window backend threads that emit navigation events (e.g. X11/GMainLoop
thread) and consumers of navigation events such as glimagesink, see
https://bugzilla.gnome.org/show_bug.cgi?id=733661

GstGlWindow_x11 thread is changed to invoke the navigation thread for navigation
dispatching, instead of emiting the event itself. Othe backends beside X11 do
not dispatch navigation events yet, but should use this thread when dispatching
these events in the future.

The navigation thread is currently part of GstGLWindow and not implemented in
separate subclasses / backends. This will be needed in the future.

gst_gl_window_x11_get_surface_dimensions is also changed to use a cached value
of the window's width, height. These values are now retrieved in the X11
thread, function gst_gl_window_x11_handle_event. This change is needed because
otherwise the XGetWindowAttributes gets called from the navigation thread,
leading to xlib aborting due to multithreaded access (if XInitThreads is not
called before, as is the case for gst-launch)
2017-12-09 19:31:46 +00:00
Lubosz Sarnecki
e3aa918032 gltransformation: fix issues and expose mvp matrix
* aspect should not be 0 on init
* rename fovy to fov
* add mvp to properties as boxed graphene type
* fix transformation order. scale first
* clear color with 1.0 alpha

https://bugzilla.gnome.org/show_bug.cgi?id=734223
2017-12-09 19:31:46 +00:00
Sebastian Dröge
2c0f8e1107 glimagesink: Add missing break to switch
CID 1232801
2017-12-09 19:31:46 +00:00
Wang Xin-yu (王昕宇)
a8093c56d5 gl: qglwtextureshare demo fixes and cleanup
1. glcontextid function is replaced by gstreamer gst_gl_context_new_wrapped .
2. call gst_init before gst_gl_display_new , seems gst_gl_display_new depends
   on gst_allocator_register , which only worked after gst_init called
3. flush gstreamer OpenGL context before using shared texture, fix
   flicker problem.

https://bugzilla.gnome.org/show_bug.cgi?id=735566
2017-12-09 19:31:46 +00:00
Wang Xin-yu (王昕宇)
62bebdb4e6 gl: Add GSTGLAPI macro to the debug callback function
Fixes the Windows build.

https://bugzilla.gnome.org/show_bug.cgi?id=735565
2017-12-09 19:31:46 +00:00
Jan Schmidt
2d928bad1c egl: Wrap KHR_create_context flags in an ifdef
EGL_CONTEXT_FLAGS_KHR and EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR
don't exist in the Android NDK. Wrap their usage in an #ifdef
EGL_KHR_create_context to fix the build there.
2017-12-09 19:31:45 +00:00
Matthew Waters
f6930bc0b4 egl: fallback to a non-debug context if a debug one fails
The text for EGL_KHR_create_context added the possiblity for ES
contexts to ask for a debug context however that has not been
fully realized by all implementations.  Fallback to a non-debug
context when the implementation errors.
2017-12-09 19:31:45 +00:00
Lubosz Sarnecki
30591d664c gstopengl: add introspection support
https://bugzilla.gnome.org/show_bug.cgi?id=734482
2017-12-09 19:31:45 +00:00
Lubosz Sarnecki
f3311f2b1e examples: fix gtk+ 3.14 deprecation error
https://developer.gnome.org/gtk3/3.13/GtkWidget.html#gtk-widget-set-double-buffered

https://bugzilla.gnome.org/show_bug.cgi?id=734482
2017-12-09 19:31:45 +00:00
Lubosz Sarnecki
e266f6517d glimagesink: expose context
* expose context in draw / reshape callbacks
* add context property

https://bugzilla.gnome.org/show_bug.cgi?id=734482
2017-12-09 19:31:45 +00:00
Lubosz Sarnecki
67b9f71619 glshader: expose opengl handle in getter
https://bugzilla.gnome.org/show_bug.cgi?id=734482
2017-12-09 19:31:45 +00:00
Wang Xin-yu (王昕宇)
c8d1e4ad5f gl: check null before unref GstGLDisplay 2017-12-09 19:31:45 +00:00
Matthew Waters
ac2fdb0aed gl: add prototype definition for KHR_debug 2017-12-09 19:31:45 +00:00
Matthew Waters
61b95b0300 glcontext: implement the debug callback
For both GL_KHR_debug and ARB_debug_output.  This allows us to
receive errors and other hints from the GL instead of querying after
every GL operation.
2017-12-09 19:31:45 +00:00
Matthew Waters
d7a465f9da gl: add prototypes for KHR_debug/ARB_debug_output 2017-12-09 19:31:45 +00:00
Matthew Waters
a76fe07919 gl: don't take an extra ref on the display on set_context
gst_context_get_gl_display() returns a ref.  Don't take another in
gst_object_replace().
2017-12-09 19:31:45 +00:00
Matthew Waters
94efcd2595 glmixer: unref the GstGLUpload in the pad if freed while running
Dynamic pipelines that get and release the sink pads will finalize
the pad without going through gst_gl_mixer_stop() which is where the
upload object is usually freed.  Don't leak objects in such case.
2017-12-09 19:31:45 +00:00