Commit graph

130 commits

Author SHA1 Message Date
Alessandro Decina
c1720963e4 glupload: fix allocator name after GLMemory API changes 2015-12-16 17:03:03 +11:00
Matthew Waters
2b7495bbc1 glmemory: base classify and add the pbo memory on top
The base class is useful for having multiple backing memory types other
than the default.  e.g. IOSurface, EGLImage, dmabuf?

The PBO transfer logic is now inside GstGLMemoryPBO which uses GstGLBuffer
to manage the PBO memory.

This also moves the format utility functions into their own file.
2015-12-14 16:35:32 +11:00
Nicolas Dufresne
d84d1708b7 glupload: Only offer custom allocator with caps features
To use GLMemory and EGLImage allocators, one need to know the
libgstgl API. This is only expected if the associated caps features
have been negotiated. Generic element that otherwise receive those
allocators may fail, resulting in broken pieline. We don't want to
force all generic element to check if the allocator is a custom
allocator or a normal allocator (which implement the _alloc method).

https://bugzilla.gnome.org/show_bug.cgi?id=758877
2015-12-04 17:08:46 -05:00
Matthew Waters
d707038101 glupload: explicitly configure the texture target on the gl buffer pool
If we don't, then the pool could end up allocating 2D textures when the
caps explictly state they should be rectangle textures.
2015-10-30 14:24:54 +11:00
Matthew Waters
e61d504556 glmemory: add support for rectangle textures
Add the various tokens/strings for the differnet texture types (2D, rect, oes)

Changes the GLmemory api to include the GstGLTextureTarget in all relevant
functions.

Update the relevant caps/templates for 2D only textures.
2015-10-30 14:24:53 +11:00
Matthew Waters
49e6516550 glupload: remove useless release_buffer
It's a leftover from when we weren't outputting GstBuffer's and
returning raw texture id's.
2015-09-30 13:36:09 +10:00
Nicolas Dufresne
a31a753bfd glupload: Recalculate offset and size in raw upload
As we only expose the mapped portion of the frame into the GL
memory object (and not the original padding) we need to
re-calculate the size and offset.
2015-08-16 18:13:27 +02:00
Nicolas Dufresne
f935b2c547 glsink: Enable sync meta on pools we offer
As the upload is asynchronous, we need to enable the sync meta to
gain correct rendering. The buffer pool receiver don't know about
that.
2015-08-15 15:55:08 +02:00
Sebastian Dröge
b21f01276c glupload: Remove debug output from gst_gl_upload_transform_caps()
We can't know if the GstGLUpload type is initialized at this point already,
and thus our debug category might not be initialized yet... and cause an
assertion here.

As we don't print debug output for any of the other transform functions, let's
defer this problem for now.
2015-07-29 19:11:58 +01:00
Nicolas Dufresne
f79cad55e2 glupload: Add fixme about using bufferpool for raw
http://bugzilla.gnome.org/show_bug.cgi?id=752937
2015-07-28 08:59:48 -04:00
Nicolas Dufresne
adbd9d3c05 glupload: Keep input frame mapped as long as needed
When performing a raw upload, we need to keep the raw data mapped as
long as needed.

https://bugzilla.gnome.org/show_bug.cgi?id=752937
2015-07-28 08:54:29 -04:00
Nicolas Dufresne
eb4d3c352a Revert "glupload: memcpy on raw data upload"
This reverts commit 82c0189b28.

https://bugzilla.gnome.org/show_bug.cgi?id=752937
2015-07-28 08:54:29 -04:00
Jan Schmidt
45f8a27211 glupload: Check that caps contain desired caps features
Use 'contains' checks instead of equality checks on caps features
to allow for uploading when caps also contain GstVideoOverlayComposition
meta.

https://bugzilla.gnome.org/show_bug.cgi?id=752912
2015-07-27 17:21:33 +10:00
Luis de Bethencourt
7ecf6b0d6c glupload: fix memory leak
GstCapsFeatures need to be freed with gst_caps_features_free() after use.

CID #1312136, CID #1312136
2015-07-23 10:58:21 +01:00
Lubosz Sarnecki
6eaeefc6a9 glupload: Detect overlay meta buffers correctly
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2015-07-20 14:41:12 -04:00
Lubosz Sarnecki
a7d1b7fcad glimagesinkbin: Add GstVideoOverlayCompositionMeta caps features
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2015-07-20 14:41:12 -04:00
Lubosz Sarnecki
60c8b73cf5 glupload: Move debug init to top of the file
https://bugzilla.gnome.org/show_bug.cgi?id=745107
2015-07-20 14:06:29 -04:00
Matthew Waters
82c0189b28 glupload: memcpy on raw data upload
Anything else requires keeping track of the GstVideoFrame mapping
across possible multiple buffers to ensure correct data pointer
usage.
2015-07-14 17:49:17 +10:00
Nicolas Dufresne
fe283a9aeb gl: Don't leak pool if set_config failed 2015-07-02 09:40:05 -04:00
Matthew Waters
c3a47c910d glmemory: separate pbo transfer from texture transfers
When supported, the potentially longer pbo upload/download can be
initiated before the texture upload/download, potentially increasing
throughput.
2015-06-12 16:59:20 +10:00
Matthew Waters
7d8d1f8206 glmemory: implement on top of glbasebuffer
Provides convenient access to PBO usage.

Currently texture updates are coupled tightly to data transfers.
2015-06-12 16:59:20 +10:00
Jan Schmidt
e2ce1eff36 gl: Add support for multiple views in upload, colour convert and download
Support multiple attached views on input/output buffers
by processing each one, not just the first.
2015-06-12 00:39:15 +10:00
Jan Schmidt
c9372ae33f glupload: Don't leak all memory uploaded via raw uploads.
Remove an extra ref missed when switching over to not
reusing output textures
2015-05-22 00:28:25 +10:00
Matthew Waters
2747eb1232 glupload: don't reuse output textures for raw data upload
Causes stale textures to be used further down the chain.
2015-05-20 00:36:48 +10:00
Jan Schmidt
1de2e2bc39 glupload: Make upload method static caps non-const.
Retrieving a GstStaticCaps does a one time internal
initialisation and caches it - they can't be stored as
const structures.
2015-04-29 02:52:40 +10:00
Matthew Waters
0b7f65bbc3 glupload: provide the sink template caps that could be used
https://bugzilla.gnome.org/show_bug.cgi?id=746399
2015-04-28 20:13:48 +10:00
Matthew Waters
0ee027b6ee gl/docs: update some doc comments 2015-03-18 10:13:25 -07:00
Víctor Manuel Jáquez Leal
d925e7fd19 glupload: move meta-data copy into gst-gl library
In some upload implementations the out buffer has more than one references,
turning the buffer not writable, so it won't be possible to modify its
meta-data.

This patch moves the meta-data copy before increasing the reference of the out
buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=746173
2015-03-14 19:53:02 +00:00
Matthew Waters
773f9fa6ff glupload: unref the bufferpool 2015-03-13 12:40:04 +00:00
Matthew Waters
0c800027ba glupload: implement propose_allocation pool handling for glmemory upload 2015-03-12 16:45:50 +00:00
Sebastian Dröge
90967b3d45 glupload: Simplify caps feature setting code 2015-03-06 18:53:13 +01:00
Nicolas Dufresne
b8f168cd65 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
2015-02-28 14:32:39 -05:00
Matthew Waters
03b5288f64 glupload: perform egl upload on the gl thread
Fixes EGLImage usage on raspberry pi

https://bugzilla.gnome.org/show_bug.cgi?id=743914
2015-02-28 18:29:52 +11:00
Víctor Manuel Jáquez Leal
75e875b022 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
2015-02-26 14:39:32 +02:00
Edward Hervey
f09272f434 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
2015-02-12 15:57:55 +01:00
Matthew Waters
5432308012 glupload: restrict EGL and UploadMeta to RGBA
other formats are highly untested.
2015-02-05 11:07:19 +11:00
Matthew Waters
73c2ab70fc glupload: only try the glmemory upload for sysmem/glmemory caps features
Allows selecting/testing the upload path with explicit caps features.
2015-02-03 14:32:55 +11:00
Matthew Waters
b947c9805a glupload: allow NULL buffer for accept vfunc 2015-02-03 14:32:55 +11:00
Matthew Waters
917dcfdfee glupload: remove unsed convert field in private struct 2015-02-03 14:32:55 +11:00
Matthew Waters
c06715bde6 glupload/download/convert: provide transform_caps functions
Allows finer grain decisions about formats and features at each
stage of the pipeline.
Also provide propose_allocation for glupload besed on the supported
methods.
2015-02-03 14:32:55 +11:00
Sebastian Dröge
80e02cbdf9 Constify some static arrays everywhere 2015-01-21 10:18:50 +01:00
Matthew Waters
d5c3693791 gl: split glcolorconvert usage from glupload
the separation allows the transfer operation to occur in a separate
thread/time which may increase performance in specific circumstances.
2015-01-14 22:22:13 +11:00
Matthew Waters
8c2d5dac72 glupload: relax the GLMemory uploader check for input caps features
As there may be a sysmem caps features with GLMemory filled buffers.
e.g.

videotestsrc ! glimagesink
2015-01-14 22:22:13 +11:00
Nicola Murino
3c6d775766 glupload: fix some memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2015-01-13 15:19:39 +11:00
Nicolas Dufresne
9954de1ccd gl: Add support for GstVideoAlignment
This allow saving a copy with libav video decoders or decoders with
similar padding requirement.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 12:11:08 -05:00
Sebastian Dröge
0f753b7099 glupload: Fix valid compiler warning
gstglupload.c:442:32: error: if statement has empty body [-Werror,-Wempty-body]
    if (upload->texture_ids[i]);
                               ^
2014-11-24 11:32:33 +01:00
Matthew Waters
810d38c29f glupload: rearchitecture for non GLMemory inputs/outputs
Allows other memory types to be implemented/returned/used by the caller.
2014-11-23 17:13:36 +11:00
Matthew Waters
82a3a34475 glupload: fallback to upload if contexts cannot share GL resources
Fixes pipelines of the form

    gleffects ! tee ! glimagesink

as tee does not pass on the allocation query.
2014-09-23 12:02:18 +10:00
Matthew Waters
5b8d7a443e glupload: provide the output buffer that is rendered into
Allows callers to properly reference count the buffers used for
rendering.

Fixes a redraw race in glimagesink where the previous buffer
(the one used for redraw operations) is freed as soon as the next
buffer is uploaded.

1. glimagesink uploads in _prepare() to texture n
1.1 glupload holds buffer n
2. glimagesink _render()s texture n
3. glimagesink uploads texture n+1
3.1 glupload free previous buffer which deletes texture n
3.2 glupload holds buffer n+1
4. glwindow resize/expose
5. glimagesink redraws with texture n

The race is that the buffer n (the one used for redrawing) is freed as soon as
the buffer n+1 arrives.  There could be any amount of time and number of
redraws between this event and when buffer n+1 is actually rendered and thus
replaces buffer n as the redraw source.

https://bugzilla.gnome.org/show_bug.cgi?id=736740
2014-09-21 21:36:49 +10:00
Wang Xin-yu (王昕宇)
ba822e1dd0 glupload: don't determine if frame needs upload by pointer compare
https://bugzilla.gnome.org/show_bug.cgi?id=734269
2014-08-06 14:47:52 +10:00