Commit graph

9 commits

Author SHA1 Message Date
Thomas Klausner
4632c623bf shmallocator: fix build on Illumos
Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3370

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6321>
2024-03-13 18:48:27 +00:00
Damian Hobson-Garcia
1ef7e9be73 GstShmAllocator: Map/unmap full buffer when padding is added
When allocating buffers with alignment parameters specified, it
may be necessary to overallocate memory to adjust to the requested
alignment.  Previously the padding length was not included in the mmaped
buffer size, leaving unmapped bytes at the end of the buffer.
This caused intermittent SEGV faults and valgrind failures when running
the wayland_threads example.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6104>
2024-02-12 16:19:35 -05:00
Nicolas Dufresne
e523dd9f08 allocators: shm: Remove future write sealing
By sealing for future writes, we broke Wayland SHM support. It seems like the
wayland library maps the SHM in read/write mode. This is visible through no
display and an error message like this:

  wl_shm@7: error 2: failed mmap fd 43: Operation not permitted

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5684>
2023-11-17 08:17:05 +00:00
Xavier Claessens
19832bd3b3 GstShmAllocator: Add documentation
Sponsored-by: Netflix Inc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328>
2023-11-03 18:22:00 +00:00
Xavier Claessens
5b4d37d6f2 GstShmAllocator: Respect allocation params
Sponsored-by: Netflix Inc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328>
2023-11-03 18:22:00 +00:00
Xavier Claessens
f57dabe65c GstShmAllocator: Seal memfd for future write
The GstMemory we created is kept mapped RW, but any future mapping that
uses the fd should be RO.

Sponsored-by: Netflix Inc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328>
2023-11-03 18:22:00 +00:00
Xavier Claessens
c0ce677dfc GstShmAllocator: Use shm_open() instead of temporary file
There is no guarantee that g_get_user_runtime_dir() is in a tmpfs. Using
an explicit shared memory API seems safer for all POSIX platforms.

Note that Android does not have shm_open() and only added memfd_create()
since API level 30 (Android 11).

Sponsored-by: Netflix Inc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328>
2023-11-03 18:22:00 +00:00
Xavier Claessens
d59ea1caf0 GstShmAllocator: Use GST_ALLOCATOR_FLAG_NO_COPY flag
Sponsored-by: Netflix Inc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328>
2023-11-03 18:22:00 +00:00
Xavier Claessens
7df22b338b GstShmAllocator: New shared memory allocator
This makes Wayland's allocator public. It is generally useful to have a
shared memory allocator that can create memfd on Linux.

Sponsored-by: Netflix Inc.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5328>
2023-11-03 18:22:00 +00:00