Age | Commit message (Collapse) | Author |
|
The mmaps_ map stores a pointer to the V4L2CameraProxy to avoid
increasing the reference count on the V4L2CameraFile shared pointer
needlessly. While this provides a small optimization, it prevents
accessing the V4L2CameraFile from the munmap() function which doesn't
take an fd as argument.
To prepare for improved debugging that will require access to
V4L2CameraFile in munmap(), store the V4L2CameraFile pointer in mmaps_.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Remove the verbose #ifndef/#define/#endif pattern for maintaining
header idempotency, and replace it with a simple #pragma once.
This simplifies the headers, and prevents redundant changes when
header files get moved.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
|
|
"using namespace" in a header file propagates the namespace to
the files including the header file. So it should be avoided.
This removes "using namespace" in header files in v4l2.
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Remove leftover inclusions of the sys/mman header file.
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Prepare for using the V4L2CameraFile as a container for file-specific
information in the V4L2 compatibility layer by making it a required
argument for all V4L2CameraProxy calls that are directed from
V4L2CompatManager, which are intercepted via LD_PRELOAD. Change
V4L2CameraFile accordingly.
Also change V4L2CompatManager accordingly. Instead of keeping a map of
file descriptors to V4L2CameraProxy instances, we keep a map of
V4L2CameraFile instances to V4L2CameraProxy instances. When the
proxy methods are called, feed the file as a parameter.
The dup function is also modified, in that it is removed from
V4L2CameraProxy, and is handled completely in V4L2CompatManager, as a
map from file descriptors to V4L2CameraFile instances.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Some applications (eg. Firefox, Google Chrome, Skype) use open64,
openat64, and mmap64 instead of their non-64 versions that we currently
intercept. Intercept these calls as well. _LARGEFILE64_SOURCE needs to
be set so that the 64-bit symbols are available and not synonymous to
the non-64-bit versions on 64-bit systems.
Also, since we set _FILE_OFFSET_BITS to 32 to force the various open and
mmap symbols that we export to not be the 64-bit versions, our dlsym to
get the original open and mmap calls will not automatically be converted
to their 64-bit versions. Since we intercept both 32-bit and 64-bit
versions of open and mmap, we should be using the 64-bit version to
service both. Fetch the 64-bit versions of openat and mmap directly.
musl defines the 64-bit symbols as macros that are equivalent to the
non-64-bit symbols, so we put compile guards that check if the 64-bit
symbols are defined.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> # Compile with musl
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The V4L2 compatibility layer is licensed under the GPL. It is compiled
as a binary separate from libcamera.so, and is loaded into the address
space of processes through LD_PRELOAD to intercept calls to the C
library.
It is our understanding and intent that the GPL license doesn't
propagate to the binaries whose calls are intercepted, considering those
binaries are not derivative work of the V4L2 compatibility layer and are
not designed to be linked to the V4L2 compatibility layer. There is
however a possibly grey area if binaries are packaged with a shell
script wrapper that loads the V4L2 compatibility layer. This could lead
to license-related issues if such packaging is performed by Linux
distributions or system integrators.
To clarify the intent and lift the doubts, relicense the V4L2
compatibility layer under the LGPL. The V4L2 compatibility layer code
itself still benefits from the license protection, while its usage with
third-party binaries is clearly allowed as intended.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
|
|
Now that libcamera creates threads internally and doesn't rely on an
application-provided event loop, remove the thread from the V4L2
compatibility layer. The split between the V4L2CameraProxy and
V4L2Camera classes is still kept to separate the V4L2 adaptation from
camera operation. This may be further refactored later.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Create a new FileOperations structure to hold all the dynamically-loaded
C library file operations. The file operations are now exposed publicly,
to prepare for usage of mmap in the V4L2CameraProxy.
A new template helper function is added to retrieve a symbol with
dlsym() with proper casting to simplify the V4L2CompatManager
constructor.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add libcamera V4L2 compatibility layer.
This initial implementation supports the minimal set of V4L2 operations,
which allows getting, setting, and enumerating formats, and streaming
frames from a video device. Some data about the wrapped V4L2 video
device are hardcoded.
Add a build option named 'v4l2' and adjust the build system to
selectively compile the V4L2 compatibility layer.
For now we match the V4L2 device node to a libcamera camera based on a
devnum that a pipeline handler may optionally map to a libcamera
camera.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|