Age | Commit message (Collapse) | Author |
|
The different error paths in init() are out of sync. Instead of fixing
them switch to using the cleanup() function which does the right thing
for all cases.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
|
|
GCC5 does not provide prototypes for the math library functions defined
in the math.h header for the std:: namespace.
Include the C++ <cmath> header in place of <math.h> as it defines
overloads for the std::abs and std::fmod function.
This goes intentionally against the libcamera coding guidelines, and
is reported as warning by checkpatch.py.
Fixes: 968ab9bad0ed ("libcamera: ipu3: imgu: Calculate ImgU pipe configuration")
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Probe the libcamera Camera for RAW support and if supported report RAW
capability in the static metadata reported to Android.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a mapping from HAL RAW formats to the direct equivalent of libcamera
formats. With this change it is possible to capture RAW images as long
as the hardware can deliver frames in a format that is native to the
HAL.
More work is needed to deal with unpacked 8, 10 and 12 RAW formats as
they don't directly map to a native HAL format. Nor do they belong in
the RAW_OPAQUE category as the content format is generic and not
uncommonly supported by hardware.
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>
|
|
When probing what formats a libcamera Camera supports we want to allow
to probe for non-mandatory formats. Add a new flag to indicate if a
format in camera3FormatsMap is mandatory or not.
All current defined formats are mandatory.
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 --monitor to monitor new hotplug and unplug camera events from
the CameraManager.
Signed-off-by: Umang Jain <email@uajain.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>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Replace hex input for pixel formats with their format names, for input in
cam and qcam.
Hence, remove the todo.
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
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>
|
|
Add a function which retrieves pixel format corresponding to its name
from PixelFormatInfo.
Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in>
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>
|
|
Add a function which returns PixelFormatInfo, given format name as
a string.
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 ImgUDevice::configureInput() function does not only configure the
input format but applies rectangles to the IF, BDS and GDC components.
Rename it to ImgUDevice::configure().
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Instrument the ImgUDevice::configureInput() function to use the provided
pipe configuration parameters to configure the IF, BDS and GDC
rectangles.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Collect the desired ImgU pipe configuration while assigning
streams in the pipeline handler validate() function and ask the
ImgUDevice class to calculate the pipe configuration parameters.
If the requested pipe configuration results in a non-valid
configuration, return an error from the validate() function.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Instrument the ImgU component to dynamically calculate the image
manipulation pipeline intermediate sizes.
To correctly configure the ImgU it is necessary to program the IF, BDS
and GDC sizes, which are currently fixed to the input frame size.
The procedure used to calculate the intermediate sizes has been ported
from the pipe_config.py python script, available at:
https://github.com/intel/intel-ipu3-pipecfg
at revision:
61e83f2f7606 ("Add more information into README")
Define two structures (ImgUDevice::Pipe and ImgUDevice::PipeConfig)
to allow the pipeline handler to supply and retrieve configuration
parameters from the ImgU.
Finally, add a new operation to the ImgUDevice that calculates
the pipe configuration parameters based on the requested input and
output sizes.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The IPU3CameraConfiguration::camera_ shared pointer is not used.
Remove it.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The IPU3CameraConfiguration::streams_ field was used to keep an
association between the StreamConfiguration and the assigned streams
before CameraConfiguration::setStream() was called at configure() time.
The stream assignment was based on the order in which elements were
inserted in the vector, implementing a fragile association between
streams and their intended configurations.
As it is now possible to assign streams at validation time, there is no
need to keep that association in place, and the streams_ vector is now
unused.
Remove it and the associated accessor method from the
IPU3CameraConfiguration class.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Remove the adjustStream() and assignStream() methods, and perform stream
adjustment and assignment while iterating the StreamConfiguration
items.
The adjustStream() implementation had some arbitrary assumption, like
the main output having to be as large as the sensor resolution, and did
not take into account the different alignment requirements between the
main output and the viewfinder output.
The assignStream() implementation also assumes only full-size streams
can be produced by the main output, and having it as a separate function
prevents adjusting streams according to which output they are assigned.
Blend the two implementation in a single loop and perform the required
stream adjustment and assignment in one go.
As streams are now assigned at validate() time, remove the same
operation from the configure() function.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a const version of the CIO2Device::sensor() method, that retrieves
a const pointer to the sensor_ class member, to be called by users
which only own a const reference to a CIO2Device class instance.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The current implementation of the Camera::configure() method zeroes the
stream pointers assigned to the StreamConfiguration items before calling
the pipeline handler configure() operation, just after the
CameraConfiguration has been validated.
This discards the stream assignment performed at pipeline hander
validation time, requiring platforms that need to perform that early
assignment to maintain the association in place with custom data
structures.
To allow pipeline handlers to use StreamConfiguration::setStream() at
validate() time, zero the stream assignment before calling validate().
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The IPU3 pipeline handler supports 2 processed RGB/YUV streams
and one RAW stream. Validate that the requested stream combination is
supported in the pipeline handler validate() implementation and return
an error in case it's not.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The Size struct constructor defaults the width and height to 0.
Remove the empty braced-list initialization as it is not required.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Report StreamFormats associated to each StreamConfiguration generated
by the IPU3 pipeline handler.
The StreamFormats are generated differently for RAW and processed
streams, with the former using the sensor enumerated resolutions and
the latter using a continuous range of sizes constructed by matching the
sensor capabilities with the platform constraints.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The validate function overwrites the generated StreamConfiguration with
the one reported by the CIO2 unit when inspecting the RAW stream
configuration.
As we prepare to add StreamFormats to the IPU3 StreamConfiguration,
assigning to the CIO2 generated configuration would delete the
StreamFormats.
Fix this by updating relevant fields only in order to keep the
assigned StreamFormats.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add two methods to the CIO2Device class to retrieve all the supported
PixelFormats and sizes.
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Inspect the return status of validate() in the IPU3 pipeline handler
generateConfigurtion() implementation. If the generated configuration is
not valid, return a an empty configuration to the application.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Remove stream assignment from the IPU3 pipeline handler
generateConfiguration() implementation.
The function aims to provide a suitable default for the requested use
cases. Defer stream assignment to validation and only initialize sizes
and formats.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
It's common for code to check if a rectangle is null. Add a helper function
to do so and test the function in test/geometry.cpp
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add to libcamera utils library two functions to round up or down a
value to an alignment and add a test in test/utils.cpp for the two
new functions.
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The mbusCodesToInfo map actually maps media bus codes to PixelFormat
instances. Rename the map according to its actual function and while at
it drop the 'static' keyword as the map is already defined in an
anonymous namespace.
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: Jacopo Mondi <jacopo@jmondi.org>
|
|
The monitor_ and notifier_ pointers are acted on in the destructor if
not set to nullptr, the pointers are however first initialized in
init() and enumerate(). Avoid acting on uninitialized pointers by
initializing them to nullptr in the constructor.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <email@uajain.com>
|
|
Object::deleteLater() ensures that the deletion of the Object
takes place in a thread it is bound to. Deleting the Object
in a different thread is a violation according to the libcamera
threading model.
On hot-unplug of a currently streaming camera, the last reference
of Camera when dropped from the application thread (for e.g. QCam's
thread), the destructor is then called from this thread. This is not
allowed by the libcamera threading model. Camera is meant to be deleted
in the thread it is bound to - in this case the CameraManager's thread.
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
This commit adds support to schedule the deletion of an Object to the
thread it is bound to (similar to [1]). An Object getting destroyed
by a different thread is considered as a violation as per the
libcamera threading model.
This will be useful for an Object where its ownership is shared via
shared pointers in different threads. If the thread which drops the
last reference of the Object is a different thread, the destructors
get called in that particular thread, not the one Object is bound to.
Hence, in order to resolve this kind of situation, the creation of
shared pointer can be accompanied by a custom deleter which in turns
use deleteLater() to ensure the Object is destroyed in its own thread.
[1] https://doc.qt.io/qt-5/qobject.html#deleteLater
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Extend the current dispatchMessages() to support dispatching of
selective messsages according to the Message::Type passed in
the function argument. dispatchMessages() can now be called
explicitly to force deliver selected type's message to the
thread for processing (typically when event loop is not
running).
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add definition of pixel array related properties.
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Ricardo Ribalda <ricardo@ribalda.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
If the currently streaming camera is hot-unplugged, a camera reference
was still held by MainWindow::camera_, preventing it to be destructed,
until qcam window is closed. Plug the leak in the hot-unplug handler
itself.
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Signed-off-by: Umang Jain <email@uajain.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Now SimpleCameraData::setupFormats() can fail if the camera sensor
supports media bus code which some entities down the pipeline don't.
When this happens continue with the next media bus code instead of
aborting the enumeration of the possible pipeline configurations.
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Change SimpleCameraData::setupFormats() to return -EINVAL if the sink
pad of the link doesn't support the format set on the source pad of this
link.
Signed-off-by: Andrey Konovalov <andrey.konovalov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
The SimpleCameraData::init() function needs to setup links along the
pipeline, but doesn't need to repeat that operation for each media bus
code it tries. Move the link setup before the loop.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
|
|
Add support for 16-bit Bayer formats.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Extend the '--capture' option with and optional numerical argument to be
able to specify how many frames to capture before exiting. If the
optional argument is not provided the old behavior of running until the
user interrupts with a SIGINT is retained.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Prepare for the ability to exit the event loop based on conditions in
the request complete handler by caching the pointer instead of passing
it as an argument.
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a '--strict-formats' option which fails the camera configuration
step if the format is adjusted,
Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add a debug log point to indicate a request has completed.
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
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>
|
|
When a libcamera::process is being destructed or called kill() without a
previous successful call to start(), it's pid_ may remains -1, which
causes all the killable processes being killed when passed to
`kill(pid_, SIG_KILL)`.
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
|
|
Fix a typo in the word "Unsupported".
Signed-off-by: You-Sheng Yang <vicamo.yang@canonical.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 patch improves the colour information recorded in DNG files using
the ColourCorrectionMatrix metadata for the image. Note that we are
not supplying a full calibration using two illuminants, nonetheless
the single matrix here appears to be respected by a number of tools.
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>
|
|
Implements, for the Raspberry Pi platform, the returning of the CCM
(Colour Correction Matrix) used by the pipeline in the libcamera
metadata.
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>
|
|
This control is principally for returning, in the image metadata, the
CCM (Colour Correction Matrix) used by the imaging pipeline. By which
we mean the 3x3 matrix that is applied to the camera RGB pixels after
subtraction of black levels and white-balancing, but before any gamma
transformation.
Some implementations may also choose to let an application set
explicit colour matrices, using this as a control.
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>
|
|
Define the ANDROID_REQUEST_MAX_NUM_INPUT_STREAMS to zero to inform users
the HAL does not support any reprocessing.
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 scaler format information was only used for the
ANDROID_SCALER_AVAILABLE_FORMATS tag which is deprecated and removed. As
it has no other users remove it.
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>
|