new file mode 100644
@@ -0,0 +1,74 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/*
+ * ipu3-dump-params - Display IPU3 parameters buffer from a binary dump
+ *
+ * Copyright 2021 Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
+ */
+#define _GNU_SOURCE
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <linux/intel-ipu3.h>
+
+static void usage(const char *argv0)
+{
+ printf("Usage: %s input-file\n", basename(argv0));
+ printf("Display the IPU3 parameters buffer\n");
+}
+
+static void displayGrid(struct ipu3_uapi_grid_config *grid, const char *gridName)
+{
+ printf("Configured %s grid [%d,%d]x[%d,%d] starting at (%d, %d)\n",
+ gridName,
+ grid->width,
+ grid->block_width_log2,
+ grid->height,
+ grid->block_height_log2,
+ grid->x_start,
+ grid->y_start & ~IPU3_UAPI_GRID_Y_START_EN);
+
+ printf("Grid size is (%d x %d)\n",
+ grid->width << grid->block_width_log2,
+ grid->height << grid->block_height_log2);
+}
+
+int main(int argc, char *argv[])
+{
+ int in_fd;
+ int ret = 0;
+ struct ipu3_uapi_params params;
+
+ if (argc != 2) {
+ usage(argv[0]);
+ return 1;
+ }
+
+ in_fd = open(argv[1], O_RDONLY);
+ if (in_fd == -1) {
+ fprintf(stderr, "Failed to open input file '%s': %s\n",
+ argv[1], strerror(errno));
+ return 1;
+ }
+
+start:
+ ret = read(in_fd, ¶ms, sizeof(params));
+ if (ret == -1 && errno == EINTR)
+ goto start;
+
+ printf("Read parameters buffer of size %d\n", ret);
+
+ printf("\n**** AWB parameters ****\n");
+ displayGrid(¶ms.acc_param.awb.config.grid, "awb");
+ displayGrid(¶ms.acc_param.awb_fr.grid_cfg, "awb_fr");
+
+ close(in_fd);
+
+ return ret ? 1 : 0;
+}
@@ -1,3 +1,8 @@
# SPDX-License-Identifier: CC0-1.0
+includes = [
+ libcamera_includes,
+]
+
ipu3_unpack = executable('ipu3-unpack', 'ipu3-unpack.c')
+ipu3_dump_params = executable('ipu3-dump-params', 'ipu3-dump-params.c', include_directories : libcamera_includes)
The parameters buffer for IPU3 contains a lot of structures, and is not very easy to debug. This tool aims to ease the parsing of it, when it has been stored as a binary raw file. This commit introduces the parsing with the support of the AWB grid configuration. Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com> --- utils/ipu3/ipu3-dump-params.c | 74 +++++++++++++++++++++++++++++++++++ utils/ipu3/meson.build | 5 +++ 2 files changed, 79 insertions(+) create mode 100644 utils/ipu3/ipu3-dump-params.c