Age | Commit message (Collapse) | Author |
|
With the FrameBuffer rework completed there is no reason to keep the
camera prepared state around as buffer allocations are now decoupled
from the camera state. Remove the camera state simplifying the API.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Switch to the FrameBuffer interface where all buffers are treated as
external buffers and are allocated outside the camera. Applications
allocating buffers using libcamera are switched to use the
FrameBufferAllocator helper.
Follow-up changes to this one will finalize the transition to the new
FrameBuffer interface by removing code that is left unused after this
change.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Move the metadata retrieved when dequeuing a V4L2 buffer into a
FrameMetadata object. This is done as a step to migrate to the
FrameBuffer interface as the functions added to Buffer around
FrameMetadata match the ones in FrameBuffer.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In the FrameBuffer interface the stream will not be available from the
buffer object as the buffer might be allocated externally. The
application needs to explicitly state which stream the buffer is being
added for to the request.
Extend the addBuffer() function to get this information explicitly from
the caller.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
It is not libcamera's responsibility to handle memory mappings. Switch
from the soon to be removed Plane class which deals with memory
mappings to FrameBuffer::Plane which just describes it. This makes the
transition to the full FrameBuffer easier.
As the full FrameBuffer interface has not yet spread to all parts of
libcamera core it is hard to create efficient caching of memory mappings
in the qcam application. This will be fixed in a later patch, for now
the dmabuf is mapped and unmapped each time it is seen by the
application.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The V4L2Camera::getBufferFd() method doesn't need to run in the camera
thread. Call it directly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
In the upcoming FrameBuffer API the memory mapping of buffers will be
left to the user of the FrameBuffer objects. Prepare the V4L2
compatibility layer to this upcoming change to ease conversion to the
new API.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
With the upcoming FrameBuffer API a new library wide FrameMetadata
object will be added which will replace the specific implementation in
the V4L2 compatibility layer.
Avoid name collisions while the new FrameBuffer API is added by renaming
the V4L2 compatibility layer specific implementation until it can be
replaced with the library wide implementation.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Refactoring of the camera_proxy have left the 'ret' variable undeclared,
declare it.
../../src/v4l2/v4l2_camera_proxy.cpp:273:2: error: use of undeclared identifier 'ret'
ret = vcam_->invokeMethod(&V4L2Camera::configure,
^
../../src/v4l2/v4l2_camera_proxy.cpp:278:6: error: use of undeclared identifier 'ret'
if (ret < 0)
Fixes: fce110c6d961c3bb ("v4l2: camera_proxy: Break out try_fmt")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Most of the ioctl handlers in the V4L2CameraProxy class have an empty
line between the tracing printouts and the immediately following buffer
type validation. Align the two occasions where such an empty line is missing
with the others.
Cosmetic change only.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Calling vidioc_s_fmt() calls vidioc_try_fmt() duplicating prinouts.
Breakout try format procedure and call it from both functions.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The set pixelformat field of struct v4l2_pix_format structure was
wrongly converted to PixelFormat by calling v4l2ToDrm(), with an already
converted 'format' argument.
Fix this by calling the right drmToV4l2() conversion function.
Fixes: 0ce8f2390b52 ("v4l2: v4l2_compat: Add V4L2 compatibility layer")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Commit 29c5508075c1 ("v4l2: camera_proxy: Create format info array")
introduced usage of the std::array template class, but didn't include
the corresponding header. This may cause a compilation breakage in the
future if the indirect include of <array> disappears due to unrelated
changes. Fix it.
Fixed: 29c5508075c1 ("v4l2: camera_proxy: Create format info array")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Create a PixelFormatInfo structure to store information about a format,
and add a global array of format info for all the formats currently
supported. Move the format helpers to use the information from the
array.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
To clarify code, adopt the following rules for format helpers:
- All variables representing V4L2 pixel formats shall use uint32_t
- All variables representing DRM pixel formats shall use PixelFormat
- Functions returning positive values only shall not have a signed
return type
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>
|
|
Now that Object::invokeMethod() supports returning a value, use it and
drop the return value method argument.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The __open_2() and __openat_2() functions are defined by glibc as taking
2 and 3 arguments respectively, with variadic arguments for the file
mode as open() and openat() do. The V4L2 compatibility layer defines
them as aliases for open() and openat(), which results in compilation
failures with gcc:
../../src/v4l2/v4l2_compat.cpp: In function ‘int __openat_2(int, const char*, int)’:
../../src/v4l2/v4l2_compat.cpp:58:14: error: invalid conversion from ‘int’ to ‘const char*’ [-fpermissive]
58 | return open(dirfd, path, oflag);
| ^~~~~
| |
| int
../../src/v4l2/v4l2_compat.cpp:31:39: note: initializing argument 1 of ‘int open(const char*, int, ...)’
31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)
| ~~~~~~~~~~~~^~~~
../../src/v4l2/v4l2_compat.cpp:58:21: error: invalid conversion from ‘const char*’ to ‘int’ [-fpermissive]
58 | return open(dirfd, path, oflag);
| ^~~~
| |
| const char*
../../src/v4l2/v4l2_compat.cpp:31:49: note: initializing argument 2 of ‘int open(const char*, int, ...)’
31 | LIBCAMERA_PUBLIC int open(const char *path, int oflag, ...)
|
Fix this by defining the two functions as wrappers around open() and
openat() without variadic arguments.
Fixes: 0ce8f2390b52 ("v4l2: v4l2_compat: Add V4L2 compatibility layer")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
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>
|