Commit graph

16 commits

Author SHA1 Message Date
Philippe Normand
0214f4fb55 gl/cocoa: fix build after commit 2fd84a6c 2017-12-09 19:32:30 +00:00
Matthew Waters
d75eb628d6 gl/cocoa: keep refs over async operations
Avoids dereferencing dead objects

What happens in the autovideosink case is that context 1 is created and
destroyed before all the async operations hae executed on the associated
window.  When the delayed operations execute, they then reference dead
objects and crash.

We fix this by keeping refs over all async operations so the object
cannot be deleted while async operations are in flight.

https://bugzilla.gnome.org/show_bug.cgi?id=782379
2017-12-09 19:32:29 +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
Matthew Waters
5d8841c8e7 glcontext/cocoa: implement GL3 core context selection 2017-12-09 19:32:01 +00:00
Julien Isorce
befc24469c gl/cocoa: register only one custom nsapp loop
Otherwise the pipeline stalls when running
more than one glimagesink with gst-launch.

Also only register the custom nsapp loop
when setting up the nsapp from gstgl.
2017-12-09 19:31:56 +00:00
Matthew Waters
3f32b45769 gl/cocoa: don't deadlock if the dispatch_sync is called from the main thread
Provide a helper function to check whether we are being called from
the main thread and act appropriately.
2017-12-09 19:31:55 +00:00
Matthew Waters
742e4a10a2 gl/cocoa: small refactor of layer/view creation into the window 2017-12-09 19:31:54 +00:00
Matthew Waters
e57fb35bc0 cgl: add a header for the CAOpenGLLayer support 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
Matthew Waters
0e835bc374 gl/cocoa: move to CGL and CAOpenGLLayer for rendering
Removes the use of NSOpenGL* variety and functions.  Any Cocoa
specific functions that took/returned a NSOpenGL* object now
take/return the CGL equivalents.
2017-12-09 19:31:53 +00:00
Sebastian Dröge
02b3e26854 gl/cocoa: Switch to a plain NSView subclass instead of NSOpenGLView
We don't and can't use NSOpenGLView as it's supposed to be used and
it gets into our way by being to clever in various situations.
2017-12-09 19:31:47 +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
Matthieu Bouron
32265d7e4e [837/906] cocoa: resize OpenGL view size each time the window is resized
Fixes glitches that can appear when the OpenGL view has not been resized
after a window resize.

https://bugzilla.gnome.org/show_bug.cgi?id=711672
2017-12-09 19:31:32 +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
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