Age | Commit message (Collapse) | Author |
|
C++17 introduces helper variable templates for type traits, allowing
shortening std::is_foo<T>::value to std::is_foo_v<T>. Use them through
the code base.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
During configure() we update the ScalerCropMaximum to the correct
value for this camera mode and work out the minimum crop size allowed
by the ISP.
Whenever a new ScalerCrop request is received we check it's valid and
apply it to the ISP V4L2 device. When the IPA returns its metadata to
us we add the ScalerCrop information, rescaled to sensor native
pixels.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
These functions are aimed at making it easier to calculate cropping
rectangles, particularly in order to implement digital zoom.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The C++20 std::span class, after which Span is modelled, specifies four
constructors as explicit when extent is not dynamic_extent. Align our
implementation with those requirements.
A careful reviewer may notice that this change addresses five
constructors, not four. The reason is that the two constructors taking
Container and const Container parameters are not specified in C++20,
which uses a single constructor taking a range parameter instead. As
ranges are not available in C++17, the Container constructors are our
best effort at providing a similar feature.
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>
|
|
Initialize the ControlInfoMap of controls supported by the Raspberry Pi
pipeline handler and IPA using the list of the enumerated values instead
of specifying them manually.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
For each Control that supports enumerated values generate an array
of ControlValue which contains the full list of valid values.
At the expense of a slight increase in memory occupation this change
allows the construction of the ControlInfo associated with a Control
from the values list, defaulting the minimum and maximum values
reported by the ControlInfo.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a new constructor to the ControlInfo class that allows creating
a class instance from the list of the control valid values with
an optional default one.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Extend the control and property framework to support exposing draft
controls and properties in a scoped namespace.
The controls/properties themselves will retain the same ordering in the
relevant enum/id maps - but the access to any draft control will require
explicitly referencing through its' draft:: namespace prefix.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
[Added missing hunk in control_ids.cpp.in and changed subject]
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The ControlValue<T> constructor for non-array values is a template
function that participates in overload resolution for all T types that
are not Span or std::string. Other T types that are not supported then
result in a compilation error.
This causes issues when calling an overloaded function that can accept
both a ControlValue and a Span with an std::array<U> parameter. The
first overload will be resolved using implicit construction of a
ControlValue from the std::array<U>, while the second overload will be
resolved using implicit construction of a Span<U> from the
std::array<U>. This results in a compilation error due to an ambiguous
function call.
The first overload is invalid, selecting it would result in a
compilation error in the ControlValue constructor, as the
ControlValue<T> constructor doesn't support std::array<U> for type T.
The compiler can't know about that, as overload resolution happens
earlier.
To fix it, we can disable the ControlValue<T> constructor for
unsupported types T, moving the type check from compilation of the
function to overload resolution. The constructor will not participate in
overload resolution, and the call won't be ambiguous. The end result is
the same for unsupported types, compilation will fail.
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The base class of polymorphic classes is required to declare a
destructor. Several of these are empty, and can thus be declared as
defaulted.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
A few default constructors and destructors are needlessly defined as
empty. Drop them.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The MediaEntity, MediaLink and MediaPad classes don't need custom
destructors. For MediaEntity and MediaPad, the destructors clear a
vector embedded in the classes, which will be done by the default
destructor. For MediaLink, the destructor is already empty. Remove them.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The members free, and lastUsed were not following the libcamera coding
style, and were producing a shadowed parameter on the construction.
Rename them to be marked as member variables with the _ postfix
accordingly.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The pipeline-specific IPA headers are not part of the libcamera API,
they should thus be skipped when generating documentation. doxygen
doesn't complain currently due to the fact that types defined in those
headers are part of undocumented namespaces. In preparation for
documenting the libcamera namespace, make sure the headers don't get
parsed by doxygen.
Only vimc.h needs a header guard, as rkisp1.h uses the global namespace
and raspberrypi.h uses the undocumented libcamera::RPi namespace,
neither of which cause issues. Still, for consistency, add header guards
to all headers.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
To be consistent with the other pipeline handlers that don't prefix
their IPA protocol header with ipa_, rename ipa_vimc.h to vimc.h.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
This removes the unnecessary semicolon in span.h.
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The V4L2_CID_USER_BCM2835_ISP_BASE has changed in the downstream
Raspberry Pi 5.9 kernel to match the upstream defines, see here:
https://github.com/raspberrypi/linux/pull/3897.
Note, that this will cause an ABI breakage with the current downstream
Raspberry Pi 5.4 kernel until both this change and the following PR has
been merged: https://github.com/raspberrypi/linux/pull/3897
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Allow reuse of the Request object by implementing reuse(). This means
the applications now have the responsibility of freeing the Request
objects, so make all libcamera users (cam, qcam, v4l2-compat, gstreamer,
android) do so.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
If any Process instances are destroyed after the ProcessManager is
destroyed, then a segfault will occur.
Fix this by making the lifetime of the ProcessManager explicit, and make
the CameraManager construct and deconstruct (automatically, via a member
variable) the ProcessManager.
Update the tests accordingly.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add method that removes non-ASCII characters from a string.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <email@uajain.com>
|
|
The custom implementation of the copy assignment operator is identical
to the one the compiler would generate. Replace it by the default.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
With the buffer copy removed from all pipelines for raw capture
rename StillCaptureRaw to Raw to better describe the role.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Change variable names to camel case to be consistent with the rest of
the source files. Remove #define consts and replace with constexpr.
Add some newlines to make the code more readable.
There are no functional changes in this commit.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Rebase merge conflicts resolved]
[Kieran: Fix checkstyle line under 80 chars]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
All IPA related types/params are now moved to the RPi namespace.
There are no functional changes in this commit.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[Kieran: Rebase merge conflicts fixed]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a field to the CameraConfiguration (including the necessary
documentation) to represent a 2D transform requested by the
application. All pipeline handlers are amended to coerce this to the
Identity, marking the configuration as "adjusted" if something
different had been requested.
Pipeline handlers that support Transforms can be amended subsequently.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
This type encodes BayerFormats in an explicit way, that makes them
easier to use than some of the other more opaque type formats. This
makes the BayerFormat useful for editing or manipulating Bayer types
more easily.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
We implement 2D transforms as an enum class with 8 elements,
consisting of the usual 2D plane transformations (flips, rotations
etc.).
The transform is made up of 3 bits, indicating whether the transform
includes: a transpose, a horizontal flip (mirror) and a vertical flip.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The V4L2Device::controlInfo method simply returns a pointer to the
v4l2_query_ext_ctrl structure for the given control, which has already
been retrieved and stored.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Refresh the RkISP1 user-space header to match the latest state in the
media-tree [1]. This requires update of symbol names in the RkISP1 IPA
but there is no functional change.
Unfortunately the upstream header has a few problems that needs to be
fixed before it can be used.
1. The SPDX header does not satisfy the Linux scripts/headers_install.sh
so the installation step have to be done manually (dropping _UAPI
prefix from header include guard). Issue is reported upstream.
2. The BIT() macro is used in the header but unfortunately this macro
is not accessible in user-space headers. Fix this by reverting back
to open code setting the bit without macro. Fix submitted upstream
and acked by maintainer.
1. d7a81a5b07313535 ("media: staging: rkisp1: uapi: remove __packed")
2. [PATCH v2] staging: rkisp1: uapi: Do not use BIT() macro
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
FrameBufferAllocator is supposed to delete copy constructor and
copy-assignment operator. It doesn't do that as it uses Camera as a
parameter instead of FrameBufferAllocator.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
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>
|
|
Move the GPL2 utilities which handle generation of controls, formats and
the top level libcamera header to the utils subtree.
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
There are no user left of the copyFrom() operation, remove it.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Handle the case where a FrameBuffer that has been externally allocated
(i.e. not through the v4l2 video device) is passed into a Request.
We must store the buffer pointer in the stream internal buffer list to
identify when used.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The IPA now signals up front how many frames it wants the pipeline
handler to drop. This makes it easier to handle up-coming changes to the
buffer handling for import/export buffers.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The ipc_unixsocket.h and process.h internal headers don't need to
include event_notifier.h, the former because a forward declaration
suffices, and the latter because it doesn't use event notifiers. Remove
the unnecessary include, and include signal.h instead which is required
and was included indirectly through event_notifier.h.
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>
|
|
We build libcamera with -Wno-unused-parameter and this doesn't cause
much issue internally. However, it prevents catching unused parameters
in inline functions defined in public headers. This can lead to
compilation warnings for applications compiled without
-Wno-unused-parameter.
To catch those issues, remove -Wno-unused-parameter and fix all the
related warnings with [[maybe_unused]].
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 libcamera uses C++17, the C++ standard library provides
std::clamp(). Drop our custom utils::clamp() function.
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>
|
|
In C++, unlike in C, a function that takes no argument doesn't need to
specify void in the arguments list. Drop the unnecessary specifiers.
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>
|
|
Reading the controls and properties does not modify the camera's state
and can be marked as const operations.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
operations
Reading the controls and properties does not modify the pipeline's state
and can be marked as const operations.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a version of cameraData() that returns a const pointer and mark it
as a const operation. The assert in the non-const version of the
function already enforces that a std::map::at() operation would always
succeed so there is no change in operation from the non-const version.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The Stream pointer just acts as a key in the Request object. There is no
good use-case to modify a stream from a pointer retrieved from the
Request, make it const. This allows pipeline handlers to better express
that the Stream pointer is retrieved in a Request should just be treated
as a key.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Declare a using directive for the map of Stream to FrameBuffer. Update
all users of Request::buffers() to use the new usage directive.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Provide a MappedFrameBuffer helper class which will map
all of the Planes within a FrameBuffer and provide CPU addressable
pointers for those planes.
The MappedFrameBuffer implements the interface of the MappedBuffer
allowing other buffer types to be constructed of the same form, with a
common interface and cleanup.
This allows MappedBuffer instances to be created from Camera3Buffer types.
Mappings are removed upon destruction.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Determine the number of planes used by a format by counting the number
of PixelFormatPlaneInfo entries with a valid entry.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Rename Camera::name() to camera::id() to better describe what it
represents, a unique and stable ID for the camera. While at it improve
the documentation for the camera ID to describe it needs to be stable
for a camera between resets of the system.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add an accessors so that the sensor ID can be used outside CameraSensor.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The ID is generated from information in the firmware description of the
sensor if available or from module and model information if the sensor
is virtual (for example VIMC).
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>
|
|
Add a method to lookup a V4L2 devices path in sysfs.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
A system's firmware description is recorded differently in sysfs
depending if the system uses DT or ACPI. Add a helper to abstract
this, allowing users not to care which of the two are used.
For DT-based systems, the path is the full name of the DT node that
represents the device. For ACPI-based systems, the path is the absolute
namespace path to the ACPI object that represents the device. In both
cases, the path is guaranteed to be unique and persistent as long as the
system firmware is not modified.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|