From patchwork Thu Jun 30 10:16:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 16452 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 70610BE173 for ; Thu, 30 Jun 2022 10:17:09 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4F99B65654; Thu, 30 Jun 2022 12:17:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656584228; bh=jLJmJyp1BuhktQk/QfbGplJz6qFqCEXCN3+sL6OJX6k=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=RwAEhY+npNUGoKkdlbwwlLzlJnwQWkO0R23sWBhRhn1G0Pt1drtQjo1qiVaW7wZL5 WwpcqPQCunEByOxD2cFxrkfI/t8QhcL6ABrye6FAbaU+xM+cBbl0B8DCd6xciYxBYv oqzlk/fVvggUP3DwCW5Nh9Y7efwvl3yeFSyUUb7XilUmJyvbyqUMOe140ZgLr5M5dn jpCjZ5iJhjapCtfYlU5MfSUHkCrnQKMO5IZqydVXUMldnAig3xlY0r6NDgYuvF+ZD+ 3axEqWTCuzKE6xSs7kw24/MEr1ZV0rwj6GSyYpb3lkUefaLwXxQ9I5Hg9MjgS6j4VR xv7haLahca1xw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D381965633 for ; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="mOnTLy7H"; dkim-atps=neutral Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:4fb3:9c17:e136:8792]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6565D59D; Thu, 30 Jun 2022 12:17:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1656584226; bh=jLJmJyp1BuhktQk/QfbGplJz6qFqCEXCN3+sL6OJX6k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mOnTLy7Hvrk3T6ahsfKgmqFxdFkFowV5N8Gf8XKDshyQaW2RukDxnB3ZAm1fxKf48 c6w1VgVSxSz41wMeXMay3JJrOckSBiG5RCcU+RgYAN0uzl65txg/W21Uak6evGVzYM TsdZnVStYouI8w8Hp5GbNmxWYaUpyql/yDynDe/Q= To: libcamera-devel@lists.libcamera.org Date: Thu, 30 Jun 2022 12:16:58 +0200 Message-Id: <20220630101702.45781-2-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220630101702.45781-1-jeanmichel.hautbois@ideasonboard.com> References: <20220630101702.45781-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 1/5] utils: ipu3: Introduce a parameters dump tool X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jean-Michel Hautbois via libcamera-devel From: Jean-Michel Hautbois Reply-To: Jean-Michel Hautbois Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- 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 diff --git a/utils/ipu3/ipu3-dump-params.c b/utils/ipu3/ipu3-dump-params.c new file mode 100644 index 00000000..9bd61593 --- /dev/null +++ b/utils/ipu3/ipu3-dump-params.c @@ -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 + */ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +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; +} diff --git a/utils/ipu3/meson.build b/utils/ipu3/meson.build index 88049f58..b2d5577e 100644 --- a/utils/ipu3/meson.build +++ b/utils/ipu3/meson.build @@ -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)