Nicolas Dufresne
de79830b05
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
2017-12-09 19:31:55 +00:00
Matthew Waters
05a4c89f25
glupload: perform egl upload on the gl thread
...
Fixes EGLImage usage on raspberry pi
https://bugzilla.gnome.org/show_bug.cgi?id=743914
2017-12-09 19:31:55 +00:00
Víctor Manuel Jáquez Leal
e3d457ec8e
glupload: Set freed method implementation to NULL
...
When trying to render buffers with meta:GLTextureUpload the glimagesink crashes
with a segmentation fault.
This patch workarounds this crash setting to NULL the method implementation
after free.
https://bugzilla.gnome.org/show_bug.cgi?id=745206
2017-12-09 19:31:55 +00:00
Edward Hervey
f56c4c541a
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
2017-12-09 19:31:54 +00:00
Matthew Waters
608a3ddc7b
glupload: restrict EGL and UploadMeta to RGBA
...
other formats are highly untested.
2017-12-09 19:31:54 +00:00
Matthew Waters
f180fe8dc8
glupload: only try the glmemory upload for sysmem/glmemory caps features
...
Allows selecting/testing the upload path with explicit caps features.
2017-12-09 19:31:54 +00:00
Matthew Waters
29ca0e8a44
glupload: allow NULL buffer for accept vfunc
2017-12-09 19:31:54 +00:00
Matthew Waters
45e6e77ff0
glupload: remove unsed convert field in private struct
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
Sebastian Dröge
39e719fb33
Constify some static arrays everywhere
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
Matthew Waters
4288866e55
glupload: relax the GLMemory uploader check for input caps features
...
As there may be a sysmem caps features with GLMemory filled buffers.
e.g.
videotestsrc ! glimagesink
2017-12-09 19:31:52 +00:00
Nicola Murino
209fbd950f
glupload: fix some memory leaks
...
https://bugzilla.gnome.org/show_bug.cgi?id=741943
2017-12-09 19:31:52 +00:00
Nicolas Dufresne
a1e02726ee
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
2017-12-09 19:31:52 +00:00
Sebastian Dröge
3c7095e5ad
glupload: Fix valid compiler warning
...
gstglupload.c:442:32: error: if statement has empty body [-Werror,-Wempty-body]
if (upload->texture_ids[i]);
^
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
ccf8f014f0
glupload: fallback to upload if contexts cannot share GL resources
...
Fixes pipelines of the form
gleffects ! tee ! glimagesink
as tee does not pass on the allocation query.
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
Wang Xin-yu (王昕宇)
f322a331c8
glupload: don't determine if frame needs upload by pointer compare
...
https://bugzilla.gnome.org/show_bug.cgi?id=734269
2017-12-09 19:31:45 +00:00
Matthew Waters
c216799b20
glmemory: use GstVideoInfo everywhere
...
Simplifies a lot of the calling code
https://bugzilla.gnome.org/show_bug.cgi?id=733717
2017-12-09 19:31:45 +00:00
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
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
Sebastian Dröge
d0293d9f0c
[745/906] gl: Simplify and optimize YUV conversion shaders a bit
2017-12-09 19:31:29 +00:00
Julien Isorce
d17a4381b1
[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
2017-12-09 19:31:29 +00:00
Matthew Waters
761bc0156a
[704/906] Use gst_object_[un]ref so we can get refcounts in the log
2017-12-09 19:31:28 +00:00
Matthew Waters
c6988cb064
[701/906] display: move context creation into window
2017-12-09 19:31:28 +00:00
Matthew Waters
9c633e658a
[700/906] display: move most of the code into utils for sorting later
...
This contains a hack that essentially requires one GstGLDisplay
per process.
2017-12-09 19:31:28 +00:00
Matthew Waters
38e0434d95
[699/906] display: remove list of upload and download objects
...
and only create an up/download object when needed.
2017-12-09 19:31:28 +00:00
Matthew Waters
72ac429e57
[675/906] upload: provide nicer debugging
2017-12-09 19:31:27 +00:00
Matthew Waters
847e6540fb
[651/906] up/download: fix some typos when removing GLEW
2017-12-09 19:31:27 +00:00
Matthew Waters
6bee9b9c93
[647/906] remove dependecy on glew
2017-12-09 19:31:27 +00:00
Matthew Waters
e983f02e87
[642/906] add gstglconfig.h for apps to find out what our capabilites are
...
ie libgstgl can be compiled with any combination of opengl/gles2
2017-12-09 19:31:26 +00:00
Matthew Waters
344253e860
[624/906] OPENGL_ES2 => HAVE_GLES2 and add HAVE_OPENGL
...
use GstGLAPI to determine which code paths to execute.
perform some cleanups
2017-12-09 19:31:26 +00:00
Matthew Waters
4c35d682c9
[603/906] update FSF address
2017-12-09 19:31:25 +00:00
Matthew Waters
9267372466
[601/906] fix typo causing shader compilation failure for uploading I420
2017-12-09 19:31:25 +00:00
Matthew Waters
d55bbf7f55
[600/906] docs: add docs for new objects and expand on some existing ones
2017-12-09 19:31:25 +00:00
Matthew Waters
7baddfbcbe
[599/906] GL|ES2: fix typos from recent changes and make downloading RGB formats work again
2017-12-09 19:31:25 +00:00
Matthew Waters
39866ea830
[590/906] up/download: fix scaling on transfer
...
i.e. uploading from a 10x10 video frame to a 20x20 texture into another 30x30 videoframe
2017-12-09 19:31:25 +00:00
Matthew Waters
75734e663c
[578/906] {up,down}load: add variants that can be called in the gl thread
2017-12-09 19:31:25 +00:00
Matthew Waters
3ee54d3135
[573/906] add upload and download library objects
...
allows multiple upload pipelines that previously wasn't possible
(i.e. upload RGB and I420 and ... on the same GstGLDisplay)
2017-12-09 19:31:25 +00:00