Commit graph

16 commits

Author SHA1 Message Date
Laurent Pinchart
bc6b758c71 utils: checkstyle.py: Refactor formatters and checkers support
Introduce two new base classes for the code formatters and style
checkers, with an auto-registration mechanism that automatically uses
all derived classes. This will allow easier addition of new formatters
and checkers.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-07-01 02:24:21 +03:00
Laurent Pinchart
ffef90a1c1 utils: rkisp1: Add test capture script
The script captures raw or processed frames from cameras based on the
Rockchip ISP1. It takes the sensor name as an argument and isn't meant
to depend on a particular platform.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-03-29 16:39:10 +02:00
Laurent Pinchart
5fb0ea016c utils: checkstyle: Catch LOG() usage without an explicit category
Add support for checkers not related to code formatting to the
checkstyle.py script, and create a first checker that catches usage of
the LOG() macro without an explicit category.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-02-13 13:23:34 +02:00
Kieran Bingham
3f82f50227 utils: hooks: Provide post-commit hook example to checkstyle.py
Provide an example post-commit hook which a developer can install, ensuring
that every commit gets the style checker executed on it.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2019-01-30 10:57:37 +00:00
Laurent Pinchart
1369c0b7c3 utils: checkstyle: Add support for clang-format
clang-format produces better results than astyle as it can better match
the libcamera coding style. Default to clang-format over astyle, fall
back to astyle if clang-format isn't found, and add a --formatter
command line option to select a formatter manually.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
2019-01-22 14:30:00 +02:00
Kieran Bingham
df7bd278a6 utils: checkstyle: add keep-one-line-blocks
Enable --keep-one-line-blocks to prevent astyle from wanting to move
single inlined blocks to cover 4 lines such as:

-       virtual int init() { return 0; }
+       virtual int init()
+       {
+               return 0;
+       }

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-12-21 15:18:32 +00:00
Laurent Pinchart
3c8886d698 utils: checkstyle.py: Strip trailing white spaces
As astyle doesn't strip trailing white spaces, strip them manually.
Organize the code to allow for new additional formatting steps if
needed.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19 14:11:16 +02:00
Laurent Pinchart
cf04a496a6 utils: checkstyle.py: Highlight trailing white space at end of line
In order to facilitate interpretation of diffs, highlight trailing white
space at end of lines with a red background.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19 14:11:16 +02:00
Laurent Pinchart
2887934ca0 utils: checkstyle.py: Support execution from non-root directories
The git diff command is invoked with relative paths, which causes git to
fail to locate files when the checkstyle.py script is run from
subdirectories of the git tree. Fix this by prepending the absolute path
to the git tree root directory to the file names.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-19 14:11:16 +02:00
Laurent Pinchart
8b30bb3185 utils: Add Python-based commit style checker script
checkstyle.py is a reimplementation of checkstyle.sh in Python, that
should be easier to extend with additional features.

Three additional features and enhancements are already implemented:

- While retaining the default behaviour of operating on the HEAD commit,
  a list of commits can also be specified on the command line.

- Correct line numbers are printed in the diff output.

- The index and working tree are not touched, they can be dirty.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-14 15:34:00 +02:00
Laurent Pinchart
0763b8a80e utils: ipu3: process: Configure formats on ImgU subdev pads
Set format and selection rectangles on the ImgU subdev as required by
the driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-11 15:58:19 +02:00
Laurent Pinchart
1ebd2c09f5 utils: ipu3: process: Fix typo in output files path
A typo in the output files path causes the script to attempt to write
all captured frames to /. Fix it.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-11 15:48:26 +02:00
Laurent Pinchart
0d96f3e232 utils: ipu3: Abort when sensor or media device isn't found
Calling exit from a function only exits from the function, it doesn't
abort the whole script. Propagate the errors to stop operation when the
sensor or media device can't be found.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-11 00:31:24 +02:00
Laurent Pinchart
b4935e9a4d utils: ipu3: Add test process script
The script processes raw frames through the Intel IPU3 IMGU.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2018-12-02 19:23:07 +02:00
Laurent Pinchart
9cb17c2743 utils: ipu3: Add test capture script
The script captures raw frames from cameras based on the Intel IPU3. It
takes the sensor name as an argument and isn't meant to depend on a
particular platform.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2018-11-29 14:45:12 +02:00
Laurent Pinchart
23ac77dc4a utils: ipu3: Add IPU3 raw capture unpack utility
The IPU3 captures Bayer data in a 25-pixels-in-32-bytes packed format,
which no standard tool can process. Add a quick implementation of data
unpacking to turn raw binary files into 16 bits per pixel unpacked Bayer
data.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2018-11-20 03:06:41 +02:00