Commit graph

27 commits

Author SHA1 Message Date
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
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
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
Sebastian Dröge
fdacdf502b glbasememory: Fix error quark string and move documentation to the right place 2018-10-02 20:59:25 +03:00
Matthew Waters
90198daed1 gl: some annotation fixes 2018-02-05 14:58:06 +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
Thibault Saunier
95ac4d5175 docs: Port all docstring to gtk-doc markdown 2017-12-09 19:32:27 +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
adf47ea728 glbasememory: assert for a valid allocator instead of segfaulting 2017-12-09 19:32:21 +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
f1737c8ad7 glbasememory: rollback map state when subclass map fails
Otherwise our state doesn't reflect reality.
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
Nicolas Dufresne
910d990e4b glbasememory: Don't change maxsize at run-time
Maxsize is initialized once and should never change. Allocating data
should have no impact on the selected max size for this memory. This
causing memory map failure as the maxsize would become smaller then
size. This happened when using direct rendering in avviddec on GL that
does not support PBO transfer.

https://bugzilla.gnome.org/show_bug.cgi?id=763045
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
0cf1eaf71a glbasememory: Free the actual memory object when requested
Otherwise we are leaking ~400B on each GstMemory allocation.

Freeing in the base class matches the GObject semantics.
2017-12-09 19:32:14 +00:00
Matthew Waters
3cefdd6673 glbasememory: fix copying GstGLAllocationParams
Fixes a GST_IS_GL_CONTEXT critical
2017-12-09 19:32:14 +00:00
Sebastian Dröge
0aa1373a61 glbasememory: Remove bogus NULL check
CID 1346534
2017-12-09 19:32:14 +00:00
Matthew Waters
f5dfc0ca35 glbasememory: don't unconditionally add the alignment bytes to the size
e.g when wrapping a data pointer we don't want to map/unmap off the end of
pointer with the alignment bytes.

Instead track that information separately as maxsize is used for mapping by
GstMemory and thus represents a size without any alignment padding bytes.
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
65afaf7e84 glbasememory: document some functions 2017-12-09 19:32:13 +00:00
Matthew Waters
93215927a9 glbasememory: add a generic interface for allocating GL memories
This is made possible by a subclassable GstGLAllocationParams that holds
the allocation parameters

Every allocation would now go through gst_gl_base_memory_alloc with the
allocation parameters now being specified in a single struct to allow
extension by different allocators.
2017-12-09 19:32:12 +00:00
Matthew Waters
af7015602a gl: add a base memory object
It handles the following
- GstAllocationParams -> gst_memory_init transformation
- Makes sure that map/unmap/create/destroy happen on the GL thread with
  a GL context current.
- Holds a possible sysmem accessible data pointer with alignment.
- Holds the need upload/download transfer state
2017-12-09 19:32:12 +00:00