Commit graph

4505 commits

Author SHA1 Message Date
David Plowman
8892d937c5 ipa: rpi: black_level: Add an initialValues method
This allows the IPA to discover the correct black level values even
before any frames have been processed. This is important on the PiSP
platform where the front end black level blocks must be programmed in
advance.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:02 +00:00
Nick Hollinghurst
e71d63ce1b ipa: rpi: Allow the mean of an empty histogram interval
Don't assert when taking the weighted mean of a zero-width or
zero-weight interval; return its upper bound. That is certainly
correct in the zero-width case, and plausible otherwise.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:02 +00:00
Laurent Pinchart
12fb8ed5cb Documentation: camera-sensor-model: Support Sphinx < 2.0
The language argument to the code-block directive was mandatory in
Sphinx before 2.0. Fix the few instances where no language is specified
to support older versions of Sphinx.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:35:06 +00:00
Laurent Pinchart
0e0043053f gstreamer: Support for pre-1.16 GstEvent
The gst_clear_event() function used by libcamerasrc has been introduced
in GStreamer 1.16, while libcamera claims to need 1.14 or newer. This
causes a compilation error. Fix it by copying the gst_clear_event()
implementation to gstlibcamera-utils.h when compiling with older
GStreamer version.

The version check makes it clear that the workaround is needed with
older versions only, flagging it for removal when the minimum GStreamer
version requirement will be bumped.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:34:03 +00:00
Laurent Pinchart
4a362ddeaa lc-compliance: Set minimum version for gtest dependency
lc-compliance depends on support for skipping tests in gtest (commit
00938b2b228f upstream, merged in v1.10.0). Set the corresponding minimum
version for the gtest dependency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:33:38 +00:00
Naushir Patuck
271598618d ipa: rpi: Add hardware line rate constraints
Advertise hardware constraints on the pixel processing rate through the
Controller::HardwareConfig structure. When calculating the minimum line
length during a configure() operation, ensure that we don't exceed this
constraint.

If we do exceed the hardware constraints, increase the modes's minimum
line length so the pixel processing rate falls below the hardware limit.
If this is not possible, throw a loud error message in the logs.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-01-05 00:40:28 +02:00
William Vinnicombe
577e0c6b76 pipeline: rpi: Respect provided stride
When converting from StreamConfiguration to V4L2DeviceFormat, the stride
was being dropped with the result that users could not request a custom
stride.

Set the stride in the V4L2DeviceFormat to prevent this happening.

Signed-off-by: William Vinnicombe <william.vinnicombe@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-12-21 18:28:24 +02:00
Laurent Pinchart
4843f72b13 libcamera: camera: Fix unused variable compiler warning
When compiling with gcc 8.4.0, the compiler was reported to throw an
unused variable warning:

../src/libcamera/camera.cpp: In member function ‘libcamera::CameraConfiguration::Status libcamera::CameraConfiguration::validateColorSpaces(libcamera::CameraConfiguration::ColorSpaceFlags)’:
../src/libcamera/camera.cpp:497:19: error: unused variable ‘i’ [-Werror=unused-variable]
  for (auto [i, cfg] : utils::enumerate(config_)) {
                   ^

The build environment may have been incorrect as the problem couldn't be
reproduced with gcc 8.3.0 and 8.5.0. Nonetheless, the 'i' variable is
indeed unused. It turns out that the code can be simplified, as the
commit that removed usage of the variable kept the now unneeded
utils::enumerate() call.

Simplify the code and fix the warning in one go.

Fixes: 13986d6ce3 ("libcamera: camera: Fix validateColorSpaces to choose "main" colour space")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-21 17:24:28 +02:00
Laurent Pinchart
41d6e6e5c1 meson: Replace hack with usage of '@BASENAME@'
Starting with meson 0.59, the custom_target() function substitutes
'@BASENAME@' in the output parameter with the input file name, with the
extension removed. This is exactly what we implement manually when
generating the IPA interface .cpp files.

Furthermore, starting with meson 0.60, the 'name' positional parameter
to the custom_target() function is optional, and defaults to the
basename of the output file (including the extension). This is exactly
the name we compute manually and pass to the function.

As libcamera requires meson 0.60 or newer, we can depend on those two
features and drop manual computation of the base name. This fixes a
warning with recent meson versions that complain that passing a file
object to the format() function is a broken feature:

WARNING: Broken features used:
 * 1.3.0: {'str.format: Value other than strings, integers, bools, options, dictionaries and lists thereof.'}

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-08 00:25:00 +02:00
Laurent Pinchart
1c56d2a2cd README.rst: Add missing libgtest-dev dependency for lc-compliance
lc-compliance requires gtest. When not available on the system, we
install it using a meson wrap, but it is still better to install the
system package. Add it as a dependency in README.rst.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-07 19:37:50 +02:00
Laurent Pinchart
17d8b89deb test: gstreamer: Remove videoconvert element from pipeline
The GStreamer single stream test uses the following pipeline:

	libcamerasrc ! videoconvert ! fakesink

The videoconvert element isn't useful as the data is thrown away by the
fakesink anyway. We can shorten the pipeline to

	libcamerasrc ! fakesink

to save CPU time and to avoid depending on the gstreamer1.0-plugins-base
package to run the unit tests.

The test could be further simplified by replacing
gst_parse_bin_from_description_full() with gst_element_factory_make(),
now that we only add one element to the bin. The extra cost incurred by
the bin only impacts initialization time, and using a bin will make it
easier to add other elements in the future if needed. Keep the bin, and
only drop the videoconvert element.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-07 18:59:42 +02:00
Laurent Pinchart
efcda47985 test: ipc: unixsocket: Increase process exit timeout
When running tests on slower devices, 200ms is too low to wait for the
process to exit. Increase the timeout to 2s.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-07 18:59:42 +02:00
Laurent Pinchart
9dc2642d2c test: log: log_process: Increase process exit timeout
When running tests on slower devices, 200ms is too low to wait for the
process to exit. Increase the timeout to 2s.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-07 18:59:42 +02:00
Laurent Pinchart
2d12e6088e test: log: log_process: Improve debugging on process exit failures
When the process fails to run and exit normally, the test prints an
error message that provides little information:

	process did not exit normally

Expand the error message to print the exit status to make debugging
easier.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-07 18:59:42 +02:00
Laurent Pinchart
db31477433 test: log: log_process: Fix uninitialized variable on process exit failure
If the process fails to exit before the timeout, the
LogProcessTest::exitStatus_ variable gets used uninitialized. Fix it by
initializating to Process::NotExited.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-07 18:59:42 +02:00
Laurent Pinchart
030fe617ef test: log: log_process: Log an error when failing due to incorrect message
One of the error paths in the test returns without logging a message,
which makes failures difficult to debug. Fix it by adding an error
message.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-07 18:59:42 +02:00
Laurent Pinchart
9ba0c3fef8 meson: Tag all installed files
Meson uses tags to sort installed files in categories, and makes it
possible to install a subset of the files using the '--tags' argument to
'meson install'. This is typically used by distributions to split the
runtime, development and documentation files into separate packages.

By default, meson tries to guess the correct tag for installed files,
but can't always do so properly. Mark the install targets that meson
can't guess with the correct install_tag.

As the feature has been introduced in meson 0.60, bump the minimum meson
version. The latest LTS release of all major distributions that
libcamera currently targets ship a recent enough meson version.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-12-07 01:43:17 +02:00
Jaslo Ziska
b06ebdedba gstreamer: Implement renegotiation
This commit implements renegotiation of the camera configuration and
source pad caps. A renegotiation can happen when a downstream element
decides to change caps or the pipeline is dynamically changed.

To handle a renegotiation the GST_FLOW_NOT_NEGOTIATED return value has
to be handled in GstLibcameraSrcState::processRequest(). Otherwise the
default would be to print an error and stop streaming.

To archive this in a clean way the if statement is altered into a switch
statement which now also has a case for GST_FLOW_NOT_NEGOTIATED. In the
case of GST_FLOW_NOT_NEGOTIATED every source pad is checked for the
reconfiguration flag with gst_pad_needs_reconfigure() which does not
clear this flag. If at least one pad requested a reconfiguration the
function returns without an error and the renegotiation will happen
later in the running task. If no pad requested a reconfiguration then
the function will return with an error.

In gst_libcamera_src_task_run() the source pads are checked for the
reconfigure flag by calling gst_pad_check_reconfigure() and if one pad
returns true and the caps are not sufficient anymore then the
negotiation is triggered. It is fine to trigger the negotiation after
only a single pad returns true for gst_pad_check_reconfigure() because
the reconfigure flags are cleared in the gst_libcamera_src_negotiate()
function.

If any pad requested a reconfiguration the following will happen:
1. The camera is stopped because changing the configuration may not
   happen while running.
2. The completedRequests queue will be cleared by calling
   GstLibcameraSrcState::clearRequests() because the completed buffers
   have the wrong configuration.
3. The new caps are negotiated by calling gst_libcamera_src_negotiate().
   When the negotiation fails streaming will stop.
4. The camera is started again.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-12-07 01:39:41 +02:00
Jaslo Ziska
bf231ead1c gstreamer: Add GstLibcameraSrcState::clearRequests method
Add a clearRequests() function to GstLibcameraSrcState which clears the
GstLibcameraSrcState::completedRequests_ queue.

Use this new function in gst_libcamera_src_task_leave() instead of doing
it manually.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-12-07 01:26:46 +02:00
Jaslo Ziska
9d4da0ca98 gstreamer: Move negotiation logic to separate function
Move the code which negotiates all the source pad caps into a separate
function called gst_libcamera_src_negotiate(). When the negotiation
fails this function will return false and true otherwise.

Use this function instead of doing the negotiation manually in
gst_libcamera_src_task_enter() and remove the now redundant error
handling code accordingly.

Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-12-07 01:26:36 +02:00
Laurent Pinchart
d61104fa7b test: gstreamer: Fix indentation in comments
A couple of comments are mis-indented in the gstreamer unit test. Fix
them, and reflow the text while at it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-06 02:51:35 +02:00
Laurent Pinchart
4eba2dc73c meson_options: Sort options alphabetically
The pycamera option was added at the end of the file, breaking
alphabetical order. Restore it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
2023-12-06 02:06:18 +02:00
Laurent Pinchart
9d08a134c4 README.rst: Document dependencies for the Python bindings
The Python bindings require the libpython3-dev and pybind11-dev
packages. Document it along the other dependencies in README.rst.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-12-04 22:57:44 +02:00
Laurent Pinchart
197009f06e README.rst: Drop indirect dependencies on Qt5 packages
The libqt5core5a, libqt5gui5 and libqt5widgets packages are dependencies
of the qtbase5-dev package. There's no need to list them explicitly.

While at it, sort the qcam dependencies alphabetically.

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>
2023-12-04 16:40:58 +02:00
David Plowman
8e215127c1 ipa: rpi: cac: Minor code improvements and tidying
We make a few small improvements to the code:

* The arrayToSet method is prevented from overwriting the end of the
  array if there are too many values in the input table. If you supply
  a table, it will force you to put the correct number of elements in
  it.

* The arrayToSet and setStrength member functions are turned into
  static functions. (There may be a different public setStrength
  member function in future.)

* When no tables at all are given, the configuration is flagged as
  being disabled, so that we can avoid copying tables full of zeroes
  around. As a consequence, the pipeline handler too will disable this
  hardware block rather than run it needlessly. (Note that the tuning
  tool will put in a completely empty "rpi.cac" block if no CAC tuning
  images are supplied, benefiting from this behaviour.)

* The initialise member function is removed as it does nothing.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-30 15:44:58 +00:00
David Plowman
2905eabad9 ipa: rpi: agc: Fix bug where AeLocked was never getting set
The recent change where time-filtering is done before sorting out the
digital gain means that the target exposure without digital gain is no
longer set, breaking the 'AeLocked' calculation.

We can use the regular (full) target exposure instead.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Fixes: 84b6327789 ("ipa: rpi: agc: Filter exposures before dealing with digital gain")
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-30 15:44:58 +00:00
Naushir Patuck
cbfbab48a7 documentation: Document vendor specific controls and properties handling
Add some documentation to the pipeline handler file describing how to
implement and handle vendor specific controls and properties with a
small example.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-30 13:59:28 +00:00
Naushir Patuck
e18a007b9d libcamera: controls: Use vendor tags for draft controls and properties
Label draft controls and properties through the "draft" vendor tag
and deprecate the existing "draft: true" mechanism. This uses the new
vendor tags mechanism to place draft controls in the same
libcamera::controls::draft namespace and provide a defined control id
range for these controls. This requires moving all draft controls from
control_ids.yaml to control_ids_draft.yaml.

One breaking change in this commit is that draft control ids also move
to the libcamera::controls::draft namespace from the existing
libcamera::controls namespace. This is desirable to avoid API breakages
when adding new libcamera controls. So, for example, the use of
controls::NOISE_REDUCTION_MODE will need to be replaced with
controls::draft::NOISE_REDUCTION_MODE.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-30 13:59:27 +00:00
Naushir Patuck
d3365b358f libcamera: control: Add vendor control id range reservation
Add a new control_ranges.yaml file that is used to reserve control id
ranges/offsets for libcamera and vendor specific controls. This file is
used by the gen-controls.py script to generate control id values for
each control.

Draft controls now have a separate range from core libcamera controls,
breaking the existing numbering behaviour.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-11-29 09:05:39 +00:00
Naushir Patuck
0455bbbf51 build: controls: Rework how controls and properties are generated
Add support for using separate YAML files for controls and properties
generation. The mapping of vendor/pipeline handler to control file is
done through the controls_map variable in include/libcamera/meson.build.

This simplifies management of vendor control definitions and avoids
possible merge conflicts when changing the control_ids.yaml file for
core and draft controls. With this change, libcamera and draft controls
and properties files are designated the 'libcamera' vendor tag.

In this change, we also rename control_ids.yaml -> control_ids_core.yaml
and property_ids.yaml -> property_ids_core.yaml to designate these as
core libcamera controls.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-29 09:05:38 +00:00
Naushir Patuck
bba4ec63c4 controls: Update argument handling for controls generation scripts
The template file to the gen-controls.py and gen-py-controls.py is now
passed in through the '-t' or '--template' command line argument instead
of being a positional argument.  This will allow multiple input files to
be provided to the scripts in a future commit.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-29 09:05:38 +00:00
Naushir Patuck
bd6658943a controls: Add vendor control/property support to generation scripts
Add support for vendor-specific controls and properties to libcamera.
The controls/properties are defined by a "vendor" tag in the YAML
control description file, for example:

vendor: rpi
controls:
  - MyExampleControl:
      type: string
      description: |
        Test for libcamera vendor-specific controls.

This will now generate a control id in the libcamera::controls::rpi
namespace, ensuring no id conflict between different vendors, core or
draft libcamera controls. Similarly, a ControlIdMap control is generated
in the libcamera::controls::rpi namespace.

A #define LIBCAMERA_HAS_RPI_VENDOR_CONTROLS is also generated to allow
applications to conditionally compile code if the specific vendor
controls are present. For the python bindings, the control is available
with libcamera.controls.rpi.MyExampleControl. The above controls
example applies similarly to properties.

Existing libcamera controls defined in control_ids.yaml are given the
"libcamera" vendor tag.

A new --mode flag is added to gen-controls.py to specify the mode of
operation, either 'controls' or 'properties' to allow the code generator
to correctly set the #define string.

As a drive-by, sort and redefine the output command line argument in
gen-controls.py and gen-py-controls.py to ('--output', '-o') for
consistency.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-29 09:05:37 +00:00
Brett Brotherton
61f6b37242 libcamera: pipeline: Fix c++20 compile warning
Fix -Wdeprecated-this-capture error when building with c++20 by
explicity naming this in the capture.

Signed-off-by: Brett Brotherton <bbrotherton@google.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-11-29 02:50:40 +02:00
Laurent Pinchart
64be677b11 Documentation: Fix list indentation
reStructuredText requires list items to be indented. Fix the few
offenders in the documentation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-28 14:08:13 +02:00
Laurent Pinchart
74c5db6fd4 README.rst: Use code directive for all code examples
Most of the code examples in README.rst use the code directive, but some
use literal blocks or just quoted paragraphs. Use the code directive for
all code for consistency.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-28 14:08:04 +02:00
Laurent Pinchart
e25003e78b Documentation: contributing: Integrate the code of conduct
Now that libcamera has an official code of conduct, mention it in the
'contributing' document with a clear indication that all community
members are expected to follow the code of conduct.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-25 19:01:07 +02:00
Laurent Pinchart
cfb7a260e9 Documentation: code-of-conduct: Add contact information
Replace the boilerplate "[INSERT EMAIL ADDRESS]" contact information
with conduct@libcamera.org, and indicate that the people behind that
e-mail address can also be contacted directly if needed. The direct
contact information aims at offering more confidence to reporters than
an anonymous mail alias in case they wish to report an issue with one of
the core project members.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-25 18:56:32 +02:00
Laurent Pinchart
f285ce9c54 Documentation: code-of-conduct: Add license information
The Contributor Covenant is covered by the CC-BY-4.0 license. Indicate
this in the file.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-25 18:56:20 +02:00
Laurent Pinchart
62956b34eb Documentation: code-of-conduct: Convert to reStructuredText
All documentation in libcamera is in reStructuredText format. Convert
the code of conduct from Markdown. No change in the contents is
intended.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-25 18:55:57 +02:00
Laurent Pinchart
0fae5d8c86 Documentation: Add code of conduct
Communities have standards regarding behaviours they consider acceptable
or not acceptable, and expect community members to follow those
standards. libcamera is no different, even if it has never clearly
expressed those standards in a formal code of conduct document.

Like software licenses, codes of conduct can be written in a myriad of
ways. And like software licenses, using a widely adopted code of conduct
instead of writing our own can help bringing clarity. One such standard
code of conduct is the Contributor Covenant, stewarded by the
Organization for Ethical Source.

The Contributor Covenant has been adopted by the freedesktop.org
organization, which hosts a large number of projects historically
related to graphics, and more recently to multimedia in general.
freedesktop.org offers services such as git hosting with CI, which
libcamera could benefit from. There is therefore a clear incentive to
choose the same code of conduct as freedesktop.org, and no known
drawback.

As a first step towards this, and to keep the libcamera code of conduct
history clear in git, copy the original Contributor Covenant v1.4 from
https://github.com/EthicalSource/contributor_covenant/. "v1.4" is
ambiguous as the document initially published as v1.4 has received small
(but sometimes significant) modifications over time. The version
imported here ([1]) is the most recent "v1.4", from tags/2.1 (commit
8a3be1350b07 "Merge pull request #979 from JustArchi/patch-2").

[1] https://github.com/EthicalSource/contributor_covenant/blob/2.1/content/version/1/4/code-of-conduct.md

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-25 16:12:30 +02:00
Jaslo Ziska
62e5289819 gstreamer: Fix unused variable error
Commit fd84180d7a ("gstreamer: Implement element EOS handling") has
introduced a compilation warning with clang:

../../src/gstreamer/gstlibcamerasrc.cpp:768:23: error: unused variable 'oldEvent' [-Werror,-Wunused-variable]
                g_autoptr(GstEvent) oldEvent = self->pending_eos.exchange(event);
                                    ^

This seems to be a false positive, but nonetheless breaks the build. Fix
it.

Fixes: fd84180d7a ("gstreamer: Implement element EOS handling")
Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-11-23 10:10:04 +02:00
David Plowman
2fae9603e6 ipa: rpi: alsc: Do not allow zero colour ratio statistics
The algorithm computes R/G and B/G colour ratio statistics which we
should not allow to go to zero because there is clearly no gain you
could apply to R or B to equalise them. Instead flag such regions as
having "insufficient data" in the normal manner.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-11-22 18:33:17 +02:00
Jaslo Ziska
fd84180d7a gstreamer: Implement element EOS handling
This commit implements EOS handling for events sent to the libcamerasrc
element by the send_event method (which can happen when pressing
Ctrl-C while running gst-launch-1.0 -e, see below). EOS events from
downstream elements returning GST_FLOW_EOS are not considered here.

To archive this add a function for the send_event method which handles
the GST_EVENT_EOS event. This function will set an atomic to the
received event and push this EOS event to all source pads in the running
task.

Also set the GST_ELEMENT_FLAG_SOURCE flag to identify libcamerasrc as a
source element which enables it to receive EOS events sent to the
(pipeline) bin containing it. This in turn enables libcamerasrc
to receive EOS events, for example, from gst-launch-1.0 with
the -e (--eos-on-shutdown) flag applied.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=91
Signed-off-by: Jaslo Ziska <jaslo@ziska.de>
Acked-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Signed-off-by: Umang Jain <umang.jain@ideasonboard.com>
2023-11-22 01:18:19 +05:30
Naushir Patuck
091591b52e pipeline: rpi: Add some useful logging messages
Add a bunch of logging messages that have come in handy debugging
various issues with the pipeline handler code.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-11-21 11:48:22 +02:00
Alain Volmat
882d04d740 libcamera: camera_sensor: Only access V4L_CID_HBLANK if existing
Correct a crash in CameraSensor::init() when trying to set the
V4L2_CID_HBLANK control on sensor not implementing this control. The
HBLANK sensor not being mandatory for non-RAW sensors, it can happen
that the sensor does not expose this control. Perform check against
availability of the control prior to usage in order to avoid the crash.

Signed-off-by: Alain Volmat <alain.volmat@foss.st.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-11-21 11:46:03 +02:00
Naushir Patuck
34b248c88f pipeline: rpi: vc4: Fix drop frame bug when no ISP streams are configured
If no ISP output streams are configured, the ISP output count is skipped
for the the low res stream, and causes the drop frame logic to fail
because of a count mismatch. This in-turn stops any requests from
completing correctly.

Fix this by ensuring the low res output is counted correctly when no ISP
output streams are configured.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-06 11:48:46 +00:00
Naushir Patuck
226a1dacb1 pipeline: rpi: Remove unused variable
The entityControls variable is unused, remove it.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-11-06 11:44:41 +00:00
David Plowman
73c7eeb3e4 libcamera: controls: Add controls for HDR
We add an HdrMode control (to enable and disable HDR processing)
and an HdrChannel, which indicates what kind of HDR frame (short, long
or medium) has just arrived.

Currently the HdrMode supports the following values:

* Off - no HDR processing at all.
* MultiExposureUnmerged - frames at multiple different exposures are
  produced, but not merged together. They are returned "as is".
* MultiExposure - frames at multiple different exposures are merged
  to create HDR images.
* SingleExposure - multiple frames all at the same exposure are
  merged to create HDR images.
* Night - multiple frames will be combined to create "night mode"
  images.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-11-06 11:31:37 +02:00
David Plowman
02eea043f2 ipa: rpi: agc: Make AGC controls affect all channels
We need to be able to do things like enable/disable AGC for all the
channels, so most of the AGC controls are updated to be applied to all
channels. There are a couple of exceptions, such as setting explicit
shutter/gain values, which apply only to channel 0.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-10-24 14:11:33 +01:00
David Plowman
78a2d00c79 ipa: rpi: agc: Fetch AWB status in the prepare method
AWB writes this out during prepare, so we may as well read it in AGC
prepare as well. Reading it in process is wrong on the PiSP platform
because process runs before prepare, so the AWB status won't be there
(on vc4 it made no difference).

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-10-24 14:11:33 +01:00