Commit graph

3820 commits

Author SHA1 Message Date
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
Javier Martinez Canillas
7ec3bfedbe meson: options: Disable pycamera by default
The libcamera Python bindings is still experimental and it relies on some
features in pybind11 that are not yet upstreamed, so a special branch has
to be downloaded as a subproject.

This conflicts with the build process used by most Linux distributions,
since there is expected that all the dependencies will be fulfilled by
-devel packages present in the build root.

To allow libcamera to be built by distros, let's disable the pycamera by
default. This can still be enabled with `meson build -Dpycamera=enabled`.

Suggested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-23 19:49:24 +03:00
Laurent Pinchart
bb84fc6a74 README: Add short testing instructions with cam
The README.rst file contains the getting started instructions, but lacks
a simple way to test libcamera. Add a short section about basic cam
usage.

Suggested-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-06-22 12:35:14 +03:00
Laurent Pinchart
e135db8cb4 Documentation: Fix length of title underlines
Some title underlines don't match the title text. Fix them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-22 12:35:14 +03:00
Jacopo Mondi
10be87fa7c Documentation: Use language 'en' for Sphinx 5.0.0
Recent versions of Sphinx (> 5.0.0) have dropped support for the
'None' keyword as language specifier:

https://www.sphinx-doc.org/en/master/changes.html#release-5-0-0-released-may-30-2022

10474: language does not accept None as it value. The default value of
       language becomes to 'en' now. Patch by Adam Turner and Takeshi
       KOMIYA.

Causing a compile time warning:

WARNING: Invalid configuration value found: 'language = None'.
Update your configuration to a valid language code. Falling
back to 'en' (English).

Change the language setting to 'en' to silence the warning.

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-06-20 18:19:14 +02:00
Eric Curtin
7cd8b54fd7 cam: kms_sink: Remove limitation that camera and display must match
There is a limitation that requires input and output to be pixel
for pixel identical in terms of height and width. Remove this
limitation to enable more hardware that doesn't match. Just start
drawing from top left 0, 0 corner.

Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Eric Curtin <ecurtin@redhat.com>
2022-06-20 15:46:27 +03:00
Laurent Pinchart
c7d260c03a libcamera: yaml_parser: Add get() specializations for 16-bit integers
Extend the YamlObject::get() function template to support 16-bit
integers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-20 15:12:27 +03:00
Laurent Pinchart
839c4a5a48 libcamera: yaml_parser: Fix range checks for 32-bit integers
The strtol() and strtoul() functions return long integers, which may be
larger than 32-bit integers. Add manual range checks.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-20 15:12:26 +03:00
Laurent Pinchart
9dacead615 libcamera: yaml_parser: Remove memberNames() function
Now that YamlObject supports iteration, the memberNames() function isn't
useful anymore as it can be implemented using utils::map_keys() if
really needed. Drop it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-20 15:12:26 +03:00
Laurent Pinchart
12bf404147 android: Use the YamlObject iterator API
Replace usage of YamlObject::memberNames() with the more efficient
iterator API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-20 15:12:12 +03:00
Laurent Pinchart
90577226aa test: yaml_parser: Extend tests to cover the iterator API
Test iteration over lists and dictionaries to test the YamlObject
iterator API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-20 15:12:12 +03:00
Laurent Pinchart
3a18ad1607 libcamera: yaml_parser: Add iterator API
Allow using range-based for loops over YamlObject instances by
implementing iterators. New YamlObject::DictAdapter and
YamlObject::ListAdapter adapter classes are introduced to provide
different iterators depending on the object type.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-20 15:12:11 +03:00
Laurent Pinchart
40f8cbda60 libcamera: yaml_parser: Use std::is_same_v<>
As the YamlObject class is internal to libcamera, it can use the full
C++17 API. Replace std::is_same<>::value with std::is_same_v<>.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Han-Lin Chen <hanlinchen@chromium.org>
2022-06-20 15:11:57 +03:00
Eric Curtin
7f500a6c36 cam: drm: Support /dev/dri cards other than 0
Existing code is hardcoded to card0. Since recent fedora upgrades, we
have noticed on more than one machine that card1 is present as the
lowest numbered device, could theoretically be higher. This technique
tries every file starting with card and continue only when we have
successfully opened one. These devices with card1 as the lowest device
were simply failing when they do not see a /dev/dri/card0 file present.

Reported-by: Ian Mullins <imullins@redhat.com>
Tested-by: Ian Mullins <imullins@redhat.com>
Signed-off-by: Eric Curtin <ecurtin@redhat.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-19 00:02:47 +03:00
Jean-Michel Hautbois
4bb284e0fa ipa: ipu3: awb: Correct the gains calculation
The factor used right now in the IPU3 is 8192, as a multiplier of the
estimated gain. This is wrong, as the isp is adding 1.0 to the gain
applied, ie Pout = { Pin * (1 + Gx) }.

Fix it, and to ease the reading, introduce a small helper function.

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-18 18:31:49 +02:00
Daniel Semkowicz
d2c097c482 Documentation: Update the "Start an event loop" section
Event loop was moved to be a part of CameraManager, so it is no longer
a user responsibility to control the event dispatching.

Signed-off-by: Daniel Semkowicz <dse@thaumatec.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>
2022-06-17 18:08:55 +03:00
Daniel Semkowicz
d85a91cf56 Documentation: Update code examples to use the Request::reuse() method
After introduction of reuse(), there is no need of manual request
reconfiguration. Furthermore, current example code does not work
anymore.

Signed-off-by: Daniel Semkowicz <dse@thaumatec.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>
2022-06-17 18:08:53 +03:00
Daniel Semkowicz
14ae86f0c9 Documentation: Add the missing const to the example code
Request::BufferMap key type is now const

Signed-off-by: Daniel Semkowicz <dse@thaumatec.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>
2022-06-17 18:08:48 +03:00
Tommaso Merciai
f44ce70d9b Documentation: Fix createRequest unique_ptr
camera->createRequest() function return std::unique_ptr<Request>, then
manipulate Request as std::unique_ptr.
This solve the following error, during compilation:

error: cannot convert ‘std::unique_ptr<libcamera::Request>’ to ‘libcamera::Request*’ in initialization

References:
 - bb97f3bbd9/simple-cam.cpp (L369)

Signed-off-by: Tommaso Merciai <tommaso.merciai@amarulasolutions.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>
2022-06-17 13:22:45 +03:00
Laurent Pinchart
71bdc1e441 libcamera: pipeline: simple: Support scaling on the sensor
As the simple pipeline handler targets simple pipelines on the SoC side,
it often gets used with platforms that have a YUV sensor capable of
outputting different sizes. Extend the heuristics used for pipeline
discovery and configuration to scale as much as possible on the sensor
side, in order to minimize the required bandwidth.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-16 12:03:52 +03:00
Laurent Pinchart
5fe1f00f19 libcamera: pipeline: simple: Store sensor resolution in configuration
When enumerating the supported configurations, store the corresponding
sensor resolution in the SimpleCameraData::Configuration structure and
use it when configuring the camera, instead of hardcoding the sensor
full resolution. This prepares for support of downscaling in the camera
sensor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-16 12:03:50 +03:00
Laurent Pinchart
6984f07c0e libcamera: pipeline: simple: Factor out format test to separate function
To prepare for the implementation of a more complex format discovery
method, factor out code that tries a pipeline configuration to a
separate function. No functional change intended.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-16 12:03:47 +03:00
Laurent Pinchart
0416488635 libcamera: pipeline: simple: Document the pipeline traversal algorithm
Add a section to the documentation at the top of the file to describe in
a bit more details how the media graph is traversed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-16 12:03:46 +03:00
Laurent Pinchart
610e59fc83 libcamera: pipeline: simple: Improve debug message on config failure
When pipeline configuration fails, print the format returned by the
kernel in addition to the one requested by libcamera, to ease debugging.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-16 12:03:45 +03:00
Laurent Pinchart
1657106b0c test: yaml-parser: Use write() instead of fwrite()
There's no point in wrapping a fd into a FILE to then only call fwrite()
and fclose(). Use write() and close() directly.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-16 02:43:47 +03:00
Laurent Pinchart
d6d0a675bf libcamera: yaml_parser: Switch from FILE to File
THe FILE object isn't very user-friendly as it requires manual close.
Replace it with File to provide RAII-style resource management in the
YamlParser API.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-16 02:43:47 +03:00
Laurent Pinchart
27fb47f70b libcamera: yaml_parser: Extend YamlObject::size() to dictionaries
Dictionaries have a size too, extend the size() function to support
them.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-16 02:43:47 +03:00
Laurent Pinchart
27483e971f libcamera: yaml_object: Turn Type into an enum class
Turn the Type enum into an enum class to force qualifying 'List' and
'Dictionary' in the YamlObject namespace scope. This will help avoiding
ambiguities when adding iterator support.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
2022-06-16 02:43:46 +03:00
Jacopo Mondi
1735d176bc android: camera_device: Print the correct number of completed streams
When a request completes, a debug message is generated to help
identify the request and the number of streams it contains.

The printed number of streams is however the number of output buffers
requested by the camera framework, not the number of streams generated
by libcamera. In facts, some output buffers are generated by
post-processing, and not directly from the camera.

As the debug message prints the libcamera identifier for the Request, it
is more logical to print the number of streams generated by the camera
instead of the total number of streams.

Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10 11:48:10 +02:00
Hirokazu Honda
246d3f631b android: camera_device: Use YUV post-processor
When creating the list of StreamConfiguration to be requested to the camera,
map NV12 streams of equal size and format together, so that they will be
generated by using the YUV post-processor.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10 11:48:09 +02:00
Jacopo Mondi
7ea83eba0d android: camera_device: Postpone mapped streams handling
Mapped streams are generated by post-processing and always require a
source buffer to process image data from.

In case a Mapped stream is requested but its source stream is not, it
is required to allocate a buffer on the fly and add it to the
libcamera::Request.

Make sure a source stream is available for all mapped streams, and if
that's not the case, add a dedicated buffer to the request for that
purpose.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10 11:48:09 +02:00
Jacopo Mondi
1261ff9e93 android: camera_stream: Create allocator unconditionally
Originally buffer allocation was only required for Internal streams
which are not backed by a frame buffer provided by the Android
framework.

Now that mapped streams can be generated without the corresponding
source stream being part of the Android's provided stream list, also
buffers of type Mapped can be required to allocate buffers on demand.

Create CameraStream::allocator_ and the associated mutex unconditionally
for all types of stream.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10 11:48:09 +02:00
Hirokazu Honda
fec64fb75a android: camera_stream: Add sourceStream
Add a sourceStream field to the CameraStream class, meant to contain a
reference to the direct stream which produces actual image data for
streams of type CameraStream::Mapped.

The sourceStream of mapped streams will be used in later patches to make
sure for each Mapped stream at least one libcamera::Stream is queued to
the libcamera::Camera.

Signed-off-by: Hirokazu Honda <hiroh@chromium.org>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-10 11:48:09 +02:00
Tomi Valkeinen
b4d4b78c82 py: examples: Add simple-cam.py
Add a Python version of simple-cam from:

https://git.libcamera.org/libcamera/simple-cam.git

Let's keep this in the libcamera repository until the Python API has
stabilized a bit more, and then we could move this to the simple-cam
repo.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.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>
2022-06-08 20:16:25 +03:00
Tomi Valkeinen
d6cfb08060 py: examples: Add simple-continuous-capture.py
Add a slightly more complex, and I think a more realistic, example,
where the script reacts to events and re-queues the buffers.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-08 20:16:21 +03:00
Tomi Valkeinen
ab21acb9c0 py: examples: Add simple-capture.py
Add an example to showcase the more-or-less minimal capture case.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-08 20:16:19 +03:00
Tomi Valkeinen
d0b310b465 Documentation: Add python-bindings.rst
Add a basic doc for the Python bindings. While not really proper
documentation yet, the file and the examples should give enough guidance
for users who are somewhat familiar with libcamera.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.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>
2022-06-08 17:31:23 +03:00
Laurent Pinchart
6132521b47 libcamera: base: log: Color the log prefix
Add coloring to the log prefix to increase log readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-06 15:09:49 +03:00
Laurent Pinchart
5757038946 libcamera: base: log: Add coloring to the log output
Extend the logger to support coloring messages. The log level is
colorized with per-level colors, and the category with a fixed color.
This makes the log output more readable.

Coloring is enabled by default when logging to std::cerr, and can be
disabled by setting the LIBCAMERA_LOG_NO_COLOR environment variable.
When logging to a file with LIBCAMERA_LOG_FILE, coloring is disabled. It
can be enabled for file logging using the logSetFile() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-06-06 15:09:42 +03:00
Naushir Patuck
7ee7dc3369 camera_sensor: Suppress error message if test patterns are unavailable
If a sensor driver does not support test patterns (e.g. IMX477),
libcamera throws an unnecessary error message during initialisation when
it sets the test pattern to off.

Fix this by moving the error message into setTestPatternMode() where the
pipeline handler explicitly requests to set a test pattern.

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>
2022-06-06 15:08:34 +03:00
Jacopo Mondi
161d24377c libcamera: request: Add operator<<()
With the recent addition of operator<<() in most libcamera core classes
to replace usage of the toString() function the Request class was left
behind.

Add operator<<() for the Request class and reimplement toString().

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-05 14:48:08 +02:00
Christian Rauch
38e427f605 libcamera: ipu3: Fix rogue whitespace
Fix a comment line wrongly indented with spaces instead of tabs.

Signed-off-by: Christian Rauch <Rauch.Christian@gmx.de>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-05 00:58:09 +03:00
Tomi Valkeinen
7ef83e0228 py: Merge read_event() and get_ready_requests()
We always call CameraManager.read_event() and
CameraManager.get_ready_requests(), so to simplify the use merge the
read_event() into the get_ready_requests().

This has the side effect that get_ready_requests() will now block if
there is no event ready. If we ever need to call get_ready_requests() in
a polling manner we will need a new function which behaves differently.

However, afaics the only sensible way to manage the event loop is to use
select/poll on the eventfd and then call get_ready_requests() once,
which is the use case what the current merged function supports.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-04 02:21:05 +03:00
Tomi Valkeinen
b4bb5ce629 utils: checkstyle.py: Fix color bleed
If issue.line is None, the the terminal color is never reset back to
normal. This causes the yellow color to bleed.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-06-03 23:35:22 +03:00
Laurent Pinchart
30d55d584a libcamera: v4l2_subdevice: Add YUV8_1X24 media bus format
The format is used by the i.MX8 ISI driver that will be supported by the
simple pipeline handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-06-03 17:56:45 +03:00
Laurent Pinchart
afed56621e libcamera: v4l2_subdevice: Add RGB565_1X16 media bus format
The format is used by the i.MX8 ISI driver that will be supported by the
simple pipeline handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-06-03 17:56:45 +03:00
Laurent Pinchart
f8ee23655b libcamera: v4l2_subdevice: Use MEDIA_BUS_FMT_* macros
The V4L2_MBUS_FMT_* macros that define media bus formats are deprecated.
Use the MEDIA_BUS_FMT_* macros instead.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2022-06-03 17:56:45 +03:00