dlopen'd libv4l2 entry points, shared by every V4L2 consumer. More...
Detailed Description
dlopen'd libv4l2 entry points, shared by every V4L2 consumer.
Same shape as DrmFunctions / CudaFunctions: no link-time dependency, and a machine without libv4l2 degrades a feature rather than failing to load the plugin. Shared rather than kept private to CameraDevice.v4l2.cpp: the control tree needs the same three symbols, and a second copy of a dlopen singleton is how the two drift apart.
available() rather than an assert: control ioctls need none of libv4l2's format emulation, so a caller that only reads and writes controls can fall back to the raw syscall and still work. Capture, which does rely on the emulation, checks and declines instead.
Go to the source code of this file.
Classes | |
| class | score::gfx::v4l2::Libv4l2 |
Namespaces | |
| namespace | score |
| Base toolkit upon which the software is built. | |
| namespace | score::gfx |
| Graphics rendering pipeline for ossia score. | |
Functions | |
| int | v4l2_open (const char *file, int oflag,...) |
| int | v4l2_close (int fd) |
| int | v4l2_dup (int fd) |
| int | v4l2_ioctl (int fd, unsigned long int request,...) |
| ssize_t | v4l2_read (int fd, void *buffer, size_t n) |
| ssize_t | v4l2_write (int fd, const void *buffer, size_t n) |
| void * | v4l2_mmap (void *start, size_t length, int prot, int flags, int fd, int64_t offset) |
| int | v4l2_munmap (void *_start, size_t length) |
| int | score::gfx::v4l2::retryIoctl (int fd, unsigned long request, void *arg) noexcept |
| int | score::gfx::v4l2::openDeviceRaw (const char *path, int flags) noexcept |
| void | score::gfx::v4l2::closeDeviceRaw (int fd) noexcept |
| int | score::gfx::v4l2::retryIoctlRaw (int fd, unsigned long request, void *arg) noexcept |
| int | score::gfx::v4l2::openDevice (const char *path, int flags) noexcept |
| void | score::gfx::v4l2::closeDevice (int fd) noexcept |
Function Documentation
◆ openDeviceRaw()
|
inlinenoexcept |
The same three, bypassing libv4l2 outright.
libv4l2 dlopens every plugin in /usr/lib/libv4l/plugins and offers each one the fd. On Tegra that includes libv4l2_nvargus.so, the Argus-backed V4L2 shim: with nvargus-daemon stopped – which is exactly the state the raw Bayer path needs, since Argus otherwise sets bypass_mode=1 and V4L2 delivers nothing – its open() fails, it stays attached to the fd anyway, and v4l2_close() then segfaults inside libnvargus_socketclient dereferencing state it never initialised. Closing the device or quitting score both take that path, so both crash.
The direct-video backend wants none of what libv4l2 offers regardless: its job is format emulation, and this path deliberately takes the sensor's raw Bayer and demosaics on the GPU. CameraDevice keeps the wrappers, where converting an odd webcam format is the whole point.
◆ retryIoctl()
|
inlinenoexcept |
ioctl with the EINTR retry every V4L2 caller needs, through libv4l2 when it is there. Shared rather than re-declared per file: this addon is built as a unity build, so two files each carrying their own xioctl in an anonymous namespace end up in one translation unit and collide.