Commit graph

125 commits

Author SHA1 Message Date
Philippe Normand
afa8bf425a gl/cocoa: fix build after commit 2fd84a6c 2017-08-22 16:19:32 +01:00
Philippe Normand
dcb35318e9 glwindow_cocoa: fix video overlay support
Make sure the window handle is configured after the NSWindow was created.

https://bugzilla.gnome.org/show_bug.cgi?id=767462
2017-07-16 10:21:29 +01:00
Matthew Waters
24e3cbf13b 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-07-16 12:50:31 +10:00
Sebastian Dröge
450b1c92ab gl/cocoa: Put gstglwindow_cocoa.h into noinst_HEADERS again
And remove gstgldisplay_cocoa.h instead, which got moved to the
installed headers earlier.
2017-06-20 19:20:19 +03:00
Matthew Waters
15e13bd44e glcontext: add public swap_buffers function
That simply calls the implementation
2017-05-21 12:12:02 +02:00
Josep Torra
f805608075 cocoa: fix a recently introduced typo
Fixes gstgldisplay_cocoa.m:175:26: error: use of undeclared identifier 'singletone'.
2017-05-20 12:19:08 +02:00
Josep Torra
ef5d42b0a7 cocoa: fix macOS 10.12 deprecation warnings
Add #defines to allow older versions of macOS to use the new constant names.
2017-05-20 12:16:50 +02:00
Sebastian Dröge
4fdd715c4b cocoa: Install gstgldisplay_cocoa.h
It's needed by e.g. qmlglsink.
2017-05-17 17:38:01 +03:00
Sebastian Dröge
634cd87c76 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-05-17 10:40:23 +03:00
Nicolas Dufresne
4261692187 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 14:05:52 -04:00
Josep Torra
1456c65295 glwindow/cocoa: fix warnings reported by XCode 8.1.0
gstglwindow_cocoa.m:345:16: error: unused variable 'window' [-Werror,-Wunused-variable]
  GstGLWindow *window = GST_GL_WINDOW (window_cocoa);
               ^
gstglwindow_cocoa.m:445:11: error: unused variable 'external_view' [-Werror,-Wunused-variable]
  NSView *external_view = (__bridge NSView *)priv->external_view;
          ^
2017-04-01 16:49:15 +02:00
Nick Kallen
46bbc60d24 applemedia/gl: Update code to use ARC
All code interacting with Objective-C objects should now use Automated
Reference Counting rather than manual memory management or Garbage
Collection. Because ARC prohibits C-structs from containing
references to Objective-C objects, all such fields are now typed
'gpointer'. Setting and gettings Objective-C fields on such a
struct now uses explicit __bridge_* calls to tell ARC about
object lifetimes.

https://bugzilla.gnome.org/show_bug.cgi?id=777847
2017-03-07 13:37:07 +02:00
Sebastian Dröge
296b4251e3 gl: Fix backwards compat GST_GL_TYPE_* functions/macros
These have to be macros instead of inline function as they must behave
more or less like an integer literal, i.e. include the function call.
2017-03-04 11:17:35 +02:00
Matthew Waters
bb84f7357b glcontext/cocoa: implement empty swap_buffers
Fixes some GL tests on OS X.
2016-11-16 17:34:29 +11:00
Matthew Waters
9f690fa241 glwindow/cocoa: remove unneeded window code in NSWindow
This is all taken care of by GstGLWindowCocoa/GstGLNSView now.
2016-11-16 00:01:00 +11:00
Matthew Waters
23ec5aeb83 glwindow/cocoa: remove our view from the parent when closing
Otherwise, when the application reuses the same UIView, we were getting
draw notifications on the previous view/layer's which weren't valid anymore
and were referencing pointers that had been freed.

https://bugzilla.gnome.org/show_bug.cgi?id=753003
2016-11-16 00:00:17 +11:00
Matthew Waters
5602cab04d gl/caopengllayer: add a debug category 2016-11-15 23:55:00 +11:00
Matthew Waters
01fa90c1e7 glwindow: remove is_running() function
It isn't necessary in correctly written programs.
2016-11-10 20:05:45 +11:00
Matthew Waters
2a440f60e4 gl/cocoa: don't install the gstglcontext_cocoa.h header
It's not needed to be exposed
2016-11-08 12:46:09 +11:00
Matthew Waters
41a6448918 gl: GST_GL_TYPE -> GST_TYPE_GL
Some deprecated symbols are kept for backwards compatibility
2016-11-03 16:16:12 +11:00
Hyunjun Ko
6a0b35bf37 gl/cocoa: Fix incompatible type warning
https://bugzilla.gnome.org/show_bug.cgi?id=765292
2016-04-20 10:11:03 +03:00
Heinrich Fink
ef12e05a59 gl/caopengllayer: Apply layer.contentsScale to viewport dims
Fixes blurry content on HiDPI screens

https://bugzilla.gnome.org/show_bug.cgi?id=765194
2016-04-18 10:32:07 +03:00
Matthew Waters
b3b73d39a0 gl/cocoa/eagl: don't leak GThread's when dispatching messages
gst_gl_context_get_thread() returns a refed pointer, we need to unref it.
2016-04-13 01:03:20 +10:00
Alessandro Decina
b73d2586ce 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.
2016-04-11 08:40:03 +10:00
Sebastian Dröge
5f925a1580 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.
2016-03-07 08:54:47 +02:00
Alessandro Decina
797d6415df 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).
2016-03-07 16:20:17 +11:00
Matthew Waters
abec124f69 glcontext: add a method to add a context to another share group
Intended for use with wrapped contexts that are created shared with gst's
gl contexts in order to manage the internal sharegroup state correctly.

e.g. with caopengllayer (which is used in glimagesink and caopengllayersink
on OS X), we create a CGL context from the gst context and the sharing state
was not being correctly set on either GL context and gst_gl_context_is_shared()
was always returning FALSE.

With 11fb4fff80 only flushing with multiple
shared contexts, the required flush was not occuring causing screen
corruption or stuttering.

Note: this didn't affect GST_GL_API=opengl pipelines

https://bugzilla.gnome.org/show_bug.cgi?id=762620
2016-02-26 10:59:04 +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
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
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
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
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
1137ed3e45 gl/cocoa: fix definition of gst_gl_context_new
gstglcontext_cocoa.m:75:1: error: conflicting types for 'gst_gl_context_cocoa_new'
2015-07-27 20:03:05 +10:00
Matthew Waters
3b89d8a23c glwindow: pass display to implementation's _new()
So they have to opportunity to fail if they cannot handle the
display connection.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2015-07-27 18:23:29 +10:00
Matthew Waters
dbcae77e02 glcontext: pass display to implentation's _new()
This allows the context to fail creation based on incompatible
display type's. e.g. glx context with an wayland display handle.

https://bugzilla.gnome.org/show_bug.cgi?id=752743
2015-07-27 18:23:17 +10:00
Matthew Waters
d5996de5d7 glcontext: fix get_current_gl_api on x11/nvidia drivers
They require to get_proc_address some functions through the
platform specific {glX,egl}GetProcAddress rather than the default
GL library symbol lookup.
2015-07-18 18:18:22 +10:00
Julien Isorce
b7808270ca glwindow_cocoa: use parent default implementation
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=750337
2015-06-03 21:24:59 +01:00
Matthew Waters
dec8139e65 gl/calayer: provide the exact GL api version for the wrapped context
Otherwise we could end up being mistaken for the diference between a
gl3 and a gl2 context resulting in a failure getting the list of
extensions from the wrapped context due to the difference between
glGetString and glGetStringi for the GL_EXTENSIONS token.

https://bugzilla.gnome.org/show_bug.cgi?id=749728
2015-05-23 01:26:05 +10:00
Matthew Waters
2e58daf196 gl/calayer: provide a current wrapped GstGLContext for callbacks
So that the draw and resize callbacks can get the current GstGLContext.
2015-05-20 00:36:48 +10:00
Matthew Waters
1e9c30223e glcontext/cocoa: implement GL3 core context selection 2015-05-14 20:35:18 +10:00
Julien Isorce
802bf79998 gl: add GstGLDisplayCocoa
https://bugzilla.gnome.org/show_bug.cgi?id=746012
2015-03-14 08:38:03 +00:00
Julien Isorce
90f0cfceb7 gl/cocoa: do not terminate loop in gst_gl_window_cocoa_close
It is now done in _finalize.

Fix regression introduced by
"gl/window: create the main loop/context on init/finalize"
bc7a7259f3
2015-03-14 07:49:14 +00:00
Matthew Waters
66ccdab09a gl/cocoa: avoid deadlock when creating context on the main thread.
Make window/view creation async so that it is possible to
gst_gl_context_create from the main thread.
2015-03-12 16:45:51 +00:00
Matthew Waters
bc7a7259f3 gl/window: create the main loop/context on init/finalize
Avoids races setting the window handle from the main thread.

https://bugzilla.gnome.org/show_bug.cgi?id=745633
2015-03-11 13:52:15 +00:00
Julien Isorce
74c294892d 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.
2015-03-02 07:49:26 +00:00
Julien Isorce
4801db552d gl/cocoa: instead of class_init use g_once to setup nsapp 2015-03-02 07:44:52 +00:00
Julien Isorce
8a0a71ff03 gl/cocoa: check for deprecated constants prior to OSX 10.10 2015-03-02 07:44:25 +00:00
Matthew Waters
beac141057 gl/calayer: don't use the async callback to render
not until we can provide equivalent functionality for other window
implementations.
2015-02-24 19:12:10 +11:00
Julien Isorce
4c4eec61e6 gl/cocoa: reduce custom main loop latency
This fix a very slow rendering rate regression that only
happens when using gst-launch, i.e. in the case where
the main thread does not run any NSApp loop.

Git bisect reported it has been introduced by the commit
e10d2417e2:
"move to CGL and CAOpenGLLayer for rendering".

Then the commit 7d46357627:
"gstglwindow_cocoa: fix slow render rate" attempted to fix
the slow rendering rate problem when using gst-launch.

At least for me it does not work. I tried several
combinations, for example to flush CA transactions in the
custom app loop, as mentioned in the doc, but the only solution
that fixes the slow rendering is by reducing the loop latency.
From what I tested, no need to put less than 60ms, even if the
framerate has an interval much lower (16.6ms for 60 fps).
2015-02-22 10:37:39 +00:00
Matthew Waters
0fd6872f7d 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.
2015-02-17 19:45:35 +11:00