Commit graph

79 commits

Author SHA1 Message Date
Matthew Waters
57a54e9de4 glupload: always release the previous buffer
Fixes the case where _perform_with_buffer() is called without
intervening calls to _release_buffer() as is the case on start up
with glimagesink.

Also release the buffer when reseting the upload.

https://bugzilla.gnome.org/show_bug.cgi?id=731107
2017-12-09 19:31:42 +00:00
Matthew Waters
4a8b31afd6 glfeature: remove GST_GL_API_GLES3
instead check the gl version using gst_gl_context_check_gl_version()
2017-12-09 19:31:42 +00:00
Sebastian Dröge
631278270f glupload: Fix assertion after API changes 2017-12-09 19:31:42 +00:00
Matthew Waters
a22cb227a9 gl/upload: re add the upload meta to the private struct
try and avoid being to trigger happy
2017-12-09 19:31:42 +00:00
Matthew Waters
8b50888179 gl/upload: small code cleanup and gst-indent 2017-12-09 19:31:42 +00:00
Matthew Waters
a147b2258b gl/upload: use GstObject's lock instead of our own 2017-12-09 19:31:42 +00:00
Matthew Waters
8ac92cd90d gl/colorconvert: allocate output buffers
Allows the nop optimisation by simply reffing the input buffer.
2017-12-09 19:31:41 +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
Matthew Waters
625efc1757 gl/colorconvert: operate on buffers instead of memories 2017-12-09 19:31:41 +00:00
Matthew Waters
132a233f7b gl/memory: implement GL_EXT_texture_rg support
Which is used by default over the Luminance formats due to it
being color renderable with fbos (and deprecation/removal with
GL 3.x).

https://bugzilla.gnome.org/show_bug.cgi?id=729750
https://bugzilla.gnome.org/show_bug.cgi?id=704222
https://bugzilla.gnome.org/show_bug.cgi?id=728890
2017-12-09 19:31:41 +00:00
Matthew Waters
313dfbb500 gl/upload: switch the 'master' texture for YUY2, UYVY
From d4bcef3204 on, using a RGBA
texture to hold the data causes the glmemory to have half width
and a scaling of [2, 1].  Using a LA texture solves this problem
however cannot be attached to the framebuffer for copying into
a RGBA texture.  Which will be solved by moving to EXT_texture_rg.

https://bugzilla.gnome.org/show_bug.cgi?id=728890
2017-12-09 19:31:41 +00:00
Nicolas Dufresne
030fc8b7d0 glupload: Ensure we still have a texture after upload_set_format()
gst_gl_upload_set_format() resets the upload, hence the texture.
So we need to ensure we have a texture after this call when
uploading.
2017-12-09 19:31:40 +00:00
Nicolas Dufresne
b70edbff15 glupload: Correctly update the video info from video meta
Using gst_video_info_set_format() isn't complete when updating
a video info from video meta.
2017-12-09 19:31:40 +00:00
Nicolas Dufresne
2f705ac9ca glupload: Correctly update video info in upload fallback
When the upload accelerated method fails, we fallback to an upload,
but the video info was not correctly updated.
2017-12-09 19:31:40 +00:00
Julien Isorce
c16ab9e66b gl/upload: set out_tex after reset, not before
Fix a regression introduced recently with the lazy init.
It was happening when calling gst_video_gl_texture_upload_meta_upload
from an aplication. So not using gst_gl_upload_perform_with_buffer.
2017-12-09 19:31:40 +00:00
Matthew Waters
5cdfd51172 gl/upload: update the video info on mapping a video frame
The buffer should contain the most specific data on how the data is
formatted.  We should use this information.

https://bugzilla.gnome.org/show_bug.cgi?id=729896
2017-12-09 19:31:40 +00:00
Matthew Waters
59c388abca gl/upload: avoid performing color conversion when there is no need
One such example is when the buffer contains GstGLMemory in the
RGBA format

https://bugzilla.gnome.org/show_bug.cgi?id=729278
2017-12-09 19:31:40 +00:00
Matthew Waters
9fffa2cbc6 gl/upload: update the respective state when we cache textures/data 2017-12-09 19:31:40 +00:00
Matthew Waters
484ae5a8c5 gl/upload: cache the textures that we are using 2017-12-09 19:31:40 +00:00
Matthew Waters
a64efacd0e gl/upload: avoid recreating the GLMemory struct for output textures 2017-12-09 19:31:40 +00:00
Nicolas Dufresne
5c8acc21fe gl: Fix some of the error handling 2017-12-09 19:31:40 +00:00
Nicolas Dufresne
94aa3ea228 glupload: Update GstVideoInfo after the buffer is mapped
gst_video_frame_map() will store an updated video info base
on the video meta. In order to have the right stride and offset
we should update that video info accordingly.
2017-12-09 19:31:40 +00:00
Matthew Waters
977c326c59 gl/colorconvert: implement lazy init 2017-12-09 19:31:40 +00:00
Julien Isorce
17ba668c7a gl/upload: set initted to TRUE when _init_upload succeeded 2017-12-09 19:31:40 +00:00
Matthew Waters
83c2b906d1 gl/upload: fix compilation on OS X 2017-12-09 19:31:40 +00:00
Matthew Waters
862df41b2d gl/upload: fail propoerly if init fails 2017-12-09 19:31:39 +00:00
Matthew Waters
857200ff40 gl: make all GObjects inherit from GstObject
Aids memory leak debugging with GST_TRACE=mem-live
2017-12-09 19:31:39 +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
cda89d7ce0 gl/upload: add get_format method
Simply retreives the format set by init_format
2017-12-09 19:31:39 +00:00
Julien Isorce
d7c5444447 gl: do not allocate the target texture of an EGLImage
The target texture of an EGLImage is the texture bind just
before calling glEGLImageTargetTexture2D.

As we currently only support a gl texture as the source of an EGLImage
the gl texture is actually already allocated when creating the eglimage.

I also see some cases where it fails to upload an eglimage when
glTexImage2D is called on the target.
2017-12-09 19:31:39 +00:00
Julien Isorce
dd1c2b4c4c gl: delete texture used with GstVideoGLTextureUploadMeta 2017-12-09 19:31:39 +00:00
Matthew Waters
33091ff6a5 gl/mem: implement texture copying between formats with strides properly
Previously, we used the width to determine the amount of data to be
copied using pbos.  This, makes it allocate enough data for the
the strides as well.
2017-12-09 19:31:38 +00:00
Julien Isorce
e4b832db90 gl: fix declaration-definition mismatch for _init_upload 2017-12-09 19:31:37 +00:00
Matthew Waters
92c243be62 gl/color: pass large value by reference
Coverity 1199700
2017-12-09 19:31:36 +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
ee0c102ac5 gl/upload: add support for the bt709 color matrix 2017-12-09 19:31:35 +00:00
Matthew Waters
16a30a12aa gl/upload: remove the legacy GL 1.x upload path
uploading requires shaders and fbos available in GL2.
2017-12-09 19:31:35 +00:00
Matthew Waters
e225af3e0d gl: silence all the compiler warnings 2017-12-09 19:31:34 +00:00
Matthew Waters
6c594a0b15 [881/906] upload: restore default values for unpack_length
fixes elements that upload a supplementary texture (glbumber,
gldifferencematte, etc)
2017-12-09 19:31:33 +00:00
Matthew Waters
d233bb66a9 [876/906] glmem: use GstVideoInfo for format configuration
Allows use of strides
2017-12-09 19:31:33 +00:00
Matthew Waters
d84bb0b3b2 [875/906] upload: support for arbitrary strides
Using GL_UNPACK_ALIGNMENT for GLES2 and GL_UNPACK_ROW_LENGTH for everything else
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
Matthew Waters
a9f6679e90 [872/906] upload: consolidate data _fill 2017-12-09 19:31:33 +00:00
Matthew Waters
bc8b4085b5 [871/906] upload: fix texture scaling for YUY2/UYVY with GLES2
Another artifact from the transition to GL_TEXTURE_2D
2017-12-09 19:31:33 +00:00
Matthew Waters
1f4d041d5b [870/906] upload: remove superflous g_mutex_init 2017-12-09 19:31:33 +00:00
Matthew Waters
970fbacf96 [869/906] tests: add some upload tests 2017-12-09 19:31:33 +00:00
Matthew Waters
8d67249633 [868/906] upload: fix compilation for GLES2 2017-12-09 19:31:33 +00:00
Wang Xin-yu (王昕宇)
5168d86d9e [867/906] glupload: Add GRAY8/GRAY16LE/BE upload support to glimagesink
the 16bit data is uploaded as LUMINANCE_ALPHA, then expanded, composed
in shader. value weight is a little complicate, high byte weight is
255*256/65535 (denormalize to [0~255] ,shift to high byte,then normalize
to [0~1]), low byte weight is 255/65535(similar)

https://bugzilla.gnome.org/show_bug.cgi?id=722670
2017-12-09 19:31:33 +00:00