Commit graph

149 commits

Author SHA1 Message Date
Matthew Waters 3ba30d42a4 gl: use gles2 shaders everywhere
This effectively limits a glfilter subclass to be > GL(ES) 2.0.
rather than a possible GL 1.4.
2017-12-09 19:32:07 +00:00
Nicolas Dufresne 79d5bbdc35 glfilter: Don't cache buffer pool
Caching and sharing to multiple element the same pool prevents
renegotiation from passthrough to not passthrough.
2017-12-09 19:32:05 +00:00
Jan Schmidt 5007311198 glfilter: Add transform_internal_caps() vfunc
Add a vfunc that is called by glfilter before it sets
caps features and intersects with the peer caps, and
move removing the size from caps into its default
implementation. Allows sub-classes to do more
sophisticated management of the size fields in case they
don't support arbitrary resizing or have distinct
preferences.
2017-12-09 19:32:03 +00:00
Jan Schmidt 697107fe7d glfilter: Don't remove size fields from caps
Instead of removing size fields, set them to the full range
like videoscale does, so the caps are clearly unfixed in
all cases.
2017-12-09 19:32:03 +00:00
Xavier Claessens 840157230d gl: propagate return value from filter and filter_texture
https://bugzilla.gnome.org/show_bug.cgi?id=749846
2017-12-09 19:32:02 +00:00
Matthew Waters 72993f54fa gl: remove useless gl{En,Dis}able (GL_TEXTURE_*) calls
We are using shaders everywhere and so they are not needed
2017-12-09 19:32:01 +00:00
Matthew Waters 65c57b77ff gl: element buffers are part of vao state
Use them as such.  They are also required for GL3 core profile support
with glDrawElements on OS X.
2017-12-09 19:32:01 +00:00
Sebastian Dröge 51d3a0a059 Revert "gl: readd glupload/download onto element pads"
This reverts commit 87d8270f30.
2017-12-09 19:32:00 +00:00
Matthew Waters 343947f383 gl: readd glupload/download onto element pads
Allows insertion of gl elements into non-gl pipelines without converter
(upload/download) elements.

https://bugzilla.gnome.org/show_bug.cgi?id=743974
2017-12-09 19:32:00 +00:00
Sebastian Dröge ee6bfe0127 glfilter: De-camelcase onInitFBO() vfunc 2017-12-09 19:31:59 +00:00
Sebastian Dröge 3613ecfd0a glfilter: Remove onStart/onStop vfuncs, and unused onReset()
onStart/onStop are just duplicates of the basetransform ones, onReset
was never called but was used everywhere when stop should've been used.
2017-12-09 19:31:59 +00:00
Matthew Waters 93968916a4 glsyncmeta: make context to wait and set sync explicit
otherwise we may wait on a sync object in same context by accident
2017-12-09 19:31:58 +00:00
Matthew Waters 92f0aa9bd8 gl: get the context from basemixer/basefilter 2017-12-09 19:31:57 +00:00
Matthew Waters 51620950e4 gl: retreive the gldisplay/app gl context as soon as possible
fixes the usage of gst_gl_display_filter_gl_api
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 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 f9ac4984eb glfilter: advertise resize in the caps negotiation properly 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
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 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
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
Matthew Waters ff4951fe85 glfilter: ensure that the input upload/colorconvert are always available 2017-12-09 19:31:54 +00:00
Luis de Bethencourt f524507659 gl: fix memory leak
In gst_gl_filter_fixate_caps () it can goto done without freeing the memory of
the tmp GstStructure. This makes it go out of scope and leak.

CID #1265765
2017-12-09 19:31:54 +00:00
Matthew Waters 17dba52ff3 gl: remove the egl caps from the src pads
we don't actually support producing EGLImage buffers anywhere.
2017-12-09 19:31:54 +00:00
Matthew Waters 530ae2cbb0 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.
2017-12-09 19:31:54 +00:00
Alessandro Decina 966cad27d7 gl: initial support for texture targets other than GL_TEXTURE_2D
Make GstGLMemory hold the texture target (tex_target) the texture it represents
(tex_id) is bound to. Modify gst_gl_memory_wrapped_texture and
gst_gl_download_perform_with_data to take the texture target as an argument.

This change is needed to support wrapping textures created outside libgstgl,
which might be bound to a target other than GL_TEXTURE_2D. For example on OSX
textures coming from VideoToolbox have target GL_TEXTURE_RECTANGLE.

With this change we still keep (and sometimes imply) GL_TEXTURE_2D as the
target of textures created with libgstgl.

API: modify GstGLMemory
API: modify gst_gl_memory_wrapped_texture
API: gst_gl_download_perform_with_data
2017-12-09 19:31:53 +00:00
Matthew Waters 1dfeae2c42 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.
2017-12-09 19:31:52 +00:00
Luis de Bethencourt 9d9d07168f glfilter: remove logically dead code
Soon after setting two variables to 1, the code checks if their values are
different from each other. This would never be true. Removing this.

CID 1226443
2017-12-09 19:31:52 +00:00
Wang Xin-yu (王昕宇) fc09b8b93c glfilter: fix position/texcoord attrib index usage
https://bugzilla.gnome.org/show_bug.cgi?id=741231
2017-12-09 19:31:52 +00:00
Matthew Waters ba3a3cd783 gl: fixup vao and vbo usage for legacy GL 2017-12-09 19:31:52 +00:00
Matthew Waters 4bd62ebb03 gldisplay: implement runtime GL api filtering
Needed so that the pipeline/application can limit the choice of GL api
to what it supports
2017-12-09 19:31:51 +00:00
Matthew Waters 6bb113f685 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.
2017-12-09 19:31:51 +00:00
Matthew Waters 8e98591153 glfilter: add a gl3 code path using vao's and vbo's 2017-12-09 19:31:51 +00:00
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