From patchwork Tue Oct 8 15:29:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21538 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 7DBCBBE080 for ; Tue, 8 Oct 2024 15:30:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A5E57618CB; Tue, 8 Oct 2024 17:30:37 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ECQeQjEf"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 05C6B618C9 for ; Tue, 8 Oct 2024 17:30:35 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:d:f30b:aa60:fabf]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1B690514; Tue, 8 Oct 2024 17:28:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728401339; bh=tFa8J4NuFQZuFABSsonfJidWfXePAH9enJBZm8CY3T0=; h=From:To:Cc:Subject:Date:From; b=ECQeQjEfDj2Ux+0Aa0pj9BOYzqEyPs/I4exhnvTh4oMC2Q4U0JYXkCyRq3zC4p7p7 LoQ04JROR5ynRDvVbUzUFzu0T0sZVhvQDa8LzJZ1ixRAIVWjGBbQazOs/zyCKbMUI1 zN4knQHG0A5OqZL+LESxv/YphG+xEgh8Q4L2Nzek= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 0/7] Add support for IPA debugging metadata Date: Tue, 8 Oct 2024 17:29:38 +0200 Message-ID: <20241008153031.429906-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 Changes in v3: - Documentation improvements - Some naming fixes from review - CI fix build history Changes in v2: - Replaced the assignList functionality by moveEntries - Fixes from review (detailed changelogs in the patches) - Dropped patch 8 as it is not needed anymore Stefan Klug (7): 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 [DNI] ipa: Add debug controls to the agc algorithm include/libcamera/internal/debug_controls.h | 46 ++++++ include/libcamera/internal/meson.build | 1 + include/libcamera/meson.build | 5 +- 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 | 10 ++ src/ipa/rkisp1/ipa_context.h | 10 ++ src/ipa/rkisp1/rkisp1.cpp | 5 +- src/libcamera/control_ids_core.yaml | 5 + src/libcamera/control_ids_debug.yaml | 25 +++ src/libcamera/control_ranges.yaml | 4 +- src/libcamera/debug_controls.cpp | 164 ++++++++++++++++++++ src/libcamera/meson.build | 1 + utils/gen-debug-controls.py | 162 +++++++++++++++++++ 16 files changed, 453 insertions(+), 4 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