Commit graph

1338 commits

Author SHA1 Message Date
Matthew Waters
2ef124dac6 gldebug: implement a delayed debug system
The messages are stored by gst_gl_async_debug_store_log_msg() and output later
by a corresponding store(), output() or an unset()/free().

Some wrapper macros are provided to avoid callers explicitly using __FILE__,
GST_FUNCTION and __LINE__
2016-01-15 12:19:02 +11:00
Matthew Waters
ad2f0cf619 gldebug: use gst_info_vasprintf in insert_debug_marker()
Allows expansion of GST_PTR_FORMAT and GST_SEGMENT_FORMAT arguments.
2016-01-15 12:19:02 +11:00
Matthew Waters
8e77cf1030 glfilter: recreate the fbo on caps changes
The width/height may change which requires recreating the depth buffer.
2016-01-15 12:05:03 +11:00
Matthew Waters
3e16a6a2e7 glbasefilter: add a class function on set_caps (from GL)
This is simply a convenience to avoid duplicating the thread marshalling on
set_caps.
2016-01-15 12:05:03 +11:00
Matthew Waters
82bb5d4e22 gl/x11/navigation: add button press to the selected event mask
Otherwise we won't get the button press events and GstNavigation fails.
2016-01-14 17:52:23 +11:00
Alessandro Decina
bef0a46c5d glcolorconvert: try harder to passthrough
This makes a pipeline like:

... ! video/x-raw(memory:GLMemory),format=UYVY ! glcolorconvert !
video/x-raw(memory:GLMemory),format={UYVY, NV12} ! ...

passthrough instead of converting UYVY => NV12. The conversion would happen
before this change since the element (and basetransform) transform the src caps
to format={NV12, UYVY} (since NV12 comes first in the glcolorconvert:src
template) and then the default caps fixate func would fixate to NV12. Blah.

Also there's no need to intersect against the template caps in ::transform_caps
since basetransform does that right after calling the vfunc.
2016-01-14 16:38:07 +11:00
Matthew Waters
0be9c9f960 gldebug: add a specific category for the debug spam from the driver 2016-01-13 12:00:03 +11:00
Matthew Waters
04ec728722 glbasememory: Free the actual memory object when requested
Otherwise we are leaking ~400B on each GstMemory allocation.

Freeing in the base class matches the GObject semantics.
2016-01-11 20:40:39 +11:00
Matthew Waters
3423e108d4 glmemorypbo: don't double read pixels
The optimistic download_transfer was not setting the required flag to not
perform glReadPixels on subsequent map (READ). resulting in glReadPixels
happening twice.
2016-01-11 20:40:39 +11:00
Matthew Waters
e8a251db4b glmemory: expose gst_gl_memory_texsubimage
Removes extremely similar code from glmemorypbo.
2016-01-11 20:40:39 +11:00
Matthew Waters
0ebd719644 glfeature add a specific debug category
Saves having to trawl through the 'default' category when function retrieval
goes wrong.
2016-01-11 20:40:39 +11:00
Matthew Waters
11fb4fff80 glsyncmeta: only flush with a shared context
The wait code will flush for us for single context pipelines.
2016-01-07 14:11:13 +11:00
Matthew Waters
2aadd7eaf9 glcontext: implement checking whether a context has been shared
Some operations are unnecessary when running with only a single GL
context.
e.g. glFlush when setting a fence object as the flush happens on wait.

API: gst_gl_context_is_shared
2016-01-07 14:11:13 +11:00
Matthew Waters
519280204c glcolorconvert: implement usage of a buffer pool
Saves unnecessary glGenTextures and glDeleteTextures which may have a
non-trivial cost.
2016-01-06 16:48:33 +11:00
Matthew Waters
37264a86e1 glbasememory: fix copying GstGLAllocationParams
Fixes a GST_IS_GL_CONTEXT critical
2016-01-06 16:48:33 +11:00
Matthew Waters
8d34c91855 glmemorypbo: remove unused code
https://bugzilla.gnome.org/show_bug.cgi?id=759679
2016-01-06 16:48:33 +11:00
Matthew Waters
479dcdc3b4 glupload: always add texture-target field to GL caps
1. Various elements/base classes only perform a subset check on accept-caps
2. Some GL elements have texture-target in their pad template
3. When checking subsets, only the caps to check are allowed to contain extra
   fields.  If the 'template' caps have extra fields, the subset fails.
Thus without texture-target on the caps, various accept-caps implementations
were failing.

Also, add some convenience functions for setting and retrieving
texture targets to/from GValue.

https://bugzilla.gnome.org/show_bug.cgi?id=759860
2016-01-05 13:28:19 +11:00
Matthew Waters
65f03061ad glupload: passthrough composition caps features
Don't unconditionally add it to any and all caps transformations.

https://bugzilla.gnome.org/show_bug.cgi?id=759860
2016-01-05 13:28:19 +11:00
Jan Schmidt
40b0736dfd glviewconvert: Fix stereoscopic handling w/ texture-target
The addition of texture-target negotiation broke stereoscopic
handling when not in passthrough mode, so fix that.
2016-01-04 01:04:23 +11:00
Matthew Waters
4717b48a03 glmemorypbo: fix wrapping data on GL 2.1
GL 2.1 only supports pbo upload.

The wrapped data pointer was only being set on the pbo memory and on the
glmemory so when a download was requested (in GL 2.1), glmemory was
allocating a new data pointer and thus not returning the wrapped data.
2015-12-30 12:16:29 +11:00
Matthew Waters
49291bc927 glmemorypbo: only create a pbo memory if the context actually supports it
e.g. GL <= 2.0 does not support pbo usage and GL 2.1 only supports pbo upload.
2015-12-30 12:16:29 +11:00
Matthew Waters
6917b3b35a glmemory: small code reformat
makes the alloc_params selections fit on a single line.
2015-12-30 12:16:29 +11:00
Sebastian Dröge
aaa660ac9d glbasememory: Remove bogus NULL check
CID 1346534
2015-12-29 18:01:30 +02:00
Sebastian Dröge
22a0914cce gl: Add \0 terminators for the Apple sync extension
Otherwise GL initialization might check for extensions forever and never finishes.
2015-12-28 15:53:59 +02:00
Sebastian Dröge
3d0257e1b6 glcontext: Add some debug output when the GL thread is actually running 2015-12-28 14:41:59 +02:00
Vineeth TM
572b9788f5 glbufferpool: Fix build error
When GST_GL_HAVE_PLATFORM_EGL is not defined, then info variable
will not be used and this results in build error

https://bugzilla.gnome.org/show_bug.cgi?id=759913
2015-12-27 21:54:50 -05:00
Sebastian Dröge
c4e5423f3b glmemorypbo: Comment out unused functions to fix compilation with clang
It's not clear if these are intentionally unused or the code should be
changed, but this fixes compilation for the time being at least.

See https://bugzilla.gnome.org/show_bug.cgi?id=759679
2015-12-23 09:51:05 +01:00
Sebastian Dröge
626bcccff9 glcontext: Signal context creation from inside the context loop and use g_thread_join() instead of a custom condition variable
Also protect against spurious condition variable wakeups during context
creation.
2015-12-21 12:16:35 +01:00
Sebastian Dröge
d81eea5de1 glwindow: Hide navigation specific internal API and add API to asynchronously send navigation events
Exposing the navigation thread's main context, GSourceFuncs and structs called
key_event and mouse_event is exposing a bit too much of the internals. Let's
just go with two functions to asynchronously send navigation events on the
window with the same API as the synchronous ones.
2015-12-21 11:27:09 +01:00
Sebastian Dröge
0952b3f986 glwindow: Use g_thread_join() instead of a custom condition variable for waiting for the navigation thread to finish
Also hide some internal functions and fields while we're at it and fix
a race condition with the startup condition variable.
2015-12-21 11:09:04 +01:00
Haihua Hu
62d79ae326 glwindow: Fix memory leak of navigation thread
When stopping the navigation thread, call g_thread_join() to release
the resources hold by it.

https://bugzilla.gnome.org/show_bug.cgi?id=758820
2015-12-21 10:42:41 +01:00
Nicolas Dufresne
937e249b44 glconvert: Fix compilation of GRAY16_LE/BE shader 2015-12-18 15:56:34 -05:00
Nicolas Dufresne
420a175b4f glupload: Add dmabuf upload method.
This upload method detect and optimize uploads of DMABuf memory. This is
done by creating and caching EGLImages wrapper around DMABuf. The
EGLImages are then binded to a texture which get converter using
standard shader.

Example pipeline:

GST_GL_PLATFORM=egl \
gst-launch-1.0 v4l2src device=/dev/video1 io-mode=4 ! \
               video/x-raw,format=NV12 ! glimagesink

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Nicolas Dufresne
7b335c4dd5 eglimagememory: Also import BGR16, ABGR, xBGR, AYUV, GRAY16_LE/BE and Y444
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Nicolas Dufresne
b17a732d5f eglimagememory: Add RGB/BGR DMABuf importation support
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Lubosz Sarnecki
1cd9786598 eglimagememory: Methods to create GstGLMemory from dmabufs
Maps GstVideoFormats to suitable DRM fourccs which work with
glcolorconvert, using gst_gl_memory_alloc(). We require mostly
only 4 formats to be supported by the driver. We require DRM
equivalent to RGB16, RGBA, R8 and RG88. This way it's compatible with
DesktopGL, since GL_TEXTURE_2D is used and limit driver requirements.
With this we can virtually support all formats the glcolorconvert
supports.

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Lubosz Sarnecki
41738ca83b build: Add dmabuf build condition.
configure.ac: Build dmabuf when EGL and drm_fourcc.h is available.
gl: Link gst-allocators.

https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:34 -05:00
Lubosz Sarnecki
eb73cf3c2e gstglcontext_egl: Expose gst_gl_context_egl_get_error_string.
https://bugzilla.gnome.org/show_bug.cgi?id=743345
2015-12-18 15:56:33 -05:00
Alessandro Decina
6961945110 glmemory: add gst_gl_memory_allocator_get_default
Add gst_gl_memory_allocator_get_default to get the default allocator based on
the opengl version. Allows us to stop hardcoding the PBO allocator which isn't
supported on gles2.

Fixes GL upload on iOS9 among other things.
2015-12-18 14:25:32 +11:00
Matthew Waters
d8dacd50bf glbasememory: don't unconditionally add the alignment bytes to the size
e.g when wrapping a data pointer we don't want to map/unmap off the end of
pointer with the alignment bytes.

Instead track that information separately as maxsize is used for mapping by
GstMemory and thus represents a size without any alignment padding bytes.
2015-12-18 01:02:25 +11:00
Matthew Waters
4d88848fae glbuffer: add a name to the allocator 2015-12-17 15:50:40 +11:00
Matthew Waters
5dcd500257 gl*memory*: reverse the parameter order of user_data and destroy notify
The convention is to have the destroy notify last after any user data
2015-12-17 15:44:22 +11:00
Matthew Waters
779dc3132c glmemorypbo: remove our own alloc()/wrapped()/etc functions
replaced by equivalent functionality within gst_gl_base_memory_alloc()
2015-12-17 13:49:56 +11:00
Matthew Waters
78fb4326eb glmemory: document gst_gl_memory_init 2015-12-17 13:49:56 +11:00
Matthew Waters
9fa1dd2e29 glbuffer: remove unneeded gst_gl_buffer_alloc()
Replaced by gst_gl_base_memory_alloc()
2015-12-17 13:49:56 +11:00
Matthew Waters
b8b4d8db51 glbasememory: document some functions 2015-12-17 13:49:56 +11:00
Matthew Waters
3aaec5b1d6 glmemory: add a default copy implementation
Subclasses still need to override this to copy into the correct memory type.
2015-12-17 13:49:56 +11:00
Matthew Waters
7c90b0435d glbufferpool: use gst_gl_base_memory_alloc as a generic GL allocation framework
Requires the usage of GstGLVideoAllocationParams however any user can set their
own parameters along with an allocator which will be used to allocate the
correct memory type.
2015-12-17 13:49:56 +11:00
Matthew Waters
d2c5fc3e87 glmemorypbo: implement GstGLBaseMemory:alloc
Uses the GstGLVideoAllocationParams parameters
2015-12-17 13:49:56 +11:00
Matthew Waters
bfb4c446bc glbuffer: implements GstGLBaseMemory::alloc
Create GstGLBufferAllocationParams which is subclass of GstGLAllocationParams
2015-12-17 13:49:56 +11:00