Commit graph

115 commits

Author SHA1 Message Date
Matthew Waters e252c908e7 glfilter: support fixed dimensions on both sides of the element
Fixes:

  width=320,height=240 ! glfilter ! width=800,height=600
  width=230,height=240 ! glfilter ! width=600
  ... ! glfilter ! width=800
2017-12-09 19:31:50 +00:00
Matthew Waters 00506bf183 glupload: rearchitecture for non GLMemory inputs/outputs
Allows other memory types to be implemented/returned/used by the caller.
2017-12-09 19:31:50 +00:00
Matthew Waters e731762984 glfilter: add read-only context property 2017-12-09 19:31:50 +00:00
Matthew Waters af9b73043e gl: remove the width/height fields from the caps to support frame resizing
It was previously only occuring with sysmem caps features

https://bugzilla.gnome.org/show_bug.cgi?id=739334
2017-12-09 19:31:49 +00:00
Matthew Waters 59e4a039c9 glfilter: get the config from the correct pool 2017-12-09 19:31:48 +00:00
Matthew Waters cc2e0a7288 glfilter: avoid uninitialized variable size when chaining multiple glfilters
https://bugzilla.gnome.org/show_bug.cgi?id=739277
2017-12-09 19:31:48 +00:00
Matthew Waters f1dddf4f6b glfilter: gst-indent file 2017-12-09 19:31:48 +00:00
Matthew Waters 62e3c40d97 gl: propogate other-context using GstContext 2017-12-09 19:31:48 +00:00
Matthew Waters 0806de5c75 glbufferpool: add the GstVideoGLTextureUploadMeta buffer pool option 2017-12-09 19:31:48 +00:00
Matthew Waters 6663967994 glfilter: add uploaded_buffer field 2017-12-09 19:31:48 +00:00
Matthew Waters 80be2d046b glfilter: silence a warning with empty input caps
discovered with the doublecube example

gst_caps_get_features: assertion 'index < GST_CAPS_LEN (caps)' failed
2017-12-09 19:31:47 +00:00
Matthew Waters ae919f4475 gl: download whenever we have sysmem capsfeatures
Otherwise we could pass on a RGBA formatted buffer and downstream would
misinterpret that as some other video format.

Fixes pipelines of the form

    gleffects ! tee ! xvimagesink
2017-12-09 19:31:46 +00:00
Anuj Jaiswal e9e84da30a gl: consecutive return, break statement
Signed-off-by: Anuj Jaiswal <anuj.jaiswal@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=736939
2017-12-09 19:31:46 +00:00
Matthew Waters 6491af9ffc 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
2017-12-09 19:31:46 +00:00
Ognyan Tonchev 7e21e35eac glfilter: do not leak pool in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=736732
2017-12-09 19:31:46 +00:00
Wang Xin-yu (王昕宇) 2ce11e4bac gl: fix multi gl object leaks
1. fix FBO leaks in decide_allocation
2. fix texture leaks in decide_allocation and reset
3. fix texture leaks in FBO incomplete error path
2017-12-09 19:31:44 +00:00
Matthew Waters 730b88a677 glfilter: pass through the allocation query when in passthrough mode
Otherwise two GL elements on either side will fail to use the same
GL context.
2017-12-09 19:31:44 +00:00
Matthew Waters 3a20e70cbd glfilter: prefer passthrough for non-sysmem caps 2017-12-09 19:31:43 +00:00
Julien Isorce 7cdce1bdfc glfilter: handle NULL decide_query which means passthrough
See https://bugzilla.gnome.org/show_bug.cgi?id=732178
2017-12-09 19:31:43 +00:00
Julien Isorce e016324d31 glfilter: prepend intersection to src caps
Prefer to stay in the same memory space if possible.
Also it let a chance to do passthrough.

See https://bugzilla.gnome.org/show_bug.cgi?id=732178
2017-12-09 19:31:43 +00:00
Matthew Waters 30a9843c02 gl/filter: also remove the width/height in transform_caps
allows scaling in the filters
2017-12-09 19:31:42 +00:00
Matthew Waters 32343333aa gl/upload: add GstGLUploadMeta object
That simply deals with the provider aspect of GstVideoGLTextureUploadMeta.
2017-12-09 19:31:41 +00:00
Nicolas Dufresne d85c344204 glfilter: Remove format information to allow color convert again
We also need to remove the format information,  as glfilter can do
color convertion. This code was imported from videoconvert.

https://bugzilla.gnome.org/show_bug.cgi?id=729861
2017-12-09 19:31:41 +00:00
Matthew Waters 9cfd5e5d04 gl/filter: fixup passthrough bufferpool
In a pipeline like so:
  videotestsrc ! gleffects ! videoconvert ! sink
gleffects was simply passing the videoconvert bufferpool to videotestsrc
and not creating a glbufferpool. videobufferpool would then fail
to allocate from the glallocator.
2017-12-09 19:31:41 +00:00
Matthew Waters 51fdeef98b gl/eglimage: add eglimage context feature
Allows us to selectively use EGLImages only when available

https://bugzilla.gnome.org/show_bug.cgi?id=728234
2017-12-09 19:31:41 +00:00
Matthew Waters 9172cb8839 gl/download: update to be similar to the glupload semantics 2017-12-09 19:31:40 +00:00
Nicolas Dufresne b4a0a26ddd glfilter: Fix building without EGL support
This fixes the OSX build and any builds with --disable-egl. That issue
was introduced in "glfilter: rewrite transform_caps to preserve caps fields".

https://bugzilla.gnome.org/show_bug.cgi?id=729861
2017-12-09 19:31:40 +00:00
Julien Isorce a7156df9f4 glfilter: rewrite transform_caps to preserve caps fields
https://bugzilla.gnome.org/show_bug.cgi?id=729861
2017-12-09 19:31:40 +00:00
Matthew Waters 6c1a4e30c4 gl/upload: implement lazy init
Rename init_format to set_format
2017-12-09 19:31:39 +00:00
Matthew Waters 6e5494d729 gl/filter: attempt to passthrough the pool if the caps are the same
Reduces the number of glbufferpool instances required for >=2
consecutive GL elements in a pipeline.
2017-12-09 19:31:39 +00:00
Matthew Waters 6872ad5ff5 gl/filter: always initialize the upload object 2017-12-09 19:31:39 +00:00
Matthew Waters 8fd450b941 gl: advertise GstGLMemory usage in the caps as capsfeatures
https://bugzilla.gnome.org/show_bug.cgi?id=729658
2017-12-09 19:31:39 +00:00
Matthew Waters bf9c8544e3 gl: use the bufferpool's upload when available
Avoids duplicating GL resources

https://bugzilla.gnome.org/show_bug.cgi?id=728872
2017-12-09 19:31:39 +00:00
Julien Isorce 391661b626 gl: use gst_gl_platform_from_string because we support gl shareList on all platforms 2017-12-09 19:31:38 +00:00
Julien Isorce c441afdc6b glfilter: only warn when other_context attribute is set
Fix false positive
2017-12-09 19:31:38 +00:00
Matthew Waters 30c6efc432 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.
2017-12-09 19:31:36 +00:00
Matthew Waters fba49c3463 gl: add colorconvert object that converts between color spaces/formats
Currently used by both upload and download objects separately.
2017-12-09 19:31:36 +00:00
Matthew Waters a20a5d36e2 gl: pass video info's by reference 2017-12-09 19:31:35 +00:00
Matthew Waters 71548893bf gl: avoid adding a NULL pool to propose allocation 2017-12-09 19:31:35 +00:00
Julien Isorce 0233939eaa gl: only set CAPS_FEATURE_MEMORY_EGL_IMAGE on egl platform 2017-12-09 19:31:35 +00:00
Julien Isorce 6614df6478 gl: let the user includes itself our egl headers if needed
Forgot to address this change.

https://bugzilla.gnome.org/show_bug.cgi?id=703343
2017-12-09 19:31:35 +00:00
Julien Isorce c2471aec81 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
2017-12-09 19:31:35 +00:00
Matthew Waters a9070713a2 gl: silence a critical if upstream does not provide us with meta params 2017-12-09 19:31:35 +00:00
Matthew Waters 4a18aa4b70 [906/906] filter: warn about trying to share with multiple contexts at once 2017-12-09 19:31:34 +00:00
Matthew Waters 3f5b68b072 [905/906] Add GL context sharing support for non-gstgl elements 2017-12-09 19:31:34 +00:00
Matthew Waters 3c9f5e6e5e [886/906] fixup a memory leak of the context in the GLTextureUploadMeta path
gst_structure_get returns a reference to the object and we asked
for another with gst_object_replace.

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters c2e1e6a2d1 [885/906] filter: free our data
plugs some memory leaks

https://bugzilla.gnome.org/show_bug.cgi?id=724816
2017-12-09 19:31:33 +00:00
Matthew Waters f292e785ce [884/906] filter: return the pad template caps in transform_caps
We can transform from any input in our caps to any output.
With the following pipeline snippet:

  ... ! vaapidecode ! glcolorscale ! xvimagesink

GstVideoGLTextureUploadMeta was being used on both src and sink
pads causing linking to fail.  This allows the usage of the meta
on either pad without affecting whether the meta is chosen on the
other pad.
2017-12-09 19:31:33 +00:00
Matthew Waters 8daa7693cf [874/906] filter: implement draw_texture for GLES2
(taken from gleffects)
2017-12-09 19:31:33 +00:00
Matthew Waters 2eb7938db9 [873/906] upload: use GstVideoInfo for choosing the format 2017-12-09 19:31:33 +00:00