Commit graph

149 commits

Author SHA1 Message Date
Thibault Saunier
2fd28195ca Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00
Nicolas Dufresne
3897b24f69 video: Pass component index not plane index
While so far it worked, we are about to introduce a format that break this
assuming. We have a format which consist of NV12 with alpha, and this format
does not have a direct mapping of the component against their plane indexes.

Fix this by using gst_video_format_info_component() introduced in 1.18 for
this purpose.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1151>
2021-05-19 15:17:56 +00:00
Matthew Waters
98249a57db gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1073>
2021-03-19 04:20:19 +00:00
Marijn Suijten
abb026ec6a gl,video: Make ptrs to VideoInfo and (GL)AllocationParams immutable
These parameters are incorrectly regarded as mutable in G-IR making them
"incompatible" with languages that are explicit about mutability like
Rust. In order to clean up the code and expected API there, update the
signatures here, right at the source (instead of overriding them in
Gir.toml and hoping for the best).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1005>
2021-01-14 11:53:10 +00:00
Matthew Waters
b60951a4fa gl: add get_type() implementations for all of our memory types
Otherwise, various bindings can't really know the type of an object as
required.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/999>
2021-01-13 13:40:58 +00:00
Matthew Waters
f573d91237 gl: document some GL caps specifics
Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/854
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/996>
2021-01-05 15:03:54 +00:00
Marijn Suijten
0ea3279df1 gst-libs: gl: Fix documentation typo and clarify gl_memory_texsubimage
`gst_gl_memory_read_pixels` reads pixels from `GLMemory` into the
pointer, effectively writing to it. This is opposite from
`gst_gl_memory_texsubimage` which reads texture data from `read_pointer`
into `GLMemory`.

Both cases are clarified by changing `read_pointer` to `write_pointer`,
and explaining what `gst_gl_memory_texsubimage` does in addition to
referring back to `gst_gl_memory_read_pixels`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/806>
2020-09-09 09:54:48 +00:00
Guillaume Desmottes
b418b4b6ec gl: use gst_video_meta_set_alignment() 2019-11-02 13:05:43 +01:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Matthew Waters
51f2d05ff6 gl/docs: add to new docs system 2019-05-21 01:49:48 +00:00
Tim-Philipp Müller
2f9db671cb gl: suppress some g-i warnings
gst_gl_memory_setup_buffer() was marked as introspectable=0
anyway, so might just as well mark it as '(skip)' and suppress
the warning. Reason is the (element-type gpointer) on wrapped_data.

gstglmemory.c:1426: Warning: GstGL: gst_gl_memory_setup_buffer: argument wrapped_data: Missing (element-type) annotation
gstglmemory.c:1426: Warning: GstGL: gst_gl_memory_setup_buffer: argument wrapped_data: Missing (element-type) annotation

egl/gstegl.h:40: Warning: GstGL: symbol='EGL_EGLEXT_PROTOTYPES': Unknown namespace for symbol 'EGL_EGLEXT_PROTOTYPES'
2019-03-24 16:05:09 +00:00
Nirbheek Chauhan
36ec18c230 glmemory: Disable GL timing queries when debugging
This can be very expensive in some workloads, taking up to 11% of the
total execution time.
2019-03-12 03:21:57 +00:00
Seungha Yang
e48b8033e3 gl: Fix some type conversion warnings with MSVC
MSVC complained about implicit conversion between GstGLFormat* and guint*
2019-01-14 01:48:34 +00:00
Matthew Waters
cfae8bd6c1 glmemory: normalize the internal format we pass into glTex* functions
Passing unsized formats sometimes breaks on embedded platforms

Take 2 at 694e30f858,
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/49
2018-12-13 00:10:10 +11:00
Nicolas Dufresne
0ac646f7f4 glmemory: Fix n_wrapped_pointers usage
gst_gl_memory_setup_buffer() was not properly using the number
of pointers to wrapped. This also fixes the validation, as we
only support 1 wrapper per view, or num_planes * views wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-10-30 10:47:01 +01:00
Nicolas Dufresne
bccc69fadb Revert "glmemory: Fix n_wrapped_pointers usage"
This reverts commit b1299c179b.
2018-09-13 20:02:43 -04:00
Nicolas Dufresne
b1299c179b glmemory: Fix n_wrapped_pointers usage
gst_gl_memory_setup_buffer() was not properly using the number
of pointers to wrapped. This also fixes the validation, as we
only support 1 wrapper per view, or num_planes * views wrapper.

https://bugzilla.gnome.org/show_bug.cgi?id=783521
2018-09-10 23:02:46 -04:00
Matthew Waters
396e04cf69 gl/memory: store the internal format as the texture format
Instead of having special cases at each GL texture creation, upload,
readback or copy for all non-8-bits-per-components.
Simply store the more specific format and retrieve the generic
component/type tuple from that.

Introduce a helper function for retrieving the generic GL format (RGBA,
RGB, RG, R, L, A) and type (BYTE, SHORT, SHORT_5_6_5) from a sized
GL format enum (RGBA8, RGB565, RG8, etc).
2018-05-05 21:24:25 +10:00
Mark Nauwelaerts
710990d5cf gl: fix some GIR annotations
Mostly related to out and array parameters
2018-04-23 19:33:19 +02:00
Matthew Waters
90198daed1 gl: some annotation fixes 2018-02-05 14:58:06 +11:00
Matthew Waters
e620cf32cf glmemory: fixup GL_RGB565 usage when performing texsubimage
An additional change for the texsubimage use case on top of
https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c2b2c68beaddbea0ec4fe7b099507cc492f6dd7c
https://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=ea6bed111bab9b394d787f7760c6a3b953630d3a

https://bugzilla.gnome.org/show_bug.cgi?id=783066
https://bugzilla.gnome.org/show_bug.cgi?id=792584
2018-02-01 23:30:51 +11:00
Julien Isorce
4952fdd956 gl: do not include GL headers in public gstgl headers
Except for gst/gl/gstglfuncs.h

It is up to the client app to include these headers.
It is coherent with the fact that gstreamer-gl.pc does not
require any egl.pc/gles.pc. I.e. it is the responsability
of the app to search these headers within its build setup.

For example gstreamer-vaapi includes explicitly EGL/egl.h
and search for it in its configure.ac.

For example with this patch, if an app includes the headers
  gst/gl/egl/gstglcontext_egl.h
  gst/gl/egl/gstgldisplay_egl.h
  gst/gl/egl/gstglmemoryegl.h
it will *no longer* automatically include EGL/egl.h and GLES2/gl2.h.
Which is good because the app might want to use the gstgl api only
without the need to bother about gl headers.

Also added a test: cd tests/check && make libs/gstglheaders.check

https://bugzilla.gnome.org/show_bug.cgi?id=784779
2017-12-09 19:32:29 +00:00
Matthew Waters
82cf1b9c71 gl/docs: some documentation updates
Add some missing/incomplete docs
2017-12-09 19:32:29 +00:00
Matthew Waters
3200e2f00d gl/docs: correctly name our objects in the documentation GstGl -> GstGL 2017-12-09 19:32:29 +00:00
Hyunjun Ko
402d805c90 glmemory: reset the draw buffer to GL_BACK
The draw buffer should be reset to GL_BACK since the framebuffer is already
unbound.

https://bugzilla.gnome.org/show_bug.cgi?id=784210
2017-12-09 19:32:29 +00:00
Sebastian Dröge
0572c41c28 gl: Fix indentation 2017-12-09 19:32:28 +00:00
Haihua Hu
ea6bed111b glformat: fix the usage of GST_GL_RGB565
GL_RGB565 is sized internal glformat, the corresponding glformat
should be GL_RGB and type is GL_UNSIGNED_SHORT_565. Otherwise will
return GL_INVALID_ENUM when creating texture.

https://bugzilla.gnome.org/show_bug.cgi?id=783066
2017-12-09 19:32:28 +00:00
Haihua Hu
2fc05e90d8 glframebuffer: check frame buffer status need use specific fbo target
https://bugzilla.gnome.org/show_bug.cgi?id=783065
2017-12-09 19:32:28 +00:00
Sebastian Dröge
a9a05c01a9 gst: Clear floating flag in constructor of all GstObject subclasses that are not owned by any parent
https://bugzilla.gnome.org/show_bug.cgi?id=743062
2017-12-09 19:32:28 +00:00
Sebastian Dröge
aef461d4a0 glmemory: Only use glDrawBuffer if available
Otherwise fall back to glDrawBuffers. Also check if glReadBuffer exists
before using it.

glDrawBuffer does not exist for GLES, only glDrawBuffers does.

https://bugzilla.gnome.org/show_bug.cgi?id=782376
2017-12-09 19:32:27 +00:00
Thibault Saunier
95ac4d5175 docs: Port all docstring to gtk-doc markdown 2017-12-09 19:32:27 +00:00
Matthew Waters
66468b4245 gl/format: use our own GL format enum's instead of gstvideo's
They can describe in more detail (such as component sizes) the requested format.
2017-12-09 19:32:27 +00:00
Sebastian Dröge
a6cbe2a2cb glmemory: Use glBlitFramebuffer() instead of glCopyTexImage2D() if available
glBlitFramebuffer() is new GLES3/GL3 API. They are probably often
implemented in terms of each other, and glBlitFramebuffer() can
potentially be implemented more flexible. Let's use it if available.

Also it actually works on imx6 with DirectVIV textures.

Based on a patch by Haihua Hu <jared.hu@nxp.com> from
https://github.com/Freescale/meta-freescale/blob/master/recipes-multimedia/gstreamer/gstreamer1.0-plugins-bad/

https://bugzilla.gnome.org/show_bug.cgi?id=779070
2017-12-09 19:32:26 +00:00
Matthew Waters
0a0a45fefd gl/docs: some type fixes of type names 2017-12-09 19:32:26 +00:00
Matthew Waters
31b38a5f54 gl: add necessary get_type() functions for allocation params structures
All using the existing GstGLAllocationParams infrastructure
2017-12-09 19:32:26 +00:00
Matthew Waters
62d0bac993 gl/gi: some annotation updates for called functions
With scope, closure, destroy annotations
2017-12-09 19:32:23 +00:00
Matthew Waters
9bafa08a5d gl/docs: massive update
- add Since: markers where necessary.
- document structs
- add documentation headers for each module (short_description,
  see_also, etc)
- reduce the number of warnings gtk-doc outputs
- fix spelling mistakes
2017-12-09 19:32:23 +00:00
Matthew Waters
1153684a94 glmemory: add the texture type to allocate to parameters
Rather than assuming something.  e.g. zerocopy on iOS with GLES3 requires
the use of Luminance/Luminance Alpha formats and does not work with
Red/RG textures.
2017-12-09 19:32:21 +00:00
Matthew Waters
2753b4243e glmemory: add wrapped data pointers to setup_buffer
Allows creating wrapped memories with GstGLAllocationParams.

The wrapped pointers will be set in the parameters before being passed
to the memory allocation function.
2017-12-09 19:32:19 +00:00
Matthew Waters
04e92acd3b glbasememory: take a pointer as the wrapped gpu handle
Allows passing arbitrary data to wrap the the specific memory implementation
which is required for some memory implementations.
2017-12-09 19:32:19 +00:00
Matthew Waters
0c2890cd34 glmemory: add checking the read implementation format/type on gles2 platforms
By default, reading GL_RED or GL_RG us unsupported by glReadPixels unless
exposed through GL_COLOR_READ_IMPLEMENTATION_FORMAT/TYPE.  This allows
downloading multiple-planar video frames where possible.
2017-12-09 19:32:18 +00:00
Matthew Waters
b1bfcac299 glmemory: unset GL_UNPACK_ROW_LENGTH in opengl3
If the user uploads their own texture without setting the unpack length, then
then the result will have the appearance of stride mismanagement due to
an incorrect row length.
2017-12-09 19:32:18 +00:00
Matthew Waters
18a812a30f gl*memory: document new functionality and objects 2017-12-09 19:32:17 +00:00
Matthew Waters
575974aeaf glmemory: log the time for glTexSubImage/glReadPixels 2017-12-09 19:32:15 +00:00
Matthew Waters
5ba0ab3da9 glmemory: expose gst_gl_memory_texsubimage
Removes extremely similar code from glmemorypbo.
2017-12-09 19:32:14 +00:00
Matthew Waters
3695ab353d glmemory: small code reformat
makes the alloc_params selections fit on a single line.
2017-12-09 19:32:14 +00:00
Alessandro Decina
28dbe4fffc glmemory: add gst_gl_memory_allocator_get_default
Add gst_gl_memory_allocator_get_default to get the default allocator based on
the opengl version. Allows us to stop hardcoding the PBO allocator which isn't
supported on gles2.

Fixes GL upload on iOS9 among other things.
2017-12-09 19:32:13 +00:00
Matthew Waters
09c8c23842 gl*memory*: reverse the parameter order of user_data and destroy notify
The convention is to have the destroy notify last after any user data
2017-12-09 19:32:13 +00:00
Matthew Waters
2c5ae0c784 glmemory: document gst_gl_memory_init 2017-12-09 19:32:13 +00:00
Matthew Waters
12360432c6 glmemory: add a default copy implementation
Subclasses still need to override this to copy into the correct memory type.
2017-12-09 19:32:13 +00:00