Commit graph

22 commits

Author SHA1 Message Date
Matthew Waters 6a37bf9bb9 gl: Don't restore the viewport on function exit
Doing so involves retrieving the current viewport from OpenGL which as
with any glGet operation, is expensive.

This means that the various sinks need to reset the viewport on draw.

In the process, fix resizing on cocoa.
2019-03-08 17:49:05 +11:00
Matthew Waters 1abd0804f4 gl/caopengllayer: use public GstGLContext instead of Cocoa-specific one
Allows keeping the GstGLCAOpenGLLayer public but not the winsys-specific
context/display/window.
2017-12-09 19:32:31 +00:00
Nick Kallen 7b42f26b80 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-12-09 19:32:27 +00:00
Matthew Waters b19e74e02d gl/caopengllayer: add a debug category 2017-12-09 19:32:24 +00:00
Hyunjun Ko 84be275c4f gl/cocoa: Fix incompatible type warning
https://bugzilla.gnome.org/show_bug.cgi?id=765292
2017-12-09 19:32:19 +00:00
Heinrich Fink caa9ad59e6 gl/caopengllayer: Apply layer.contentsScale to viewport dims
Fixes blurry content on HiDPI screens

https://bugzilla.gnome.org/show_bug.cgi?id=765194
2017-12-09 19:32:19 +00:00
Matthew Waters 5f87cc0b65 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
2017-12-09 19:32:17 +00:00
Matthew Waters 718318ce19 gl/caopengllayer: fix non-existent selector warning
557ca6fda5 introduced the queueResize
call without implementing the selector
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
Matthew Waters 66407b9877 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.
2017-12-09 19:32:05 +00:00
Matthew Waters eba6f6b80f 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
2017-12-09 19:32:02 +00:00
Matthew Waters e8e84cf6b3 gl/calayer: provide a current wrapped GstGLContext for callbacks
So that the draw and resize callbacks can get the current GstGLContext.
2017-12-09 19:32:01 +00:00
Matthew Waters 1cf843292b gl/calayer: don't use the async callback to render
not until we can provide equivalent functionality for other window
implementations.
2017-12-09 19:31:55 +00:00
Matthew Waters 9938fe7fa9 gl/calayer: only start drawing if the parent gl context is ready
otherwise we may try to use GstGLFuncs * that hasn't been set yet
2017-12-09 19:31:54 +00:00
Alessandro Decina 1c1084881b Revert "libgstgl: gstglcaopengllayer: set the layer as opaque"
This reverts commit 6f152d381c.

The layer shouldn't be always opaque, it should be made a property.
2017-12-09 19:31:54 +00:00
Alessandro Decina 9f2f3fec17 libgstgl: gstglcaopengllayer: set the layer as opaque 2017-12-09 19:31:54 +00:00
Matthew Waters 200842b3f8 gl/calayer: add resize callback based on the bounds rectangle 2017-12-09 19:31:53 +00:00
Matthew Waters e8878507cb gl/caopengllayer: draw asynchronously
This essentially makes the CAOpenGLLayer draw every refresh cycle.
2017-12-09 19:31:53 +00:00
Matthew Waters 698f1236a4 cgl/calayer: use a callback instead of hardcoding the draw functionality 2017-12-09 19:31:53 +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