From patchwork Mon Oct 7 09:54:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21523 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 9F2AFBD80A for ; Mon, 7 Oct 2024 09:54:33 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 6D14863532; Mon, 7 Oct 2024 11:54:32 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jS4fqiJu"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id F364B63510 for ; Mon, 7 Oct 2024 11:54:30 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:ba12:1296:516b:1122]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E67D555; Mon, 7 Oct 2024 11:52:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1728294775; bh=PFb7UjsIPcbRIfPqYahLXw9Qwn7JL+ApfDQuWXDXCWI=; h=From:To:Cc:Subject:Date:From; b=jS4fqiJuKu9t5jD3HhsznXY0wWOj7i3A6KHCsEe8iAQnaqekj4i34jDA0xrZg/DOk saHNvwj4kQJO79IbenYET2oXz7mNWUD+GYqxdMzpA6zvKE/hpDmAgecaHQu7QqmEeX 2Wgk2Y/S5blQ5xi5+FkY21C6hYHfBKXFflpENrII= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 0/7] Add support for IPA debugging metadata Date: Mon, 7 Oct 2024 11:54:04 +0200 Message-ID: <20241007095425.211158-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 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 | 145 +++++++++++++++++ src/libcamera/meson.build | 1 + utils/gen-debug-controls.py | 165 ++++++++++++++++++++ 16 files changed, 437 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