summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)Author
12 dayslibcamera: Drop remaining file name from header comment blocksLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment blocks in all remaining locations that were not caught by the automated script as they are out of sync with the file name. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
12 dayslibcamera: Drop file name from header comment blocks in templatesLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment blocks in template files and templates embedded in generator scripts. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
13 dayslibcamera: Drop file name from header comment blocksLaurent Pinchart
Source files in libcamera start by a comment block header, which includes the file name and a one-line description of the file contents. While the latter is useful to get a quick overview of the file contents at a glance, the former is mostly a source of inconvenience. The name in the comments can easily get out of sync with the file name when files are renamed, and copy & paste during development have often lead to incorrect names being used to start with. Readers of the source code are expected to know which file they're looking it. Drop the file name from the header comment block. The change was generated with the following script: ---------------------------------------- dirs="include/libcamera src test utils" declare -rA patterns=( ['c']=' \* ' ['cpp']=' \* ' ['h']=' \* ' ['py']='# ' ['sh']='# ' ) for ext in ${!patterns[@]} ; do files=$(for dir in $dirs ; do find $dir -name "*.${ext}" ; done) pattern=${patterns[${ext}]} for file in $files ; do name=$(basename ${file}) sed -i "s/^\(${pattern}\)${name} - /\1/" "$file" done done ---------------------------------------- This misses several files that are out of sync with the comment block header. Those will be addressed separately and manually. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
13 dayslibcamera: controls: Generate enum value-name mapsDaniel Scally
Generate maps for each control enum which associate strings that represent the enum values with the values themselves. This change will allow us to refer to enumerated control values using the string. For example if we want to pass variables to an algorithm for use when a control has a particular value we can embed within tuning files a dictionary that uses the control values as keys. Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Signed-off-by: Daniel Scally <dan.scally@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-04-20libcamera: Fix output spelling errorUmang Jain
There are two places where "output" is spelled as "ouput". Fix it. Signed-off-by: Umang Jain <umang.jain@ideasonboard.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-04-19utils: checkstyle.py: Drop period at end of Doxygen one linersLaurent Pinchart
The libcamera documentation style calls for no period at the end of the Doxygen one-liner commands (\brief, \param and \return). Extend the DoxygenFormatter class to drop the period. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-04-19utils: checkstyle.py: Use r'' strings for regular expressionsLaurent Pinchart
It's a good practice to use r'' strings for regular expressions in Python, to avoid unexpected interaction with string escape sequences. Use them globally. This allows simplifying escaping in one of the regular expression strings. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-04-17ipu3: Use posix basenameKhem Raj
musl does not implement GNU basename extention and with latest musl the prototype from string.h is also removed [1] which now results in compile errors e.g. ../git/utils/ipu3/ipu3-pack.c:21:47: error: call to undeclared function 'basename'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration] These utilities are using this function in usage() which is used just before program exit. Always use the basename APIs from libgen.h which is posix implementation [1] https://git.musl-libc.org/cgit/musl/commit/?id=725e17ed6dff4d0cd22487bb64470881e86a92e7 Signed-off-by: Khem Raj <raj.khem@gmail.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-04-13utils: ipc: Fix async main interface functions with no parametersPaul Elder
If an async main interface function is defined with no parameters, there would be a compilation error complaining about an extra comma. Fix this. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-04-10utils: ipc: Fix event functions with no parametersPaul Elder
If an event function is defined with no parameters, there would be a compilation error complaining about unused parameters in the generated code for the data and dataSize parameters that would normally correspond to serialized data. Fix this by simply marking the parameters as maybe_unused. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-03-19utils: tuning: readme: Improve names of dependency packagesPaul Elder
Change the names of python packages in the list of dependencies to the exact names that should be used in the pip install command. Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-03-15checkstyle: Work around bug in difflibStefan Klug
If a file misses the newline at the end it gets detected by checkstyle, but the resulting patch is incorrect and does not apply. It took me a while to understand that it wasn't me using checkstyle incorrectly, but that the patch was faulty. The bug itself is in difflib and dates back to 2008. To reproduce: - Remove trailing newline from a file - git add the file - run ./utils/checkstyle.py -s | patch -p0 Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2024-03-11utils: checkstyle.py: Fix known_trailers sort orderHans de Goede
An unruly libcamera maintainer merged the wrong patch adding the Co-developed-by: tag to the known_trailers. Fix the sort order alphabetically to match the version which should have been merged. Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-03-11utils: checkstyle.py: Add Co-developed-by to known_trailersHans de Goede
Add Co-developed-by to known_trailers to silence false positive "Invalid commit trailer key 'Co-developed-by'" warnings. Signed-off-by: Hans de Goede <hdegoede@redhat.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-02-28utils: ipu3: Fix return value check on file outputKieran Bingham
The data parsed by ipu3-unpack is written out using the write() c library call, but the error code is incorrectly checked which misses the single erroroneous return value returned by the function. Fix it to explicitly check against the error code. Fixes: 23ac77dc4a09 ("utils: ipu3: Add IPU3 raw capture unpack utility") Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-02-27utils: rkisp1: gen-csc-table.py: Don't presume python3 locationLaurent Pinchart
The python3 binary may be present in a location other than /usr/bin/. Use /usr/bin/env to locate it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>
2024-02-27utils: checkstyle.py: Update LogCategoryChecker regexpMilan Zamazal
The regexp uses obsolete form, update it to mute the warning emitted by Python 3.12: SyntaxWarning: invalid escape sequence '\(' Signed-off-by: Milan Zamazal <mzamazal@redhat.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>
2024-02-27utils: checkstyle.py: Don't presume python3 locationMilan Zamazal
python3 binary may be present in a location other than /usr/bin/. Signed-off-by: Milan Zamazal <mzamazal@redhat.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>
2024-02-15utils: mojom: Fix build error caused by the mojom tool updateNaushir Patuck
The update to the mojom tool in commit d17de86904f0 causes build errors with gcc 12.2 release builds. One such error is: In file included from src/libcamera/proxy/worker/raspberrypi_ipa_proxy_worker.cpp:18: In static member function ‘static libcamera::ipa::RPi::ProcessParams libcamera::IPADataSerializer<libcamera::ipa::RPi::ProcessParams>::deserialize(std::vector<unsigned char>::const_iterator, std::vector<unsigned char>::const_iterator, libcamera::ControlSerializer*)’, inlined from ‘void IPAProxyRPiWorker::readyRead()’ at src/libcamera/proxy/worker/raspberrypi_ipa_proxy_worker.cpp:302:70: include/libcamera/ipa/raspberrypi_ipa_serializer.h:1172:32: error: ‘*(uint32_t*)((char*)&ret + offsetof(libcamera::ipa::RPi::ProcessParams, libcamera::ipa::RPi::ProcessParams::buffers.libcamera::ipa::RPi::BufferIds::bayer))’ may be used uninitialized [-Werror=maybe-uninitialized] 1172 | return ret; The failure is caused by the new auto-generated IPA interface not initialising POD types to a default value. This is because the updated mojom library uses a new mojom.ValueKind class to represent POD types, whereas the interface generator script uses the mojom.Kind class, which is correct for the older mojom library. Fix this breakage by switching the interface generator script to use mojom.ValueKind to test for POD types. Fixes: d17de86904f0 ("utils: ipc: Update mojo") Signed-off-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2024-01-25libcamera: signal: Replace object.h inclusion with forward declatationLaurent Pinchart
The signal.h header doesn't need to include object.h. Replace it with a forward declaration, and instead include object.h in source files that require it. It can speed up compilation a little bit, but more importantly avoids unintended dependencies from the Signal class to the Object class to be added later as the compiler will catch them. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
2024-01-23utils: ipc: extract-docs: Fix escape characters in regexPaul Elder
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-09utils: ipc: Update mojoLaurent Pinchart
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-09utils: ipc: generate.py: Disable attributes checkerLaurent Pinchart
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-09utils: ipc: generate.py: Add bindings directory to Python pathLaurent Pinchart
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-09utils: update-mojo.sh: Commit the mojo updateLaurent Pinchart
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-09utils: update-mojo.sh: Reject a dirty libcamera treeLaurent Pinchart
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-09utils: update-mojo.sh: Change to the libcamera source directoryLaurent Pinchart
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-09utils: update-mojo.sh: Exit immediately on errorLaurent Pinchart
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-09utils: update-mojo.sh: Properly remove old sourcesLaurent Pinchart
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-09hooks: pre-push: Disable interpretation of escape sequencesKieran Bingham
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-09utils: ipc: mojom_libcamera_generator.py: Fix Python warningMilan Zamazal
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-09utils: ipc: Fix deserialization of multiple fd parametersPaul Elder
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-09utils: raspberrypi: ctt: Improve the Macbeth Chart search reliabilityDavid Plowman
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>
2023-11-30libcamera: controls: Use vendor tags for draft controls and propertiesNaushir Patuck
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-29libcamera: control: Add vendor control id range reservationNaushir Patuck
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-29build: controls: Rework how controls and properties are generatedNaushir Patuck
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-29controls: Update argument handling for controls generation scriptsNaushir Patuck
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-29controls: Add vendor control/property support to generation scriptsNaushir Patuck
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-10-18utils: update-kernel-headers: Support git worktreesLaurent Pinchart
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-07-28utils: checkstyle.py: Extract title and trailers with one commandLaurent Pinchart
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-28utils: raspberrypi: ctt: Code tidyingBen Benson
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-28utils: raspberrypi: ctt: Improved color matrix fittingBen Benson
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-18utils: checkstyle.py: Check trailers for Amendment commitsKieran Bingham
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-18utils: checkstyle.py: Derive Amendment from CommitKieran Bingham
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-18utils: checkstyle.py: Initialise staged trailersKieran Bingham
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-18utils: checkstyle.py: Treat Malformed trailers as a CommitIssueKieran Bingham
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-05utils: checkstyle: Add trailers checkerLaurent Pinchart
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-05utils: checkstyle: Don't include commit ID in commit titleLaurent Pinchart
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-05utils: checkstyle: Support running checkers selectivelyLaurent Pinchart
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-05utils: checkstyle: Add __repr__ method to CommitFile classLaurent Pinchart
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>