Age | Commit message (Collapse) | Author |
|
Use the d-pointer infrastructure offered by the Extensible class to
replace the custom implementation.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
The d-pointer design patterns helps creating public classes that can be
extended without breaking their ABI. To facilitate usage of the pattern
in libcamera, create a base Extensible class with associated macros.
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>
|
|
Add a formatter to ensure consistent naming of 'd' and 'o' variables
related to the d-pointer design pattern, as implemented by the
Extensible class. The formatter also ensures that the pointer is always
const. const-correctness issues related to the data pointed to will be
caught by the compiler, and thus don't need to be checked here.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When closing the libcamerasrc, the reference to camera is released and
the camera manager is stopped. However, the camera configuration still
exists at that point, and holds a reference to the camera. This leads to
a warning from the device enumerator complaining that the media devices
are still in use:
[1:53:48.792327560] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media1 while still in use
[1:53:48.792354022] [408] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media0 while still in use
A crash follows when the libcamerasrc is finalized, as deleting the
camera configuration will then release the last reference to the camera,
which attempts to delete the camera object with deleteLater() without an
event dispatcher.
Fix it by deleting the camera configuration before stopping the camera
manager.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
|
|
The V4L2DeviceFormat class now has default initializers for all members,
explicit initialization isn't needed anymore.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When setting (or trying) a format with a multiplanar device, the
V4L2VideoDevice::trySetFormatMeta() function iterates over all planes
available in the V4L2DeviceFormat structure. The caller is responsible
for setting the plane count, and failure to do so properly may result in
memory corruption. This can lead to a crash way after the function
returns, making the problem difficult to debug.
As the issue is caused by a bug in the caller, use an assertion to catch
it.
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 V4L2DeviceFormat class doesn't have a default constructor, neither
does it specifies default member initializers for the plane-related
members. This results in the planes array and planesCount members being
uninitialized by default, leading to undefined behaviour if the user of
the class doesn't initialize it explicitly.
Most users initialize V4L2DeviceFormat instances, but some don't. We
could fix them, but that would likely turn into a game of whack-a-mole.
As there's no use case for instantiating a large number of
V4L2DeviceFormat instances in a performance-critical code path, let's
instead add default initializers to avoid future issues.
While at it, define a type of the structures containing plane
information, and use an std::array.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add support for 24-bit and 32-bit RGB formats. The fragment samples the
texture and reorders the components, using a pattern set through the
RGB_PATTERN macro. The pattern stores the shader vec4 element indices
(named {r, g, b, a} by convention, for elements 0 to 3) to be extracted
from the texture samples, when interpreted by OpenGL as RGBA.
Note that, as textures are created with GL_UNSIGNED_BYTE, the RGBA
order corresponds to bytes in memory, while the libcamera formats are
named based on the components order in a 32-bit word stored in memory in
little endian format.
An alternative to manual reordering in the shader would be to set the
texture swizzling mask. This is however not available in OpenGL ES
before version 3.0, which we don't mandate at the moment.
Only the BGR888 and RGB888 formats have been tested, with the vimc
pipeline handler.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
In preparation for RGB formats support, store the three Y, U and V
textures in an array. This makes the code more generic, and will avoid
referring to an RGB texture as textureY_.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
In preparation for RGB formats support, rename the pointer to image data
from yuvData_ to data_.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
In preparation for RGB formats support, rename the identity vertex
shader from YUV.vert to identity.vert.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
There's no need to cast the yuvData_ unsigned char pointer to a char
pointer before performing pointer arithmetics. Drop the unneeded casts.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When ViewFinderGL::setFormat() is called, the fragment shader is deleted
and recreated for the new format. This results in unnecessary shader
recompilation if only the size is changed and the pixel format remains
the same. Keep the existing shader in that case.
The null test for fragmentShader_ can be removed, as if the shader
program is linked, the fragment shader is guaranteed to exist.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
When setting a new format, the existing fragment shader is deleted and a
new shader should be created. However, the shader pointer isn't set to
nullptr after deleting it, resulting in the deleter shader being reused.
Fix it by managing shader pointers with std::unique_ptr<> to prevent
similar bugs from happening in the future.
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 SPDX headers and copyright notices to the tracepoints definition
files.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add guide for tracepoints, including how to define and use them.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a script that scans a trace for IPA call tracepoints, and returns
statistics on the time taken for IPA calls.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add and use tracepoints in Request. Requests are core to libcamera
operation, thus detecting delays in their processing is important, and
serves as a good usage example of tracepoints.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Implement tracing infrastructure in libcamera. It takes .tp files, as
required by lttng, and generates a tracepoint header and C file, as lttng
requires. meson is updated accordingly to get it to compile with the
rest of libcamera. Update the documentation accordingly.
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
We're not using gerrit, so let's prevent Change-Id tags creeping in
unadvertently.
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 class IPAManager has no method ipaCreate, but the method createIPA.
s/pipeline handlers call the IPAManager::ipaCreate()
/pipeline handlers call the IPAManager::createIPA()
Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.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>
|
|
Embed a Jpeg-encoded thumbnail into Exif metadata using the Thumbnailer
class that got introduced.
Introduce a helper function in Exif class for setting the thumbnail
data.
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
[Kieran: Add todo comment, and Compression enum]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Add a basic image Thumbnailer class for the frames being captured.
Currently, the thumbnailer can scale NV12 frames. It shall be used
to generate a thumbnail image for EXIF metadata, in the subsequent
commit.
Signed-off-by: Umang Jain <email@uajain.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>
|
|
Allow encoding frames which are directly handed over to the encoder
via a span or vector i.e. a raw frame bytes. Introduce an overloaded
EncoderLibJpeg::encode() with libcamera::Span source parameter to
achieve this functionality. This makes the libjpeg-encoder a bit
flexible for use case such as compressing a thumbnail generated for
Exif.
Signed-off-by: Umang Jain <email@uajain.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>
|
|
CameraDevice::toPixelFormat() doesn't change the state of the
CameraDevice. Marks it a const function so that it can be called
in const functions.
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
std::map::at() searches std::map by the given key. The commit
e1f9fdb8a5bd ("android: camera_device: Remove shadowing FrameBuffer
usage") uses it with 0 to intend to accessing the first element of the
map, but actually access the element whose key is nullptr. This causes
the crash because the map doesn't have the element with nullptr. This
fixes the issue by replacing the std::map::at() operation by
std::map::begin().
Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
[Kieran: Updated commit message]
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
The last assignment of the ret variable in getControls() is not consumed
so it's unnecessary to set it. This likely originates from a similar
code flow in setControls() where the ret variable is later consumed.
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>
|
|
The mutex_ stored in the CameraManager::Private class is used to protect
members that may need to be accessed from const functions. Make it
mutable to allow this.
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>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
Following the C++17 practice, provide is_array_v<T> and is_span_v<T>
helper variable templates as shorter versions of is_array<T>::value and
is_span<T>::value, and use them through the code.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
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>
|
|
If converter_->open() fails, the code deletes the converter_ but then
happily goes on, and at the very next lines will use converter_ to
connect the bufferReady signal.
Ensure the converter is only connected when successfully opened by
extending the conditional and connecting in an else scope instead.
Reported-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The method calls setFormat(), stores the return value, but then does not
do anything with the return value. I presume it is meant to fail and
return the error.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Having .clang-tidy file will give us a 'clang-tidy' meson build target,
so doing a full clang-tidy run can be done just by:
ninja -C build clang-tidy
I did not look at if more checks should be enabled or not. I disabled
clang-diagnostic-c99-designator as that feature was used in the code,
and I see no harm with the feature.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
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>
|
|
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
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>
|
|
Initialise it to show we support its use, however, set it to all
zeroes to indicate that it's not meaningful yet.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The SensorCropMaximum camera property reports the location of that
part of the image sensor array that can be scaled to produce the
output images, given in native sensor pixels. It will normally change
when a new camera mode is selected, and can be used to implement
digital zoom.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The ScalerCrop control selects how much of the sensor's active pixel
array will be scaled to form the final output image. It can be used to
implement digital zoom.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
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>
|
|
s/Start and the stop the image acquisition/
/Start and stop the image acquisition/
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Acked-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Sebastian Fricke <sebastian.fricke.linux@gmail.com>
|
|
Register the ANDROID_STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES
static metadata property inspecting the values retuned by the pipeline
handler.
Add one entry and reserve in static metadata pack enough space to
support all the 2 available lens shading map modes Android defines.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Register the ANDROID_COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES
static metadata property inspecting the values retuned by the pipeline
handler.
Reserve in the static metadata pack enough space to support all the 3
available color correction aberration modes Android defines.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Register the ANDROID_NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES
static metadata property inspecting the values retuned by the pipeline
handler.
Reserve in the static metadata pack enough space to support all the 5
available noise reduction modes Android defines.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Register the ANDROID_REQUEST_PIPELINE_MAX_DEPTH static property
inspecting the value reported by the pipeline handler.
If the Camera does not report any suitable value, default the
static property to 2.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Register controls for the IPU3 pipeline handler. The only supported
Camera control is currently the pipeline depth control.
Report the minimum and maximum values the pipeline handler supports for
the pipeline processing stages and report for each request the pipeline
depth describing the number of processing steps the frames went through.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The libcamera control definition schema includes a placeholder
maximum value for each enumeration of supported values.
As it is now possible to create ControlInfo from the list of enumerated
values, it is not necessary to generate the placeholder value anymore.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-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>
|
|
Remove an extra whitespace in the declaration of a dictionary entry in
gen-controls.py script.
Reviewed-by: Laurent Pinchart <laurent.pinchart@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>
|