Commit graph

30 commits

Author SHA1 Message Date
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 62588100fd Revert "gl/eagl: try getting a gles3 context"
This reverts commit 96b9666d59.
This reverts commit d11385d167.

This breaks the texture sharing with the applemedia elements as
CVOpenGLESTextureCache seems to have an arbitrary restriction on GLES2 only.
2017-12-09 19:32:16 +00:00
Tim-Philipp Müller a0d62ce32c gl: eagl: fix build
gstglcontext_eagl.m:238:45: error: too few arguments to function call,
expected at least 4, have 3
2017-12-09 19:32:16 +00:00
Matthew Waters de5f87e72b gl/eagl: try getting a gles3 context
Fallback to a gles2 context if that fails
2017-12-09 19:32:15 +00:00
Matthew Waters 06de6998e5 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'
2017-12-09 19:32:09 +00:00
Matthew Waters 977c335460 gl/eagl: use the default GL context debug category 2017-12-09 19:32:09 +00:00
Matthew Waters e9864e2e3e 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.
2017-12-09 19:32:08 +00:00
Matthew Waters 63bbe9406a 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
2017-12-09 19:32:08 +00:00
Sebastian Dröge cd326adacc gl/eagl: Also unbind renderbuffer after setting up framebuffer
https://bugzilla.gnome.org/show_bug.cgi?id=754757
2017-12-09 19:32:08 +00:00
Sebastian Dröge ae721c54c2 gl/eagl: Don't make context uncurrent just to make it current again in the next line
Also binding the framebuffer again is unnecessary then as it was just bound a
few lines before while the context was current.

https://bugzilla.gnome.org/show_bug.cgi?id=754757
2017-12-09 19:32:08 +00:00
Sebastian Dröge 3d4f982045 gl/eagl: Unref context after setting a window handle
gst_gl_window_get_context() returns a new reference.

Hopefully fixes https://bugzilla.gnome.org/show_bug.cgi?id=753758
2017-12-09 19:32:08 +00:00
Matthew Waters 6ccaafc0f3 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
2017-12-09 19:32:07 +00:00
Matthew Waters 9587eb477d 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
2017-12-09 19:32:06 +00:00
Sebastian Dröge cff2d74cd4 gl/eagl: Don't call anything synchronously from the main thread
This will deadlock if the main thread is the one who creates the GstGLContext.
All things we call from the main thread should be possible from any thread.

https://bugzilla.gnome.org/show_bug.cgi?id=751101
2017-12-09 19:32:05 +00:00
Sebastian Dröge 30e13d6623 Revert "eagl: Don't dispatch_sync() to the main thread if we are on the main thread"
This reverts commit 0bff481011.

It wasn't supposed to be merged and also doesn't fix the problem.
2017-12-09 19:32:05 +00:00
Sebastian Dröge c02891ba41 eagl: Don't dispatch_sync() to the main thread if we are on the main thread
This will otherwise deadlock.

https://bugzilla.gnome.org/show_bug.cgi?id=751101
2017-12-09 19:32:05 +00:00
Matthew Waters bb1de83ff2 gl/window: use the default main loop implementation for all backends
fixes glimagsink being unable to display.

https://bugzilla.gnome.org/show_bug.cgi?id=750337
2017-12-09 19:32:03 +00:00
Alessandro Decina 83990b491e libgstgl: fix rendering on iOS
Stop assuming that the handle has been set by the time ->create_context is
called. After bc7a7259f3 set_window_handle always
happens after ->create_context in fact.

See also https://bugzilla.gnome.org/show_bug.cgi?id=745090
2017-12-09 19:31:58 +00:00
Matthew Waters 9968b512c5 gl/window: hopefully fixup compile warnings on android/ios 2017-12-09 19:31:56 +00:00
Matthew Waters 5b8f3e7870 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
2017-12-09 19:31:56 +00:00
Alessandro Decina 464b9e7680 libgstgl: eagl: handle CALayer resize 2017-12-09 19:31:55 +00:00
Matthew Waters 580c144fd7 gl/window/eagl: fix a couple of typos 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 be5d0d81e4 glcontext: add api for retreiving the current context and api
that is current in the calling thread.
2017-12-09 19:31:48 +00:00
Sebastian Dröge 2843ca2066 gl/eagl: Fix compilation 2017-12-09 19:31:37 +00:00
Sebastian Dröge a6f5b079d8 gl/eagl: Notify the window's resize callback about surface dimension changes
https://bugzilla.gnome.org/show_bug.cgi?id=728107
2017-12-09 19:31:37 +00:00
Sebastian Dröge d462e7f6df gl/eagl: Remove spurious private struct pointer 2017-12-09 19:31:37 +00:00
Sebastian Dröge b83d2df47d gl: Import QuartzCore/QuartzCore.h for CAEAGLLayer on older iOS versions 2017-12-09 19:31:36 +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