Commit graph

3766 commits

Author SHA1 Message Date
Kieran Bingham
260b0e1a4c qcam: main_window: Fix include ordering
Fix the sort order of the Qt headers to match the expected
sort order from clang-format.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-18 23:18:03 +01:00
Jacopo Mondi
5ef59cd190 libcamera: raspberry: Fix format validation
If the pixel format gets adjusted to the default NV12 format during
validation, it gets currently ignored and the user-supplied format is
used nonetheless.

Fix it by using the adjusted pixel format.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-18 10:00:52 +02:00
Jacopo Mondi
e9b6b36282 cam: sdl: Use uint32_t in place of SDL_PixelFormatEnum
The SDL_PixelFormatEnum type has been introduced in libsdl by
1a4c0d4e17e6 ("Fixed bug 4377 - SDL_PIXELFORMAT enum is anonymous, which
prevents its use in a templated function") which is only available after
release 2.0.10 of the library.

Debian 10 ships libsdl at version 2.0.9 and building cam with sdl
support there fails with error:
./src/cam/sdl_texture.h:27:8: error: ‘SDL_PixelFormatEnum’ does not name
a type; did you mean ‘SDL_PixelFormat’?

Fix that by using the base type uint32_t in place of
SDL_PixelFormatEnum.

Reported-by: https://buildbot.libcamera.org/#/builders/6/builds/355
Fixes: 11554a259f ("cam: sdl_sink: Add SDL sink with initial YUYV support")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Eric Curtin <ecurtin@redhat.com>
2022-07-15 13:43:47 +02:00
Laurent Pinchart
a5877e0307 utils: rkisp1: Support optional CSI-2 receiver subdev
The media graph may include a CSI-2 receiver entity between the sensor
and the ISP for platforms that have a CSI-2 receiver external to the
ISP. Support this by configuring the pipeline accordingly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-07-15 13:46:22 +03:00
Laurent Pinchart
4d3a118c11 utils: rkisp1: Fix pixel format for raw capture
The regexp to convert the raw pixel media bus code to a pixel format is
incorrect. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-07-15 13:46:18 +03:00
Laurent Pinchart
9007d37939 utils: rkisp1: Fix sensor format parsing
With sensors supporting crop, the regexp used to parse the media-ctl
output isn't correct as the pad configuration may span multiple lines
and contain other parameters. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-07-15 13:46:15 +03:00
Laurent Pinchart
695304c43f utils: rkisp1: Remove frames before starting capture
Delete frames previously captured before starting a new capture, to
avoid mixing old and new frames.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-07-15 13:45:58 +03:00
Naushir Patuck
090ac69416 pipeline: raspberrypi: Fix incorrect advertising of ScalerCrop
The controls::ScalerCrop in the ControlInfoMap was advertised based on
the ISP output Rectangle. This is incorrect, it needs to be set based on
the sensor analogue crop Rectangle. Fix this.

Additionally, do not use emplace to be consistent with the other
controls set in the ControlInfoMap.

Fixes: 9dacde0d65 (pipeline: raspberrypi: Advertise ScalerCrop from the pipeline handler)
Reported-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-07-14 16:32:09 +03:00
Paul Elder
9a2fd76ef1 pipeline: rkisp1: Support media graph with separate CSI RX
The rkisp1 hardware supports both a CSI-2 input and a parallel input,
where the sensor is connected directly to the ISP. On RK3399, the CSI-2
receiver is internal, but on the i.MX8MP, the CSI-2 receiver is a
separate IP core, connected to the parallel input of the ISP, and gets
exposed to userspace as a V4L2 subdev. To prepare for this, handle an
optional CSI-2 receiver subdev in the pipeline.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
2022-07-14 19:18:43 +09:00
Umang Jain
3e15e8c6c3 utils: ipu3-unpack: Fix error string
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-13 17:38:49 +05:30
Naushir Patuck
1fa2d579de libcamera: base: Suppress clang-11 compile error on ARM32
Compiling backtrace.cpp for ARM32 produces the following error with the
clang-11 (and later) compiler:

--------------------
../src/libcamera/base/backtrace.cpp:195:12: error: use of SP or PC in the list is deprecated [-Werror,-Winline-asm]
        int ret = unw_getcontext(&uc);
                  ^
/usr/include/arm-linux-gnueabihf/libunwind-common.h:114:29: note: expanded from macro 'unw_getcontext'
                                        ^
/usr/include/arm-linux-gnueabihf/libunwind-arm.h:270:5: note: expanded from macro 'unw_tdep_getcontext'
    "stmia %[base], {r0-r15}"                                           \
    ^
<inline asm>:1:2: note: instantiated into assembly here
        stmia r0, {r0-r15}
--------------------

Suppress this compilation error with a clang-specific pragma around the
offending statements.

Further information about this error can be found at
https://github.com/dotnet/runtime/issues/38652

Bug: https://bugs.libcamera.org/show_bug.cgi?id=136
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Tested-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Naushir Patuck <naush@rasbperrypi.com>
Tested-by: Naushir Patuck <naush@rasbperrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-07-13 11:48:59 +03:00
Eli Schwartz
ba6435930f meson: Correctly pass the global include to the compiler
It's not safe to assume `-include config.h` works, since this depends on
the functionality of the compiler that the cwd when running the compiler
is searched first.

When libcamera is included as a Meson subproject, the cwd of the
compiler is the cwd of the main project, not of libcamera's build dir,
and thus cannot be found. Instead, pass the include filename as a path
based on the current build dir.

Signed-off-by: Eli Schwartz <eschwartz93@gmail.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>
2022-07-07 00:53:16 +03:00
William Vinnicombe
ed12bb4aba utils: raspberrypi: ctt: load_image: Ignore JPEG files with no raw data
The load_image function would throw errors with JPEG or JPG files containing
no raw data.

Prevent throwing these errors by returning 0 if an error has occurred.

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-07-06 21:33:35 +03:00
Jacopo Mondi
2778c3298c test: delayed_controls: Remove sequenceOffset
Commit 6f539a6d2f ("delayed_controls: Remove reduandant firstSequence_")
removed support for frame number start offset from the DelayedControls
class, as it is now guaranteed that the first sequence number as it comes
from the V4L2VideoDevice will always be 0.

However the delayed_controls.cpp unit still has two tests that passes
a non-zero first sequence number to the DelayedControl class, causing
the test to spin forever and consequentially fail.

Remove the two tests from the unit to fix this.

The first removed test was testing the class against frame start
sequence numbers greater than zero and can safely be removed.

The second test was instead validating the class against sequence number
overflow, which is now not possible to test anymore as the DelayedControls
class now assumes 0 as first frame sequence number.

Fixes: 6f539a6d2f ("delayed_controls: Remove reduandant firstSequence_")
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-06 09:03:46 +02:00
Umang Jain
458d917ca2 libcamera: camera: Reset request sequence number on stop/start
We now have V4L2VideoDevice ensuring that sensor sequence numbers
start from zero [1], and we desire that these should match the Request
sequence number as well.

[1] 1c9dc0fd89 ("libcamera: v4l2_videodevice: Identify non-zero stream starts")

Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-05 11:24:04 +01:00
Kieran Bingham
6f539a6d2f delayed_controls: Remove reduandant firstSequence_
The DelayedControls implementation tracked the sequence numbers to
determine the offset if a device did not commence with a sequence number
of 0.

This guarantee is now handled by the V4L2VideoDevice.

Remove the firstSequence_ offset and the corresponding running_ flag
which was used to track setting firstSequence_ from the DelayedControls.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-07-05 11:23:35 +01:00
Laurent Pinchart
b3fd8e14b5 gstreamer: Fix race conditions in task pause/resume
The task run function races with two other threads that want to resume
the task: the requestCompleted() handler and the buffer-notify signal
handler. If the former queues completed requests or the latter queues
back buffers to the pool, and then resume the task, after the task run
handler checks the queues but before it attemps to pause the task, then
the task may be paused without noticing that more work is available.

The most immediate way to fix this is to take the stream_lock in the
requestCompleted() and buffer-notify signal handlers, or cover the whole
task run handler with the GstLibcameraSrcState lock. This could cause
long delays in the requestCompleted() handler, so that's not a good
option.

Instead, pause the task unconditionally at the beginning of its run
function, and track while processing buffers and requests if the task
needs to be resumed. It may also get resumed externally by the
buffer-notify signal handler or the request completion handler, which
are guaranteed not to race due to the lock taken by the gst_task_pause()
and gst_task_resume() functions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
2022-07-04 23:08:12 +03:00
Laurent Pinchart
29ef923877 gstreamer: Split completed request processing to a separate function
Simplify the task run function futher by moving the processing of
completed requests to a separate function. No functional change
intended, only increased readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:08:08 +03:00
Laurent Pinchart
cc9998c90f gstreamer: Split request creation to a separate function
In order to prepare for creation and queuing of multiple requests, move
the request creation and queueing code to a separate function. No
functional change intended.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:08:03 +03:00
Laurent Pinchart
b8708937bf gstreamer: Fix pads locking
The srcpads_ vector is protected by two different locks, the GstObject
lock of the libcamerasrc element, and the stream_lock that covers the
run function of the thread. This isn't correct. Use the stream_lock
consistently to protect the pads.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:59 +03:00
Laurent Pinchart
06bd05bece gstreamer: Use dedicated lock for request queues
Add a new lock to the GstLibcameraSrcState class to protect the queued
and completed requests queues. This replaces the GstObject lock, and
minimizes the lock contention between the request completion handler and
the task run handler as the former must run as fast as possible.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:55 +03:00
Laurent Pinchart
3ae535ceb4 gstreamer: Combine the two pad loops in the task run handler
This simplifies the code, and allows removing the internal queue in the
GstLibcameraPad object.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:53 +03:00
Laurent Pinchart
413dbfb1e7 gstreamer: Handle completed requests in the libcamerasrc task
Move the request wrap to a completed queue in the request completion
handler to move more of the request completion processing to the
libcamerasrc task. This lowers the amount of time spent in the
completion handler, and prepares for reworking the usage of locks.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:49 +03:00
Laurent Pinchart
a4df063a94 gstreamer: Rename queued requests queue to queuedRequests_
To prepare for the addition of a completed requests queue, rename the
existing queued requests queue from requests_ to queuedRequests_.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:47 +03:00
Laurent Pinchart
4517344a55 gstreamer: Move timestamp calculation out of pad loop
The buffer pts and the pad latency are computed from the framebuffer
timestamp, separately for each pad. Use the sensor timestamp provided
through the request metadata instead, to compute the values once outside
of the pads loop.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:40 +03:00
Laurent Pinchart
674c2bf1f1 gstreamer: Pass Stream to RequestWrap::addBuffer()
For symmetry with RequestWrap::removeBuffer(), pass the Stream pointer
to addBuffer(). This handles streams at the GstPad level instead of the
GstBuffer level, which allows making the GstLibcameraPool API a bit
cleaner by removing the gst_libcamera_buffer_get_stream() helper
function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:38 +03:00
Laurent Pinchart
44d14d8245 gstreamer: Move variable to loop scope
The GstBuffer variable in GstLibcameraSrcState::requestCompleted() is
only used within the loop scope. Make it a local loop variable.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:37 +03:00
Laurent Pinchart
053ffcca06 gstreamer: Use gst_task_resume() when available
The gst_libcamera_resume_task() helper is an implementation of the
gst_task_resume() function that predates its addition to GStreamer. Use
gst_task_resume() when available, and rename gst_libcamera_resume_task()
to gst_task_resume() to support older GStreamer versions.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Vedant Paranjape <vedantparanjape160201@gmail.com>
2022-07-04 23:07:35 +03:00
Laurent Pinchart
d5b0cec839 libcamera: framebuffer: Turn the cookie into a 64-bit integer
To allow associating pointers with FrameBuffer instances, turn the
cookie into a 64-bit integer. This matches the Request cookie with is
also a uint64_t.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2022-07-04 23:07:29 +03:00
Florian Sylvestre
3fa79cc688 ipa: rkisp1: Add support of Black Level Correction tuning
Get the Black Level Correction algorithm parameters from YAML tuning
data.

Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-29 17:21:15 +03:00
Florian Sylvestre
e7ec7d4de1 ipa: rkisp1: Add OV5640 tuning file
Add the OV5640 tuning file containing default values for 'black level
correction' algorithm.

Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-29 17:21:14 +03:00
Laurent Pinchart
f2869a4167 ipa: rkisp1: Add IMX219 tuning file
Add a skeleton for the IMX219 tuning file, with data for the BLC
algorithm.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-29 17:21:13 +03:00
Florian Sylvestre
ad57d2c51d ipa: rkisp1: Add YAML tuning file support
Retrieve root node in YAML tuning file and provide to
each algorithm this YamlObject to allow them to grab their default
parameters by calling init() function.

Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-29 17:21:12 +03:00
Laurent Pinchart
d22c0020ef ipa: rkisp1: Register algorithms
To prepare for dynamic instantiation of algorithms from the tuning file,
register the algorithms with the Module class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-29 17:21:12 +03:00
Florian Sylvestre
011a4668fb pipeline: rkisp1: Support IPA tuning file
Pass the path name of the YAML IPA tuning file to the IPA module. The
file name is derived from the sensor name ("${sensor_name}.yaml"), with
a fallback to "uncalibrated.yaml".

The tuning file name can be manually overridden with the
LIBCAMERA_RKISP1_TUNING_FILE environment variable.

Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-29 17:21:11 +03:00
Laurent Pinchart
e9c53ac4d8 ipa: libipa: module: Make the Module class Loggable
To help attribute messages logged by the Module class to a particular
IPA module, make the class loggable. The logPrefix() function must be
implemented by the IPA module-specific derived class.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-29 17:21:06 +03:00
Laurent Pinchart
7a5e23585f ipa: libipa: module: Add support for instantiation from YAML
Add a Module::createAlgorithms() function to instantiate algorithms from
a YamlObject. The instantiated algorithms are stored in a private member
variable list, exposed through the Module::algorithms() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-29 17:21:05 +03:00
Florian Sylvestre
575ca88544 ipa: libipa: algorithm: Add init() function to the Algorithm class
Add the init() function that will be called during algorithm initialization
to provide each algorithm the list of algorithms tuning data.

Signed-off-by: Florian Sylvestre <fsylvestre@baylibre.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-29 17:21:04 +03:00
Laurent Pinchart
d1934c6490 ipa: libipa: algorithm: Add an algorithm registration mechanism
In order to allow dynamic instantiation of algorithms based on tuning
data files, add a mechanism to register algorithms with the IPA module.
The implementation relies on an AlgorithmFactory class and a
registration macro, similar to the pipeline handler registration
mechanism. The main difference is that the algorithm registration and
instantiation are implemented in the Module class instead of the
AlgorithmFactory class, making the factory an internal implementation
detail.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-29 17:21:03 +03:00
Laurent Pinchart
5f94b262da ipa: libipa: Move ipa namespace documentation to module.cpp
The libipa.cpp file exists for the sole purpose of documentating the ipa
namespace. As we now have a top-level module.cpp file in libipa, move
the documentation there, and drop libipa.cpp.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-29 17:21:02 +03:00
Laurent Pinchart
83df785493 ipa: libipa: Introduce a Module class template
libipa defines an abstract Algorithm class template that is specialized
by IPA modules. IPA modules then instantiate and manage algorithms
internally, without help from libipa. With ongoing work on tuning data
support for the RkISP1, and future similar work for the IPU3, more code
duplication for algorithms management is expected.

To address this and share code between multiple IPA modules, introduce a
new Module class template that will define and manage top-level concepts
for the IPA module.

The Module class template needs to be specialized with the same types as
the Algorithm class. To avoid manual specialization of both classes,
store the types in the Module class, and replace the template arguments
of the Algorithm class with a single Module argument from which the
other types are retrieved.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-29 17:20:59 +03:00
Naushir Patuck
9dacde0d65 pipeline: raspberrypi: Advertise ScalerCrop from the pipeline handler
The ScalerCrop control is handled directly by the pipeline handler. Remove the
control from the IPA's static ControlInfoMap, and let the pipeline handler add
it to the ControlInfoMap advertised to the application, ensuring the limits
are set appropriately based on the current sensor mode.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-29 13:59:28 +01:00
Naushir Patuck
ac955c425d pipeline: ipa: raspberrypi: Correctly report available control limits
The ipa currently advertises a static ControlInfoMap to specify the available
controls and their limits. Fix this limitation by having the IPA populate a new
ControlInfoMap with updated limits for ExposureTime, AnalogueGain, and
FrameDurationLimits controls based on the current sensor mode. This new
ControlInfoMap is then returned back to the pipeline handler and available to
the application after a successful Camera::configure() call.

Before the first call to Camera::configure(), this ControlInfoMap provides some
reasonable default limits for ExposureTime, AnalogueGain, and
FrameDurationLimits. However, applications must not rely on these values, but
obtain the correct limits after the call to Camera::configure().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-29 13:55:17 +01:00
Naushir Patuck
53ada24e63 pipeline: ipa: raspberrypi: Move ControlInfoMap to the IPA
Currently the pipeline handler advertises controls handled by the IPA from a
static ControlInfoMap defined in the raspberrypi.h header. This change removes
this header file, and instead the IPA returns the ControlInfoMap to the pipeline
handler from the ipa::init() function. This is done to allow the IPA to adjust
the limits of the controls based on the sensor mode in a subsequent change.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=83
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-29 13:54:51 +01:00
Naushir Patuck
8acfb8494c ipa: raspberrypi: Use std::optional in DeviceStatus
Switch the aperture, lens_position, and flash_intensity fields in the
DeviceStatus structure to use std::optional instead of using invalid default
values.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-29 12:12:07 +01:00
Naushir Patuck
95151dd06f ipa: raspberrypi: imx477: Get sensor temperature from embedded data
Fetch the sensor temperature value from the embedded data buffer and add it to
the DeviceStatus structure in CamHelperImx477::PopulateMetadata().

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-29 12:12:07 +01:00
Naushir Patuck
2a321be376 ipa: raspberrypi: Add sensor temperature to DeviceStatus
Add an optional sensor_temperature field to the DeviceStatus structure. If a
temperature measurement is available for a frame, the value is returned out
through the SensorTemperature control in the Request metadata.

Additionally, provide the sensor temperature value from the std::ostream &operator<<
overload.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-29 12:12:07 +01:00
Naushir Patuck
71fb654918 libcamera: controls: Add SensorTemperature control
Add a SensorTemperature control to return the temperature of the camera sensor
in Celsius. This control will only be present in the Request metadata if a
thermal sensor is available to the camera sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-29 12:12:07 +01:00
Kieran Bingham
1c9dc0fd89 libcamera: v4l2_videodevice: Identify non-zero stream starts
V4L2 Video devices should always start streaming from index zero.
Identify and report a warning if they don't, and correct for any offset.

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-27 10:32:06 +01:00
Eric Curtin
27cc0a6b58 README: Add some extra optional dependencies for cam sinks
KMS sink requires some DRM libraries, SDL sink requires some SDL
libraries.

Suggested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-06-27 11:21:47 +03:00