From patchwork Wed Oct 2 16:19:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21471 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 E64ACBD80A for ; Wed, 2 Oct 2024 16:20:08 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 32D7663525; Wed, 2 Oct 2024 18:20:07 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="hYsb/RXO"; dkim-atps=neutral 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 9404063510 for ; Wed, 2 Oct 2024 18:20:04 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 963573EA; Wed, 2 Oct 2024 18:18:31 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885911; bh=JLPIi/ZcdUPUZ7ExAvdMEkmPBTkVpD2dcttxv3Mz+jM=; h=From:To:Cc:Subject:Date:From; b=hYsb/RXOQlxcL9rpTCXQKpzEd25RKQPGIpGCSn+My91e37N/PefVsxEvpGuzEpP2x AF7cfb3S0HchvjmuFKVc2EtUv7HWNk0y8M0/CVJM8njnrTkuMyzbP0edZIKtHx/3z8 nRyygJ1BrBNcEgxDGHD1OExKy9Q6ZeE1MyZTtOBI= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 0/8] Add support for IPA debugging metadata Date: Wed, 2 Oct 2024 18:19:18 +0200 Message-ID: <20241002161933.247091-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" To easily debug the algorithms of a running IPA it is necessary to inspect live data. Three options where discussed on how to make that process easier: 1. Tracing using lttng: We already have a bit infrastructure for that. Nevertheless the setup is a bit more involved and there is no code available (yet) to digest the live data. Adding new tracepoints also requires modifications at multiple places. 2. Extending the metadata infrastructure: We already have good infrastructure for metadata handling. Tooling around libcamera (like camshark) already have good support for metadata. The downside of metadata might be the limited efficiency on the way from the ipa to the user involving (possibly) inefficient serializations and copies. 3. Adding a completely new infrastructure for debug metadata and seperate interfaces on the API. This series implements the tooling for option 2 (add debug metadata). Option 1 will also be investigated further, but seems to be better fitted to performance issues than to algorithmic issue. Option 3 was not investigated further due to the involved effort and the unclear needs on the overall process. Patches 1-3 add some infrastructure to make the process easier. Patches 4 and 6 are tiny fixups. Patch 5 adds debug metadata support to the rkisp1 IPA. Patch 7 adds actual debug entries to the agc algorithm in the rkisp1. The whole series works in companion with the new graph display in camhsark, that is available in the current master of camshark ( https://gitlab.freedesktop.org/camera/camshark ) Best regards, Stefan Stefan Klug (8): libcamera: Add debug control space libcamera: Add a DebugMetadata helper utils: Add script to generate control_ids_debug.yaml ipa: rkisp1: Add constructor to the ipa context ipa: rkisp1: Add debug metadata support to the rkisp1 ipa: libipa: Add data accessor to Histogram [WIP] ipa: Add debug controls to the agc algorithm [WIP] ipa: enable debug metadata by default include/libcamera/internal/debug_controls.h | 52 +++++++ include/libcamera/internal/meson.build | 1 + include/libcamera/meson.build | 3 +- src/ipa/libipa/agc_mean_luminance.cpp | 8 + src/ipa/libipa/agc_mean_luminance.h | 4 + src/ipa/libipa/histogram.cpp | 6 + src/ipa/libipa/histogram.h | 1 + src/ipa/rkisp1/algorithms/agc.cpp | 8 + src/ipa/rkisp1/ipa_context.h | 10 ++ src/ipa/rkisp1/rkisp1.cpp | 11 +- src/libcamera/control_ids_core.yaml | 6 + src/libcamera/control_ids_debug.yaml | 26 ++++ src/libcamera/control_ranges.yaml | 5 +- src/libcamera/debug_controls.cpp | 144 +++++++++++++++++ src/libcamera/meson.build | 1 + utils/gen-debug-controls.py | 161 ++++++++++++++++++++ 16 files changed, 444 insertions(+), 3 deletions(-) create mode 100644 include/libcamera/internal/debug_controls.h create mode 100644 src/libcamera/control_ids_debug.yaml create mode 100644 src/libcamera/debug_controls.cpp create mode 100755 utils/gen-debug-controls.py