Commit graph

1005 commits

Author SHA1 Message Date
Matthew Waters 35476a4cb4 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.
2017-12-09 19:31:57 +00:00
Matthew Waters 813fb633b4 gl: store the list of contexts within gldisplay
Removes the reliance on the allocation query to propogate GL contexts.

Allows thread safely getting a context for the a specific thread.
2017-12-09 19:31:57 +00:00
Matthew Waters d44594c622 glcontext: store the thread current context 2017-12-09 19:31:57 +00:00
Matthew Waters 3e608bcce7 glfilter: don't use the library upload/convert objects 2017-12-09 19:31:57 +00:00
Matthew Waters 1ba38bc10a glupload: implement propose_allocation pool handling for glmemory upload 2017-12-09 19:31:56 +00:00
Matthew Waters 2ead0d97ed gl: add a new glbasefilter class below glfilter
It deals with propagating the gl display/contexts throughout the
application/pipeline
2017-12-09 19:31:56 +00:00
Matthew Waters 6d4cca89ef glutils: expose running a query on a set of src/sink pads 2017-12-09 19:31:56 +00:00
Matthew Waters f9ac4984eb glfilter: advertise resize in the caps negotiation properly 2017-12-09 19:31:56 +00:00
Matthew Waters 1d4b82d5f8 glcolorconvert: we don't do resizing of the video frames
As we cannot do accurate texel sampling then due to the texture
coordinates being interpolated based on the output frame size.
2017-12-09 19:31:56 +00:00
Matthew Waters 39eb34eb43 gl/x11: don't XGetWindowAttributes every XEvent
fixes a deadlock in xcb where the X window may not exist.

https://bugzilla.gnome.org/show_bug.cgi?id=745633
2017-12-09 19:31:56 +00:00
Matthew Waters 9968b512c5 gl/window: hopefully fixup compile warnings on android/ios 2017-12-09 19:31:56 +00:00
Jan Schmidt ebbdf29a24 glfilter: Remove redundant check for clearing context on reset.
The context is already cleared a few lines above.
2017-12-09 19:31:56 +00:00
Jan Schmidt 6350c35352 Remove a bunch of silly ';;' typos at the end of lines 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
Nicolas Dufresne da41207841 glfilter: Don't chain downstream pool
Chaining a downstream pool would lead to two owner of the same
pool. In dynamic pipeline, if one owner is removed from the pipeline
the pool will be stopped, and the rest of the pipeline will fail
since the pool will now be flushing. Also fix proposed pool caching,
filter->pool was never set, never unrefed.

https://bugzilla.gnome.org/show_bug.cgi?id=745705
2017-12-09 19:31:56 +00:00
Sebastian Dröge eeab6e881f gldownload: Simplify caps feature setting code 2017-12-09 19:31:56 +00:00
Sebastian Dröge cb59ace574 gl: Remove format info in glcolorconvert's transform_caps function instead of on every caller
... and let glmixer actually transform the caps it is supposed to transform
instead of inventing new caps.
2017-12-09 19:31:56 +00:00
Sebastian Dröge 86d1280f2c glupload: Simplify caps feature setting code 2017-12-09 19:31:56 +00:00
Edward Hervey 285afe0861 gldisplay: Only use debugging if we have valid values
The debug category won't have been created/activated if it's not a
valid display
2017-12-09 19:31:56 +00:00
Nicolas Dufresne c9ee5a4b87 glfilter: Get rid of uploader if caps have changed
We need to update the uploader format if that caps have changed.

https://bugzilla.gnome.org/show_bug.cgi?id=745549
2017-12-09 19:31:56 +00:00
Edward Hervey 961e847433 gl: Fix context leaks
Introduced by a12ca13750
2017-12-09 19:31:56 +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
Julien Isorce 075a4ffaff gl/cocoa: instead of class_init use g_once to setup nsapp 2017-12-09 19:31:56 +00:00
Julien Isorce 9599b46416 gl/cocoa: check for deprecated constants prior to OSX 10.10 2017-12-09 19:31:56 +00:00
Nicolas Dufresne 50c491dd36 glbufferpool: Fix offset for odd height
We also need to recalculate the offset, since otherwise the frame
mapping will be forward two lines in the U and V planes (I420) due
to gst_video_info_align() round up the Y plane to a even number of
lines.

https://bugzilla.gnome.org/show_bug.cgi?id=745054
2017-12-09 19:31:56 +00:00
Nicolas Dufresne b2aea709d0 glmemory: Support offset when downloading
Make sure we support offset and video alignment when downloading too.
This is currently not used (plane_start is always 0), but it makes
the code correct if we want to use that later.
2017-12-09 19:31:55 +00:00
Nicolas Dufresne 0cbe42af24 glmemory: Provide correct size on upload
Provide the right size to GL when uploading. Using maxsize is wrong
since we offset the data point with the memory offset and video
alignement offset.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Nicolas Dufresne 3405eec996 glmemory: Provide correct size on download
Provide the right size to GL when downloading. This fixes downloading
from GLMemory that where created for libav.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Nicolas Dufresne 33050939ff glmemory: Use fallback for partial copy
When the memory is partial copy, the texture size and videoinfo no
longer make sense. As we cannot guess what the application wants, we
safely copy into a sysmem memory.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Nicolas Dufresne de79830b05 glmemory: Add GstAllocationParams and alignment support
This implements support for GstAllocationParams and memory alignments.
The parameters where simply ignored which could lead to crash on
certain platform when used with libav and no luck.

https://bugzilla.gnome.org/show_bug.cgi?id=744246
2017-12-09 19:31:55 +00:00
Matthew Waters 05a4c89f25 glupload: perform egl upload on the gl thread
Fixes EGLImage usage on raspberry pi

https://bugzilla.gnome.org/show_bug.cgi?id=743914
2017-12-09 19:31:55 +00:00
Víctor Manuel Jáquez Leal e3d457ec8e glupload: Set freed method implementation to NULL
When trying to render buffers with meta:GLTextureUpload the glimagesink crashes
with a segmentation fault.

This patch workarounds this crash setting to NULL the method implementation
after free.

https://bugzilla.gnome.org/show_bug.cgi?id=745206
2017-12-09 19:31:55 +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
Edward Hervey 4fa2ddda96 gl/egl: Detect window handle changes
When (re)activating the context, the backing window handle might have changed.
If that happened, destroy the previous surface and create a new one

https://bugzilla.gnome.org/show_bug.cgi?id=745090
2017-12-09 19:31:55 +00:00
Luis de Bethencourt 6a515ab278 gl: remove docbook related warnings 2017-12-09 19:31:55 +00:00
Matthew Waters fba2a2093f glmemory: allow sharing between buffers
There was no real reason why the flag was set.  We should be able
to handle it.  Fixes last-sample handling on gl sinks
2017-12-09 19:31:55 +00:00
Matthew Waters 5acb75cdf4 glsyncmeta: add compat definition for gles2 2017-12-09 19:31:55 +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 844c0e77ee glsyncmeta: also supported with gles3 2017-12-09 19:31:55 +00:00
Alessandro Decina 464b9e7680 libgstgl: eagl: handle CALayer resize 2017-12-09 19:31:55 +00:00
Vasilis Liaskovitis e10a2f8922 glmemory: Fix transfer_pbo memory leak
https://bugzilla.gnome.org/show_bug.cgi?id=744977
2017-12-09 19:31:55 +00:00
Julien Isorce 0ad168a258 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
e10d2417e2fe7aa4733c076984339b0d61caa169:
"move to CGL and CAOpenGLLayer for rendering".

Then the commit 7d463576271e5a4cc1070780ba1a69c971e8be1d:
"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).
2017-12-09 19:31:55 +00:00
Mathieu Duponchelle 50ae80e0e6 gstglmemory: Remove now unused transfer_upload function. 2017-12-09 19:31:55 +00:00
Matthew Waters 2af5a108f1 glmemory: disable automatic pbo upload
until we can track where the data is/or is going to be.
2017-12-09 19:31:55 +00:00
Matthew Waters af023d7c95 glememory: only store and act on the map flags on first/last map/unmap
Anytime else, we have no idea how to match up map and unmaps.
We also don't know exactly how the calling code is using us.
Also fixes the case where we're trying to transfer while someone else
is accessing our data pointer or texture resulting in mismatched video
frames.

https://bugzilla.gnome.org/show_bug.cgi?id=744839
2017-12-09 19:31:55 +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 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
Matthew Waters 742e4a10a2 gl/cocoa: small refactor of layer/view creation into the window 2017-12-09 19:31:54 +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
Edward Hervey f56c4c541a gl: Add/Update more debug statements
Where possible, use the _OBJECT variants in order to track better from
which object the debug statement is coming from

Define (and use) GST_CAT_DEFAULT where applicable

Use GST_PTR_FORMAT where applicable
2017-12-09 19:31:54 +00:00