Age | Commit message (Collapse) | Author |
|
Now that we stop the asynchronous thread on a SwitchMode, we would do
better to regenerate all the tables if the new camera mode crops in a
significantly different way to the old one. A few minor tweaks make
sense along with this:
* Reset the lambda values when we reset everything. It wouldn't make
sense to re-start with the old mode's values.
* Use the last recorded colour temperature to generate new tables rather
than any default value.
* Set the frame "phase" counter to ensure the adaptive procedure will
run asap.
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>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
|
|
This fixes a bug where the luminance correction table was not being
resampled according to the camera mode, in the same way as the colour
tables. This could be noticeable if any camera modes crop
aggressively.
This resampling can be done "up front" in the SwitchMode, as we have
only a single fixed luminance table. In order to protect the
recalculation of the table from the asynchronous thread (which reads
it) I've elected to wait for that thread to go idle (though I doubt it
would have mattered much). As a by-product of stopping the thread, it
no longer needs its own copy of the camera mode (async_camera_mode_).
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Fix up a few locations where we call notify_one() with the lock
held. In particular, restartAsync does not need to be called with the
lock held for its entire duration.
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
In the libcamera framework, SwitchMode (which overwrites the
camera_mode) cannot run concurrently with Prepare (which uses it).
Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
|
|
Add 5 controls to the generate preview template to comply with the
camera3 specification.
This change fixes CTS 9.0.r12 test:
android.hardware.camera2.cts.CameraDeviceTest#testCameraDevicePreviewTemplate
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Currently the request template returned from
CameraDevice::constructDefaultRequestSettings() is the same for all
the supported template types.
To prepare to adjust the template depending on the use case, break out
the template generation to a dedicated function that supports the
PREVIEW use case. All the other template types use the
requestTemplatePreview() function and just update the capture intent
property.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
Add a method to update an existing metadata tag entry, by wrapping
the update_metadata_entry() function provided by the Android
metadata library.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The request capture templates stored in the
CameraDevice::requestTemplates_ should not be modified once created.
Store a const pointer to the request templates in the class member
map.
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 const version of the CameraMetadata::get() method to retrieve
a const pointer to the camera metadata wrapped by the class instance.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
The CameraMetadata::isValid() method does not modify the object state
and can be called on const instances of the CameraMetadata class.
Mark the method as const to allow that.
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
|
|
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>
|