Age | Commit message (Collapse) | Author |
|
Cache the V4L2 control info retrieved with VIDIOC_QUERY_EXT_CTRL
at control listing time for later use.
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Extend the ControlValue class with a reserve() function to set the value
without actually copying data, and a non-const data() function that
allows writing data directly to the ControlValue storage. This allows
allocating memory directly in ControlValue, potentially removing a data
copy.
Note that this change was implemented before ByteStreamBuffer gained the
zero-copy read() variant, and doesn't actually save a copy in the
control serializer. It however still simplifies
ControlSerializer::loadControlValue().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Replace usage of shared_ptr with unique_ptr to convey media device
ownership internally in the enumerators when creating the media device.
Once a media device has all its dependencies met, it is converted to a
shared_ptr to keep the external API unchanged.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Media devices that have unmet dependencies are added to the pending list
in populateMediaDevice(). Move the code to the caller, addUdevDevice(),
as it logically belongs there.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
No code change.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Commit 68daa9302f90 ("libcamera: device_enumerator: Don't stop if one
device fails") introduced a bug in device enumeration. Previously, a
media device would only be added when all its dependencies were present,
as indicated by populateMediaDevice() returning 0. The commit changed
the logic to propagate the populateMediaDevice() return code up, but
mistakenly added the media device to the enumerator even when
dependencies were missing. This causes media devices enumerated with
missing dependencies to be added twice, once when enumerating the media
device itself, and a second time when all the dependencies are found.
Fix it by deferring addition of the media device when dependencies are
missing, and add debug messages to track this process.
Fixes: 68daa9302f90 ("libcamera: device_enumerator: Don't stop if one device fails")
Reported-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
This is a partial revert of commit 0028536d70c7, removing a change that
was incorrectly squashed.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
There is a todo written in the doxygen documentation of
device_enumerator which is already completed, hence remove it from the
documentation.
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The ControlValue class size should be minimized to save space, as it can
be instantiated in large numbers. The current implementation does so by
specifying several members as bitfields, but does so too aggressively,
resulting in fields being packed in an inefficient to access way on some
platforms. For instance, on 32-bit x86, the numElements_ field is offset
by 7 bits in a 32-bit word. This additionally causes a static assert
that checks the size of the class to fail.
Relax the constraints on the isArray_ and numElements_ fields to avoid
inefficient access, and to ensure that the class size is identical
across all platforms. This will need to be revisited anyway when
stabilizing the ABI, so add a \todo comment as a reminder.
Fixes: 1fa4b43402a0 ("libcamera: controls: Support array controls in ControlValue")
Reported-by: Jan Engelhardt <jengelh@inai.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The size of the ControlValue class is checked by a static_assert() to
avoid accidental ABI breakages. There's no need to perform the check
every time controls.h is included, move it to controls.cpp.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
String controls are stored internally as an array of char, but the
ControlValue constructor, get() and set() functions operate on an
std::string for convenience. Array of strings are thus not supported.
Unlike for other control types, the ControlInfo range reports the
minimum and maximum allowed lengths of the string (the minimum will
usually be 0), not the minimum and maximum value of each element.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
To prepare for storage of additional information in the ControlRange
structure, rename it to ControlInfo.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
To prepare for the rename of ControlRange to ControlInfo, rename all the
ControlInfoMap instance variables currently named info to infoMap. This
will help avoiding namespace clashes.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
When printing camera properties, print one property per line.
Fixes: a14b6baca9af ("cam: Add option to list camera properties")
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
On failure, the return code from V4L2Device::ioctl() is the negative error
code set by the failed ::ioctl() system call. When the return code of
V4L2Device::ioctl() is provided to strerror() it has to be negated again
to obtain the positive error code. Fix a few wrong usages of the return
code which provided to the strerror() function a negative error code.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Link between resizer and capture is immutable and doesn't need to be
enabled.
Signed-off-by: Helen Koike <helen.koike@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When folding buffer management with start/stop the wrong variable was
passed to importBuffers() resulting in only one buffer being imported
for the video node making capture impossible. Fix this by first renaming
the confusingly named variable 'count' to 'ipaBufferId'. And then
reusing the 'count' name for the buffer count.
While at it remove the loop to find the maximum value of buffers from
the single stream used by the pipeline. Once we add more stream this
needs to be reworked anyhow so keep it simple for now.
Fixes: 33fedea818e2b6a9 ("libcamera: pipeline_handler: Fold buffer management with start/stop")
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The two callers of functions libcameraPath() and isLibcameraInstalled()
end up using the same process and finally use the path with
libcamera.so. Hence write a function libcameraBuildPath() which
combines their functions and returns the root of the build sources
when the library has not been installed, but is running from the build
tree, thereby making call sites simpler.
When the library is installed, libcameraBuildPath() will return an empty
string.
Make changes in the call sites accordingly.
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
To achieve the goal of preventing unwanted conversion between a DRM and
a V4L2 FourCC, make the V4L2PixelFormat constructor that takes an
integer value explicit. All users of V4L2 pixel formats flagged by the
compiler are fixed.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Now that the functions return a V4L2PixelFormat, adapt their name
accordingly.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The V4L2PixelFormat class describes the pixel format of a V4L2 buffer.
It wraps the V4L2 numerical FourCC, and shall be used in all APIs that
deal with V4L2 pixel formats. Its purpose is to prevent unintentional
confusion of V4L2 and DRM FourCCs in code by catching implicit
conversion attempts at compile time.
The constructor taking a V4L2 FourCC integer value will be made explicit
in a further commit to minimize the size of this change and keep it
reviewable.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The QImageWriter defaults to an image quality value of 75 which can lead
to perceivable visual artefacts.
Improve the quality of the output by explicitly setting the image
quality to 95.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The SizeRange constructors take minimum and maximum width and height
values as separate arguments. We have a Size class to convey size
information, use it in the constructors, and update the callers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The Camera class currently requires the allocator to have no allocated
buffer before the camera is reconfigured, and the allocator to be
destroyed before the camera is released. There's no basis for these
restrictions anymore, remove them.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
There's no need anymore to have the Camera object control how and when
pipeline handlers allocate and free the buffers for the
application-facing video devices. Fold those operations, currently
performed by importFrameBuffers() and freeFrameBuffers(), into the
start() and stop() functions. This simplifies the pipeline handler API,
its implementation, and the implementation of the Camera class.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Use the V4L2 buffer orphaning feature, exposed through
V4L2VideoDevice::exportBuffers(), to decouple buffer import and export.
The PipelineHandler::importFrameBuffers() function is now called for all
streams regardless of whether exportFrameBuffers() has been called or
not. This simplifies the Camera implementation slightly, and opens the
door to additional simplifications.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The PipelineHandler::importFrameBuffer() function, called by
Camera::start() may return an error, but its return value is ignored.
Propagate it to the caller to fix this.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add a new exportBuffers() function that only performs buffer allocation
and export, but leaves the V4L2 buffer queue unallocated on return. This
function will be used to simplify buffer allocation for pipeline
handlers. This is made possible by the V4L2 buffer orphaning feature
introduced in Linux v5.0, so add a version check to catch and report
issues early.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Move the buffer creation code out of allocateBuffers() to a
createBuffers() function. This prepare for the rework of buffer export
and will avoid code duplication.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
To prepare for the rework of buffer export, pass the memory type
explicitly to the V4L2VideoDevice::reqbufs() function.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
To prepare for the rework of buffer allocation that will differentiate
export and allocation, rename exportBuffers() to allocateBuffers().
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
const reference
PixelFormat was previously an alias for unsigned int but is now a
class. Make all functions taking PixelFormat do so as a const reference.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
To achieve the goal of preventing unwanted conversion between a DRM and
a V4L2 FourCC, make the PixelFormat constructor that takes an integer
value explicit. All users of pixel formats flagged by the compiler
are fixed.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Create a class to represent a pixel format. This is done to add support
for modifiers for the formats. So far no modifiers are added by any
pipeline handler, all plumbing to deal with them is however in place.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
When generating a camera configuration, pixel formats from the video
device are used directly. They however contain V4L2 pixel format
FourCCs, not DRM pixel format FourCCs. Translate the pixel formats to
DRM before using them in the camera configuration.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
There is no need to use the ImageFormats helper to generate a map of
PixelFormat to sizes, use std::map directly.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Instead of having to include linux/drm_fourcc.h everywhere a DRM FourCC
is used in conjunction with PixelFormat include the header directly in
pixelformats.h.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Use the PixelFormat instead of unsigned int where a pixel format is to
be used. PixelFormat is defined as an unsigned int but is about to be
turned into a class to add functionality.
There is no functional change in this patch.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
When libcamera is built and tested before installing, it will
be unable to locate the path to proxy workers, or previously
installed files in the system path may be incorrect to load.
Hence, when libcamera is not installed, but is running from a build
tree, identify the location of that tree by using libcameraPath(), and
from that point add relative path to the proxy workers directory.
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The IPA proxy manager will need to find the libcamera build path exactly
the same way as the IPA module mnager. Move the isLibcameraInstalled()
and libcameraPath() functions to utils to make them reusable.
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
User environment path in LIBCAMERA_IPA_PROXY_PATH should take precedence
over system loading locations. Change precedence accordingly
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Replace the manual string splitting with utils::split()
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The stream in the stream configuration is not filled in before we
configure the camera, move the generating and caching of names after the
configuration.
Without this fix writing multiple streams to disk overwrites the frames
as the filenames are not unique.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add further support to the pixel format convertor to allow ARGB, RGBA,
and ABGR formats to be displayed in qcam.
Blank lines are added between the sections for NV, RGB, YUV, and MJPEG
configurations.
The implementation of the RGB conversions are highly inefficient, and
where possible should be extended to use hardware accelerations such as
OpenGL, or in the event that the input format is identical (or
compatible) with the output format - a more optimised memcpy should be
implemented.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
gcc 8.3.0 for ARM complains about strict aliasing violations:
../../src/libcamera/controls.cpp: In member function ‘void libcamera::ControlValue::release()’:
../../src/libcamera/controls.cpp:111:13: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
delete[] *reinterpret_cast<char **>(&storage_);
Fix it and simplify the code at the same time.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
When compiling for ARM and uClibc, gcc-8.3.0 complains about comparison
of integer expressions of different signedness:
../../src/v4l2/v4l2_camera_proxy.cpp: In member function ‘void* V4L2CameraProxy::mmap(void*, size_t, int, int, off_t)’:
../../src/v4l2/v4l2_camera_proxy.cpp:88:25: error: comparison of integer expressions of different signedness: ‘unsigned int’ and ‘off_t’ {aka ‘long int’} [-Werror=sign-compare]
if (index * sizeimage_ != offset || length != sizeimage_) {
~~~~~~~~~~~~~~~~~~~^~~~~~~~~
Fix the compilation error with a cast.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The v4l2-compat shared library is declared as depending on
libcamera_deps. This is not correct, as libcamera_deps contains the
dependencies of libcamera itself. The correct dependency for users of
libcamera is libcamera_dep.
Fixing this allows dropping libcamera_includes from the list of includes
required by v4l2-compat, and libcamera from the link_with list, as they
are already contained in libcamera_dep. We however need to add an
explicit dependency on libdl which was previously provided by
libcamera_deps.
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>
|
|
The cam application makes use if std::atomic<>, link against libatomic
if needed.
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>
|
|
libcamera.so links against libatomic and libdl, and handles those
dependencies directly in the shared_object() call. More components
within libcamera will need those dependencies, extract them to named
variables to make them reusable.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The libcamera_api array is meant to contain all the headers from the
libcamera public API, for the purpose of generating documentation and
creating the libcamera_dep dependency. libcamera.h is part of the
libcamera public API, add it to the array.
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>
|