Commit graph

45 commits

Author SHA1 Message Date
Matthew Waters
989200820d glmemory: add the texture type to allocate to parameters
Rather than assuming something.  e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
2016-06-29 18:04:28 +10:00
Matthew Waters
5498e97a11 gl/egl: replace gsteglimagememory with an EGLImage wrapper
That can be passed to GstGLMemoryEGL.

This also ports the dmabuf uploader to GstEGLImage and GstGLMemoryEGL.
2016-05-04 13:31:48 +10:00
Matthew Waters
8ccf3dc589 glmemory: add wrapped data pointers to setup_buffer
Allows creating wrapped memories with GstGLAllocationParams.

The wrapped pointers will be set in the parameters before being passed
to the memory allocation function.
2016-05-04 12:51:59 +10:00
Matthew Waters
23806d4953 gl: misc docs fixes/additions 2016-03-06 19:36:17 +11:00
Sebastian Dröge
2018167ee2 Revert "glpool: fix caps refcount issue"
This reverts commit 3bdcdedfa0.

gst_caps_replace() takes a new reference already, if there is a problem then
it is elsewhere. And there are a few problems, see
https://bugzilla.gnome.org/show_bug.cgi?id=760696
2016-01-16 16:55:42 +02:00
Matthew Waters
3bdcdedfa0 glpool: fix caps refcount issue
The caps are from an allocation query which are transfer none but were being
treated as transfer full.
2016-01-15 14:00:56 +11: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
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
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
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
Matthew Waters
3591c6bfa0 gluploadmeta; remove convenience helper API
It was not really useful as if one knows about libgstgl, one can just use
GLMemory objects directly.
2015-12-14 13:55:16 +11:00
Alessandro Decina
11ca761c5d glbufferpool: relax check for multiple texture targets
Only complain about multiple texture targets when _different_ texture targets
are configured.
2015-12-10 14:46:27 +11:00
Matthew Waters
dd738842e4 glbufferpool: explicitly initialize a possibly uninitialized variable
The ret variable may be uninitialized and so its contents were undefined and
the results were erratic (failing with glvideomixer, succeeding in other cases)

P.S. No idea why gcc/clang et al never picked up on this like they normally do
(probably due to some optimisation pass figuring out it's only set once...)
2015-10-31 23:32:55 +11:00
Matthew Waters
b429654a37 glbufferpool: add bufferpool options for the various texture targets
This was chosen over relying solely on the caps as glupload needs to propose an
allocation and set the texture target based on the output caps.  Setting the
caps in the config is currently pointless as they are overwritten in a lot of
element's decide_allocation functions.

This provides a mechanism for the buffer pool to be configured for a certain
texture target when none has been configured.
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
Tim-Philipp Müller
fe8de1857a gl: bufferpool take into account video stride alignment requirements
when allocating memory. Fixes crashes with avdec_h265 in the AVX2
code path which requires 32-byte stride alignment, but the
GstAllocationParams only specified a 16-byte alignment.

https://bugzilla.gnome.org/show_bug.cgi?id=754120
2015-09-15 16:11:23 +01:00
Matthew Waters
0ee027b6ee gl/docs: update some doc comments 2015-03-18 10:13:25 -07:00
Nicolas Dufresne
283aca3b51 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
2015-03-01 09:43:32 -05: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
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
Nicolas Dufresne
207308446b glbufferpool: Always recalculate buffer size
Actually we should always recalculate buffer size since our buffer size
even when not-padded is smaller for many sub-sampled formats. This is
because we don't add padding between the planes.

https://bugzilla.gnome.org/show_bug.cgi?id=740900
2014-12-19 12:25:41 -05: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
Matthew Waters
f2af65ee2d gl: add a sync meta for synchronizing across GL contexts
A context can create a GLsync object that can be waited on in order
to ensure that GL resources created in one context are able to be
used in another shared context without any chance of reading invalid
data.

This meta would be placed on buffers that are known to cross from
one context to another.  The receiving element would then wait
on the sync object to ensure that the data to be used is complete.
2014-11-28 09:14:25 +11:00
Matthew Waters
2e49c99db3 glbufferpool: add the GstVideoGLTextureUploadMeta buffer pool option 2014-10-21 02:00:09 +11:00
Tim-Philipp Müller
21e6989848 glbufferpool: fix allocator leak in some cases
Spotted by Sebastian Rasmussen.

https://bugzilla.gnome.org/show_bug.cgi?id=734523
2014-08-13 18:05:40 +03:00
Matthew Waters
838fd776cf glbufferpool: provide a consistent API regardless of platform 2014-06-22 09:48:22 +10:00
Matthew Waters
6ce3b82efe gl/upload: add GstGLUploadMeta object
That simply deals with the provider aspect of GstVideoGLTextureUploadMeta.
2014-05-28 14:41:35 +10:00
Matthew Waters
a49a371710 gl/upload: implement lazy init
Rename init_format to set_format
2014-05-08 15:33:43 +10:00
Julien Isorce
2115f11f0b gl: no need to initialize a frame buffer object to upload an eglimage
Fix https://bugzilla.gnome.org/show_bug.cgi?id=729588
2014-05-06 15:39:12 +01:00
Matthew Waters
b903c61ceb gl/pool: init the upload object on start
Theoretically, set_config could be called multiple times
2014-05-02 14:16:49 +10:00
Julien Isorce
453245304d gl/bufferpool: do not reset upload when set_config does not change the caps
With videotestsrc ! glimagesink it was reset 3 times
2014-04-23 21:10:03 +01:00
Matthew Waters
15d0c04933 gl/mem: allocate the memory per plane
This patch provides the basic infrastructure required for this.
Upload and Download has been ported to this.

Has the nice effect of allowing GstGLMemory to be our
refcounted texture object for any texture type (not just RGBA).

Should not lose any features/video formats.
2014-04-11 10:37:06 +10:00
Matthew Waters
e01e2cce9f gl: pass video info's by reference 2014-04-02 23:05:47 +11:00
Julien Isorce
0ae3c984aa gl: add EGLImage support
* picked from old libgstegl:
  - GstEGLImageMemory
  - GstEGLImageAllocator
  - last_buffer management from removed GstEGLImageBufferPool

* add-ons:
  - GstEGLImageMemory now old a reference on GstGLContext
    so that it can delete the EGLImage and its gltexture source
    while having the associated gl context being current.
  - add EGLImage support for GstVideoGLTextureUploadMeta which
    mainly call EGLImageTargetTexture2D
  - GstGLBufferPool now supports GstEGLImageAllocator
  - glimagesink / glfilters / etc.. now propose GstEGLImageAllocator
    to upstream

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2014-03-26 19:09:13 +00:00
Matthew Waters
cd7bfb92d4 [876/906] glmem: use GstVideoInfo for format configuration
Allows use of strides
2014-03-15 18:37:06 +01:00
Matthew Waters
f798d9c9b7 [855/906] upload: add support for GstVideoGLTextureUploadMeta 2014-03-15 18:37:04 +01:00
Matthew Waters
9b22b0e0ba [812/906] move the GL vtable from GstGLDisplay to GstGLContext
Conflicts:
	tests/check/libs/gstglcontext.c
2014-03-15 18:37:02 +01:00
Julien Isorce
dd7e054e2c [732/906] build: fix repeated typedefs
Write forward declarations in another way to avoid
repeated typedefs "error: redefinition of typedef".
Raised when using i686-apple-darwin11-llvm-gcc-4.2
It seems that C apple compiler does not support
C11 feature.

https://bugzilla.gnome.org/show_bug.cgi?id=703885
2014-03-15 18:36:57 +01:00
Matthew Waters
13067b104c [704/906] Use gst_object_[un]ref so we can get refcounts in the log 2014-03-15 18:36:56 +01:00
Matthew Waters
93f7e993ad [603/906] update FSF address 2014-03-15 18:36:50 +01:00
Matthew Waters
12bf1cfa27 [600/906] docs: add docs for new objects and expand on some existing ones 2014-03-15 18:36:49 +01:00
Matthew Waters
28863c4bb4 [586/906] fix up some debug statements to get them into the right categories 2014-03-15 18:36:49 +01:00
Matthew Waters
558e10be0f [580/906] bufferpool: remove obselete gl meta buffer pool options 2014-03-15 18:36:48 +01:00
Matthew Waters
8f4c270ae1 [576/906] remove uneeded GstGLMeta (use GstVideoMeta) 2014-03-15 18:36:48 +01:00
Matthew Waters
69997e311f [517/906] add GstGLBufferPool
which adds GstGLMeta to buffers
2014-03-15 18:36:45 +01:00