Commit graph

56 commits

Author SHA1 Message Date
Julien Isorce 01961ec44d glwindow: initialize debug in class_init
Useful if one uses gst_gl_window_x11_new directly
instead of gst_gl_window_new.
2017-12-09 19:32:02 +00:00
Julien Isorce 2472bcaaa6 glwindow: provides some default implementations to factorize with all backends 2017-12-09 19:32:02 +00:00
Matthew Waters 6445569abf glwindow: track context activation properly
We only need to deactivate/reactivate the context iff it was already
active.
2017-12-09 19:31:59 +00:00
Julien Isorce 0142f551f8 glwindow: remove unused gl_thread field 2017-12-09 19:31:58 +00:00
Edward Hervey 961e847433 gl: Fix context leaks
Introduced by a12ca13750
2017-12-09 19:31:56 +00:00
Edward Hervey 081f101f56 glwindow: Deactivate window before changing handle
When setting a new window handle, we need to ensure all implementations
will detect the change.

For that we deactivate the context before setting the window handle, then
reactivate the context

https://bugzilla.gnome.org/show_bug.cgi?id=745090
2017-12-09 19:31:55 +00:00
Sebastian Dröge c4e75844a8 glwindow: Remove assertion in gst_gl_window_show() for subclasses not implementing it
On Android and iOS we can't create a window ourselves, so also can't just show
one. That's not a problem and an assertion is not really needed here.
2017-12-09 19:31:54 +00:00
Matthew Waters 598715fc4b glwindow: make showing a window explicit
Also fixes the cgl context always displaying a window to render to for
every GstGLContextCocoa created
2017-12-09 19:31:53 +00:00
Matthew Waters 019367c128 glwindow: remove width/height from _draw()
Depending on the platform, it was only ever implemented to 1) set a
default surface size, 2) resize based on the video frame or 3) nothing.
Instead, provide a set_preferred_size () that elements/applications
can use to request a certain size which may be ignored for
videooverlay/other cases.
2017-12-09 19:31:53 +00:00
Hyunjun Ko db6ea1b3bd gl: Correct invalid comment text 2017-12-09 19:31:49 +00:00
Julien Isorce af59b771fd gl: do not raise a critical msg if the backend does not handle window events
Fix "assertion 'window_class->handle_events != NULL' failed"
if not using a X11 window.
2017-12-09 19:31:49 +00:00
Lubosz Sarnecki 64dd17bde6 glimagesink: implement gst_video_overlay_handle_events
https://bugzilla.gnome.org/show_bug.cgi?id=736035
2017-12-09 19:31:49 +00:00
Tim-Philipp Müller 653c04b121 gl: fix Since marker for gst_gl_window_run_navigation() 2017-12-09 19:31:49 +00:00
Matthew Waters 35e9b5ab8b gl: sprinkle some Since markers 2017-12-09 19:31:49 +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
Vasilis Liaskovitis 7b1a853888 GstGLWindow, GstGLImagesink, x11: Scale navigation events on resized windows
If window is resized, GstStructure pointer values have to be rescaled to
original geometry. A get_surface_dimensions GLWindow class method is added for
this purpose and used in the navigation send_event function.

https://bugzilla.gnome.org/show_bug.cgi?id=703486
2017-12-09 19:31:45 +00:00
Sebastian Dröge 307db954fd glwindow: Constify string parameters to the send_*_event() functions 2017-12-09 19:31:44 +00:00
Vasilis Liaskovitis 6b38d58427 GstGLWindow : Add mouse-event and key-event signals for navigation
https://bugzilla.gnome.org/show_bug.cgi?id=703486
2017-12-09 19:31:44 +00:00
Matthew Waters 4a8b31afd6 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2017-12-09 19:31:42 +00:00
Matthew Waters 857200ff40 gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2017-12-09 19:31:39 +00:00
Matthew Waters 6a2f2088e9 gl/window: fix string length check for eagl 2017-12-09 19:31:39 +00:00
Sebastian Dröge 3770d2a406 gl: Add support for iOS EAGL platform
https://bugzilla.gnome.org/show_bug.cgi?id=703341
2017-12-09 19:31:36 +00:00
Matthew Waters 1af7847fdc gl/window: add a dummy window class
Effective for the case where we have a platform that does not
require a native window.  We require a mainloop to run the GL
commands which is currently operated by GstGLWindow.
2017-12-09 19:31:34 +00:00
Matthew Waters 303b77eeff [890/906] x11: add display subclass
GstGLDisplayX11 holds the display connection and name.  Each thread requires
it's own X11 Display connection (initialised from name) due to the fact that
we do not want to call XInitThreads().  Doing so would result in segfaults
when integrating with GUI toolkits Gtk, Qt, etc.

The Display connection is for OpenGL platforms where a constant display is
required in order to share contexts (egl).  In the case of a wrapped context
(added later), we do not have GstGLWindow to retreive the display from so a
'master' connection is used instead.
2017-12-09 19:31:33 +00:00
Matthew Waters 253fe220df [863/906] window: hold a ref to our GstGLDisplay 2017-12-09 19:31:33 +00:00
Matthew Waters 2026f60879 [862/906] window: remove set_need_lock
No-one is using it.  The only code that did was the x11 one which
doesn't need it anymore.
2017-12-09 19:31:33 +00:00
Matthew Waters dadce598ba [859/906] window: provide some documetation 2017-12-09 19:31:32 +00:00
Julien Isorce e42b5bc985 [841/906] osx: allow x11/glx backend and set default runtime to cocoa/nsgl
https://bugzilla.gnome.org/show_bug.cgi?id=719757
2017-12-09 19:31:32 +00:00
Julien Isorce 6a5bd364a4 [835/906] gstglwindow: remove unused fields 2017-12-09 19:31:32 +00:00
Julien Isorce 4d6de2ce1b [834/906] gstglwindow: clear mutex 2017-12-09 19:31:32 +00:00
Julien Isorce 66d7d4712e [831/906] glimagesink: avoid to overload the drawer if already drawing
Especially if the application calls gst_video_overlay_expose a lot
2017-12-09 19:31:32 +00:00
Julien Isorce e1eb30005c [820/906] gstglwindow: if available use wayland instead dispmanx on rpi 2017-12-09 19:31:31 +00:00
Matthew Waters 3b1ec77cf8 [818/906] window: add send_message_async vmethod
- provide a default synchronous send_message
- make context creation threadsafe again
2017-12-09 19:31:31 +00:00
Julien Isorce dd679dee25 [803/906] raspberrypi: add support for dispmanx
See https://bugzilla.gnome.org/show_bug.cgi?id=703342
2017-12-09 19:31:31 +00:00
Matthew Waters 9cbb652b66 [794/906] context: add subclasses for the different platforms (egl, glx, wgl, etc)
- most code taken from the Window subclasses
- tested combinations: xEGL, GLX, Wayland+EGL, Cocoa (under GNUStep), WGL (Wine)
2017-12-09 19:31:30 +00:00
Matthew Waters e80533dcee [793/906] add a GstGLContext object that will be the basis of OpenGL contexts
At the moment it just sits in between GstGLDisplay and GstGLWindow
performing some of the stuff that GstGLWindow used to do.
2017-12-09 19:31:30 +00:00
Sebastian Dröge b2934152ce [752/906] glwindow: Add destroy notifies for the data of the callbacks
And actually call the close callback when the window is closed.
2017-12-09 19:31:29 +00:00
Sebastian Dröge 192b37980f [735/906] gl: Add support for Android
https://bugzilla.gnome.org/show_bug.cgi?id=703340
2017-12-09 19:31:29 +00:00
Julien Isorce d17a4381b1 [732/906] build: fix repeated typedefs
Write forward declarations in another way to avoid
repeated typedefs "error: redefinition of typedef".
Raised when using i686-apple-darwin11-llvm-gcc-4.2
It seems that C apple compiler does not support
C11 feature.

https://bugzilla.gnome.org/show_bug.cgi?id=703885
2017-12-09 19:31:29 +00:00
Julien Isorce bbc71ed90f [723/906] gstglwindow: close has to be called in the glthread.
Indeed 'glXMakeCurrent (window_x11->device, None, NULL);'
has to be called in the thread where the glcontext is actually
current.
Otherwise glXDestroyContext may crash.
2017-12-09 19:31:28 +00:00
Matthew Waters 951daee416 [710/906] window: fail if the user specifies an GL api that we cannot work with
It would've been caught later in an g_assert anyway.
2017-12-09 19:31:28 +00:00
Matthew Waters 6e86d0e920 [708/906] display: a cleanup and removal of old code 2017-12-09 19:31:28 +00:00
Matthew Waters 4f117323b8 [705/906] x11: don't shutdown in _finalize
The window's loop could be still running when _finalize is called
and if we destroy the display connection it will never be closed.

Add _open and _close vfuncs to GstGLWindow so that subclasses can
start up and shutdown at the right time.
2017-12-09 19:31:28 +00:00
Matthew Waters 761bc0156a [704/906] Use gst_object_[un]ref so we can get refcounts in the log 2017-12-09 19:31:28 +00:00
Matthew Waters c6988cb064 [701/906] display: move context creation into window 2017-12-09 19:31:28 +00:00
Matthew Waters 7d4d1f50d4 [669/906] window: seperate object creation and context creation 2017-12-09 19:31:27 +00:00
Matthew Waters e983f02e87 [642/906] add gstglconfig.h for apps to find out what our capabilites are
ie libgstgl can be compiled with any combination of opengl/gles2
2017-12-09 19:31:26 +00:00
Matthew Waters 4a024734da [638/906] window: add get_proc_address + stub for retrieving gl functions 2017-12-09 19:31:26 +00:00
Matthew Waters c3526080aa [629/906] window: add GError for error handling of context creation 2017-12-09 19:31:26 +00:00
Matthew Waters 0be301af24 [621/906] GstGLRendererAPI => GstGLAPI and get GstGLAPI from a window 2017-12-09 19:31:26 +00:00