Commit graph

68 commits

Author SHA1 Message Date
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
Matthew Waters
95833db905 [866/906] upload: update some docs 2017-12-09 19:31:33 +00:00
Matthew Waters
1e02438715 [855/906] upload: add support for GstVideoGLTextureUploadMeta 2017-12-09 19:31:32 +00:00
Matthew Waters
f15206082a [850/906] glupload: Remove texture scaling artifacts from the TEXTURE_RECTANGLE -> TEXTURE_2D transition
fixes the funky colours in some of the yuv formats

https://bugzilla.gnome.org/show_bug.cgi?id=721155
2017-12-09 19:31:32 +00:00
Matthew Waters
efa22442a9 [838/906] gl: Use GL_TEXTURE_2D instead of GL_TEXTURE_RECTANGLE
We create our textures (in Desktop GL) with GL_TEXTURE_RECTANGLE,
vaapi attempts to bind our texture to GL_TEXTURE_2D which throws a
GL_INVALID_OPERATION error and as thus, no video.

Also, by moving exclusively to GL_TEXTURE_2D and the npot extension
we also remove a difference between the Desktop GL and GLES2 code.

https://bugzilla.gnome.org/show_bug.cgi?id=712287
2017-12-09 19:31:32 +00:00
Matthew Waters
bf610e210a [826/906] upload: free our mutex 2017-12-09 19:31:32 +00:00
Matthew Waters
711ad485b2 [812/906] move the GL vtable from GstGLDisplay to GstGLContext
Conflicts:
	tests/check/libs/gstglcontext.c
2017-12-09 19:31:31 +00:00
Tonu Jaansoo
c304635ecf [787/906] gl: The GLSL rectangle resampler does not always work with int tex coords
Use floats instead.
2017-12-09 19:31:30 +00:00
Matthew Waters
1f19143837 [778/906] upload: remove _thread variants of the API 2017-12-09 19:31:30 +00:00
Matthew Waters
d009a216e6 [777/906] upload: overhaul and addition of new video formats
use the shaders from eglglessink (adapted for Desktop GL)
error out properly
2017-12-09 19:31:30 +00:00
Sebastian Dröge
15438d5b7f [750/906] glupload: Add support for RGB reordering when using GLES2 2017-12-09 19:31:29 +00:00
Sebastian Dröge
6c5ce0ee99 [747/906] gl: Constify YUV conversion shaders 2017-12-09 19:31:29 +00:00