Commit graph

227 commits

Author SHA1 Message Date
Paul Elder
81791d2cac utils: ipc: extract-docs: Fix escape characters in regex
Newer versions of python now generate a SyntaxWarning (SyntaxError in
the future [1]) for invalid escape sequences. Fix this, as there were
invalid escape sequences in the regexes:

"libcamera/utils/ipc/./extract-docs.py:13: SyntaxWarning: invalid escape
sequence '\/'"

[1] https://docs.python.org/3.12/library/re.html

Reported-by: Nicolas Dufresne <nicolas@ndufresne.ca>
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-01-23 02:21:30 +02:00
Laurent Pinchart
d17de86904 utils: ipc: Update mojo
Update mojo from commit

9be4263648d7d1a04bb78be75df53f56449a5e3a "Updating trunk VERSION from 6225.0 to 6226.0"

from the Chromium repository.

The update-mojo.sh script was used for this update.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=206
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:05 +00:00
Laurent Pinchart
8ac367fe0c utils: ipc: generate.py: Disable attributes checker
The attributes checker ensures that .mojom files don't contain unknown
attributes. These check fail with the custom 'skipSerdes' and 'async'
libcamera attributes. Ideally the list of supported attributes should be
extended, but that can't easily be done without modifying the mojo
sources that we try to keep identical to the upstream version to make
updates easier. Disable the attributes checker completely for now to fix
this issue.

While at it, fix an indentation issue reported by checkstyle.py.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:05 +00:00
Laurent Pinchart
3e4a211ff4 utils: ipc: generate.py: Add bindings directory to Python path
Newer mojo versions import a 'checks' module located in the bindings
directory. In preparation for a mojo update, add the directory to the
Python path make the import work.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:05 +00:00
Laurent Pinchart
3a74a36316 utils: update-mojo.sh: Commit the mojo update
Commit the mojo update with a standardized commit message. As mojo is
imported as-is without local modifications, this simplifies usage of the
update script.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:05 +00:00
Laurent Pinchart
a9adb798e1 utils: update-mojo.sh: Reject a dirty libcamera tree
If the libcamera tree is dirty committing the result of the mojo update
will be messy. Bail out in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:04 +00:00
Laurent Pinchart
0e9585ff5b utils: update-mojo.sh: Change to the libcamera source directory
Instead of prefixing all paths to IPC files with ${ipc_dir}, change to
the libcamera sources root directory and use relative file paths. This
simplifies the update script.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:04 +00:00
Laurent Pinchart
09af551b93 utils: update-mojo.sh: Exit immediately on error
If an error occurs there's no point in ignoring it silently and
continuing. Exit immediately.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:04 +00:00
Laurent Pinchart
cb69c6e843 utils: update-mojo.sh: Properly remove old sources
The update-mojo.sh script starts by removing all sources before copying
the new files from chromium. A bug in the 'rm' command makes the removal
a no-op: the glob pattern is quoted, which attempts to remove a file
name '*' in the tools directory, not all files in the directory. Fix it
by removing the whole utils/ipc/mojo/ directory.

While at it, also remove the utils/ipc/tools/ directory that contains
imported sources.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:04 +00:00
Kieran Bingham
ffcd1b2804 hooks: pre-push: Disable interpretation of escape sequences
The pre-push hook validates the commit messages utilising 'echo' to send
the captured data from the git commit through grep.

Commit messages may occasionally contain strings that could appear to be
escape sequences such as doxygen style references to \struct.

The '\' 'c' escape sequence can be interpreted to supress all further
output [0] which then breaks the processing and string matching.

Unfortunatley for us, doxygen's class reference constructed in the same
form as \struct can be interpreted as the escape sequence to supress
further output.

[0] https://www.gnu.org/software/bash/manual/bash.html#Bash-Builtins

Update the pre-push hook to explicitly disable escape sequence
interpretation using the '-E' flag. This is not available on the
posix-compliant shell 'dash', so also switch to bash explicitly to
prevent potential failures.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:04 +00:00
Milan Zamazal
3d45b9ad9a utils: ipc: mojom_libcamera_generator.py: Fix Python warning
Python 3.12 starts emitting the following warning when building libcamera:

  .../utils/ipc/generators/mojom_libcamera_generator.py:372:
  SyntaxWarning: invalid escape sequence '\.'
    if not re.match('^ipa\.[0-9A-Za-z_]+', namespace):

`r' prefix is now required before the regexp.

Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
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>
2024-01-09 15:39:04 +00:00
Paul Elder
1d0d2cf67c utils: ipc: Fix deserialization of multiple fd parameters
The IPADataSerializer::deserializer attempts to optimise code paths and
remove potentially unused code where multiple File Descriptors were not
expected to be utilised.

The addition of multiple SharedFD entries in the IPC highlights this as
a bug.

Clean up the conditionals to ensure that all File Descriptors are
correctly deserialized.

Bug: https://bugs.libcamera.org/show_bug.cgi?id=205
Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Tested-by: Andrey Konovalov <andrey.konovalov@linaro.org>
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>
2024-01-09 15:39:04 +00:00
David Plowman
66479605ba utils: raspberrypi: ctt: Improve the Macbeth Chart search reliability
Previously the code would brighten up images in case the Macbeth Chart
is slightly dark, and also zoom in on sections of it to look for
charts occupying less of the field of view. But it would not do both
together.

This change makes the search for smaller charts also repeat that
search for the brightened up images that it made earlier, thereby
increasing the chances of success for non-optimal tuning images.

There are also a couple of very small drive-by typo fixes.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Tested-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-09 15:39:02 +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
Laurent Pinchart
d2094a0185 utils: update-kernel-headers: Support git worktrees
When operating on a git worktree, the Linux kernel directory contains a
.git file, not a .git directory. Relax the git tree check to support
both.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-10-18 16:17:18 +03:00
Laurent Pinchart
4694e441c3 utils: checkstyle.py: Extract title and trailers with one command
The Amendment class calls `git show` twice, once to extract the commit
title, and a second time to extract the trailers. This can be combined
in a single command, which is more efficient. Do so.

While at it, centralize initialization of self._trailers in the
Commit.__init__() function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-28 19:11:56 +03:00
Ben Benson
09dd65442b utils: raspberrypi: ctt: Code tidying
Altered the way that some lines are laid out, made functions
more attractive to look at, and tidied up messy areas.

Signed-off-by: Ben Benson <ben.benson@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-28 08:32:40 +01:00
Ben Benson
f8dd17a8f4 utils: raspberrypi: ctt: Improved color matrix fitting
Added code which optimises the color matrices based off
delta E values for the calibration images. Working in LAB
color space.

Signed-off-by: Ben Benson <ben.benson@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Naushir Patuck <naush@raspberrypi.com>
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
2023-07-28 08:31:38 +01:00
Kieran Bingham
baaad1bf9e utils: checkstyle.py: Check trailers for Amendment commits
The commit trailers are checked as part of processing the commit message
with the newly introduced TrailersChecker.

This relies on the trailers property being correctly exposed by the
Commit object, and is implemented for the base Commit but not processed
for Amendment commits.

Refactor the trailer property handling to a helper function in the base
Commit class and make use of it with a newly added call to obtain the
existing Trailers from the most recent commit when using Amendment.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18 09:26:31 +01:00
Kieran Bingham
e2f0ad27b1 utils: checkstyle.py: Derive Amendment from Commit
The Amendment commit class is derived from the StagedChanges class
(which in turn derives from the Commit base class), however there is no
code sharing between Amendment and StagedChanges other than the call to
initalise through the base Commit class.

Refactor the inheritance to make an Amendment derive directly from
Commit.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18 09:26:24 +01:00
Kieran Bingham
37106ba02a utils: checkstyle.py: Initialise staged trailers
There are no possible Trailers for staged changes as the commit message
has not yet been written.

Initialise the empty trailers when the commit object is initialised.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18 09:26:12 +01:00
Kieran Bingham
b14d2cab12 utils: checkstyle.py: Treat Malformed trailers as a CommitIssue
If a Malformed trailer is identified the checkstyle script triggers a
RuntimeError and stops processing the rest of the commit.

A malformed trailer can be regarded as an issue in the commit and
reported as such using the same method as other faults identified by the
tool.

Convert the RuntimeError into a CommitIssue and continue processing
other trailers.

Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-18 09:25:13 +01:00
Laurent Pinchart
d06ed87d49 utils: checkstyle: Add trailers checker
The libcamera git history contains numerous examples of incorrect commit
message trailers due to invalid trailer types (e.g. Change-Id), typos
and other small issues. Those went unnoticed through reviews, which
shows that an automated checker is required.

Add a trailers checker to checkstyle.py to catch invalid or malformed
trailers, with a set of supported trailers that match libcamera's commit
message practices. New trailer keys can easily be added later as new
needs arise.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 17:11:26 +03:00
Laurent Pinchart
925ee0ac8e utils: checkstyle: Don't include commit ID in commit title
The commit title and commit ID are two different pieces of information.
Don't include the latter in the former, to simplify code that only needs
the commit title. Constructing a string from the ID and title is easier
than splitting the combined string back into its elements.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 15:39:02 +03:00
Laurent Pinchart
69e3983acf utils: checkstyle: Support running checkers selectively
During development of the checkstyle.py script, it can be useful to run
only a subset of the checker. Add the ability to do so with a
'--checkers' command line argument.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 15:39:00 +03:00
Laurent Pinchart
c9b2f62edd utils: checkstyle: Add __repr__ method to CommitFile class
Add a custom representation to the CommitFile class in order to
facilitate debugging.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-05 15:39:00 +03:00
Hans de Goede
c49958d0b4 utils: ipu3-capture.sh: Fix the script to work with recent media-ctl versions
Recent media-ctl versions include the framerate in the fmt property output:

- entity 37: ov5693 4-0036 (1 pad, 1 link)
             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev6
	pad0: Source
		[fmt:SBGGR10_1X10/2592x1944@1/30
		 crop.bounds:(16,6)/2592x1944
		 crop:(16,6)/2592x1944]
		-> "ipu3-csi2 1":0 [ENABLED]

This resulted in $sensor_size getting set to: "2592x1944@1 30", which
causes the script to fail.

Fix this by:

1. Replacing the gsub() to remove the '/' between e.g. SBGGR10_1X10
and 2592x1944 with a sub() so that only that first '/' gets replaced
(resulting in a $sensor_size of "2592x1944@1/30" instead).

2. Adding a new sub() to remove the @1/30 suffix.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
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>
2023-07-05 00:51:34 +01:00
Kieran Bingham
bbb77cc59b utils: ABI Compatibility checker
Provide support to compare ABI compatibility between any two git commits
or by a commit and the most recent ancestral tag of that commit.

Tested-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2023-07-04 20:25:10 +01:00
Harvey Yang
c1cc37b2ee utils: ipc: Update parser.py
Make the local mojom library the first priority in the sys path, to
avoid mixing the local one with the system one in build.

Tested on chromebook soraka-libcamera.

Signed-off-by: Harvey Yang <chenghaoyang@chromium.org>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.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>
2023-04-05 08:24:11 +03:00
Laurent Pinchart
4cd9cb4a90 meson: Really fix git version parsing
The previous attempt to fix git version parsing in commit d34cefad17
("meson: Fix git version parsing") was too naive, and didn't take into
account cases where the libcamera git version contains no or multiple
'+' signs.

Fixing this is more complex than a one-liner change, as meson doesn't
support Python-style slicing of arrays or a length method on strings.
The simplest and most versatile option is to patch the version string in
the gen-version.sh script. Do so, and clarify the comments related to
version handling in meson.build.

Fixes: d34cefad17 ("meson: Fix git version parsing")
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
2023-04-05 07:16:07 +03:00
Paul Elder
51396ab512 utils: checkstyle.py: Don't run commit title checker on staged commits
When creating a new commit, there is no title, so the title checker
complains that the title isn't compliant and the commit cannot be
created if checkstyle is run as a pre-commit hook. Fix this by skipping
the title checker when run on staged changes.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2023-03-01 17:20:05 +09:00
Laurent Pinchart
2535e31d9e utils: checkstyle.py: Add commit title checker
Add a commit checker to ensure that commit titles start with a prefix.
The commit issue message lists prefix candidates retrieved from the git
log.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
2023-01-10 15:36:13 +02:00
Xavier Roumegue
7ace78e215 utils: checkstyle.py: Check new header file on new and renamed meson.build files
Declaration of new header file to the build system are only checked against
modified meson.build file. Therefore, this raises a false positive warning in
case the meson.build is added or renamed.

Add the new and renamed meson.build files to the list of files to check header
file inclusion.

Signed-off-by: Xavier Roumegue <xavier.roumegue@oss.nxp.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-12-15 12:31:48 +02:00
Paul Elder
c7bbe0ca3a utils: tuning: Add tuning script for rkisp1
Add a tuning script for rkisp1 that uses libtuning. So far it only
supports LSC.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:38:17 +09:00
Paul Elder
4af9f81802 utils: tuning: Add alsc-only libtuning raspberrypi tuning script
Add a tuning script for raspberrypi for alsc only, that uses libtuning.
Since there will also be a tuning script for raspberrypi that has more
modules, put the libtuning alsc module definition in a separate file so
that it can be reused later.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:38:13 +09:00
Paul Elder
d62f2acce4 utils: libtuning: generators: Add yaml output
Add a generator to libtuning for writing tuning output to a yaml file.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:38:03 +09:00
Paul Elder
0f89bf3efd utils: libtuning: parsers: Add yaml parser
Add a parser to libtuning for parsing configuration files in yaml
format.

At the moment it doesn't parse anything and simply returns an empty
config. This is fine for the time being, as the only user of it is the
rkisp1 tuning script, which only has an LSC module which doesn't consume
anything from the configuration file. When a module comes around that
requires the yaml parser, it can be implemented then.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:50 +09:00
Paul Elder
b44ee5c348 utils: libtuning: generators: Add raspberrypi output
Add a generator to libtuning for writing tuning output to a json file
formatted the same way that raspberrypi's ctt formats them.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:47 +09:00
Paul Elder
49dfb9ae43 utils: libtuning: parsers: Add raspberrypi parser
Add a parser to libtuning for parsing configuration files that are the
same format as raspberrypi's ctt's configuration files.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:44 +09:00
Paul Elder
f715a75843 utils: libtuning: modules: alsc: Add rkisp1 LSC module
Add an LSC module for RkISP1.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:41 +09:00
Paul Elder
280e4acf94 utils: libtuning: modules: alsc: Add raspberrypi ALSC module
Add an ALSC module for Raspberry Pi.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:38 +09:00
Paul Elder
288cfb9b8b utils: libtuning: modules: Add base LSC module
Add a base LSC module to libtuning's collection of modules. It is based
on raspberrypi's ctt's ALSC, but customizable for different lens shading
table sizes, among other things. It alone is insufficient as a module,
but it provides utilities that are useful for and which will simplify
implementing LSC modules.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:34 +09:00
Paul Elder
b8af2500fa utils: tuning: libtuning: Implement extensible components of libtuning
Implement the extensible components of libtuning. This includes:
- Parsers, for supporting different types of input config file formats
- Generators, for supporting different types of output tuning file
  formats
- Modules, for supporting different tuning modules for different
  algorithms and platforms

No parsers, generators, or modules are actually implemented. Only the
base classes are implemented.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:30 +09:00
Paul Elder
db99d96663 utils: tuning: libtuning: Implement math helpers
Implement math helpers for libtuning. This includes:
- Average, a wrapper class for numpy averaging functions
- Gradient, a class that represents gradients, for distributing and
  mapping
- Smoothing, a wrapper class for cv2 smoothing functions

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:26 +09:00
Paul Elder
19dc8c28f6 utils: tuning: libtuning: Implement the core of libtuning
Implement the core of libtuning, our new tuning tool infrastructure. It
leverages components from raspberrypi's ctt that could be reused for
tuning tools for other platforms.

The core components include:
- The Image class
- libtuning (entry point and other core functions)
- macbeth-related tools, including the macbeth reference image
- utils

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2022-11-25 15:37:22 +09:00
Barnabás Pőcze
cfa7488072 libcamera: tracing: fix header generation when built as subproject
Building libcamera as a subproject is failing when tracepoints are
enabled due to incorrectly managing the relative paths between the
source and build directory while generating tracepoint headers.

The previously used

  path = output.replace('include/', '', 1)

logic is not sufficient to correctly determine the proper path when
libcamera is built as a subproject, and does not correctly handle the
relative paths, causing path to be processed as:

  'subprojects/libcamera/include/libcamera/internal/tracepoints.h'.replace('include/', '', 1)

which evaluates to

  'subprojects/libcamera/libcamera/internal/tracepoints.h'

so the tracepoints.h header file will try to include:

  #define TRACEPOINT_INCLUDE "subprojects/libcamera/libcamera/internal/tracepoints.h"

which will fail.

Fix it by using Python's pathlib to calculate the relative path of the
output file with respect to the "include" directory of libcamera.

This has been tested with Pipewire. For non-subproject builds it should
generate the exact same path that was previously generated.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
[Kieran: Commit message expanded/reworded]
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2022-11-24 14:52:00 +00:00