From patchwork Wed Oct 2 16:19:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21472 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 291FBBD80A for ; Wed, 2 Oct 2024 16:20:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id A951E63527; Wed, 2 Oct 2024 18:20:13 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="UNBJsP4j"; 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 529966351F for ; Wed, 2 Oct 2024 18:20:12 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7293BFEF; Wed, 2 Oct 2024 18:18:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885919; bh=RxTwztA94Dg1TkGcOxHsM32CTWg2bPvgRPc88Cq3W3w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UNBJsP4jtTBLJQeAQugPHceXfufOhzLWSh50edjDUVV6CM9OOtkrPotZX0Tr4QW3u kS7F7VCB7Uh2cqq+9/gLB2kS4Z+AERsr4RItsa4hGKxhIixW8lkUqXEPiuumI//OKp HgRB6owSve8Gqmns93PHIGUdYphGfJnRxG9SOlwc= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 1/8] libcamera: Add debug control space Date: Wed, 2 Oct 2024 18:19:19 +0200 Message-ID: <20241002161933.247091-2-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" Add a new 'debug' controls namespace for the upcoming implementation of debug metadata. Signed-off-by: Stefan Klug Reviewed-by: Laurent Pinchart --- include/libcamera/meson.build | 3 ++- src/libcamera/control_ids_debug.yaml | 11 +++++++++++ src/libcamera/control_ranges.yaml | 5 ++++- 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 src/libcamera/control_ids_debug.yaml diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index a969a95dbf7a..152806988479 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -36,6 +36,7 @@ controls_map = { 'controls': { 'draft': 'control_ids_draft.yaml', 'core': 'control_ids_core.yaml', + 'debug': 'control_ids_debug.yaml', 'rpi/vc4': 'control_ids_rpi.yaml', }, @@ -55,7 +56,7 @@ foreach mode, entry : controls_map files_list = [] input_files = [] foreach vendor, header : entry - if vendor != 'core' and vendor != 'draft' + if vendor not in ['core', 'draft', 'debug'] if vendor not in pipelines continue endif diff --git a/src/libcamera/control_ids_debug.yaml b/src/libcamera/control_ids_debug.yaml new file mode 100644 index 000000000000..11ddfd7cc8d8 --- /dev/null +++ b/src/libcamera/control_ids_debug.yaml @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Copyright (C) 2024, Ideas on Board Oy +# +%YAML 1.1 +--- +# Unless otherwise stated, all controls are bi-directional, i.e. they can be +# set through Request::controls() and returned out through Request::metadata(). +vendor: debug +controls: + diff --git a/src/libcamera/control_ranges.yaml b/src/libcamera/control_ranges.yaml index d42447d04647..b89a517a64cd 100644 --- a/src/libcamera/control_ranges.yaml +++ b/src/libcamera/control_ranges.yaml @@ -13,6 +13,9 @@ ranges: draft: 10000 # Raspberry Pi vendor controls rpi: 20000 - # Next range starts at 30000 + # Development controls + debug: 30000 + # Next range starts at 40000 + ... From patchwork Wed Oct 2 16:19:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21473 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 1AEF2BD80A for ; Wed, 2 Oct 2024 16:20:19 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B485363527; Wed, 2 Oct 2024 18:20:18 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="CfQxDIek"; 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 EB1A663522 for ; Wed, 2 Oct 2024 18:20:16 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5FC661011; Wed, 2 Oct 2024 18:18:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885924; bh=y3BgbDK0QT8E2RlKsd2t4gyUlEbvDDc5/P43dhofsNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CfQxDIekzXp3wtqlACvenAiC9LE5b27ZCAY0jiRqKRrCfFaAmWCfxo7gqgQseI0Lv KbPq/6B4vaOdz9nzyB18lzCvSAfnUD9ccr4dPfoXEJnjOGFtrFRfgd01XWZbYzRKpT MrWVEvYJ3XtEpLolDsE/Z7BpXS9YsZxQOQXZVg+c= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 2/8] libcamera: Add a DebugMetadata helper Date: Wed, 2 Oct 2024 18:19:20 +0200 Message-ID: <20241002161933.247091-3-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" Debug metadata often occurs in places where the metadata control list is not available e.g. in queueRequest() or processStatsBuffer() or even in a class far away from the metadata handling code. It is therefore difficult to add debug metadata without adding lot's of boilerplate code. This can be mitigated by recording the metadata and forwarding it to an upstream helper or the metadata control list when they become available. Add such a helper. Signed-off-by: Stefan Klug --- include/libcamera/internal/debug_controls.h | 52 +++++++ include/libcamera/internal/meson.build | 1 + src/libcamera/control_ids_core.yaml | 6 + src/libcamera/debug_controls.cpp | 144 ++++++++++++++++++++ src/libcamera/meson.build | 1 + 5 files changed, 204 insertions(+) create mode 100644 include/libcamera/internal/debug_controls.h create mode 100644 src/libcamera/debug_controls.cpp diff --git a/include/libcamera/internal/debug_controls.h b/include/libcamera/internal/debug_controls.h new file mode 100644 index 000000000000..d95c03e1db1f --- /dev/null +++ b/include/libcamera/internal/debug_controls.h @@ -0,0 +1,52 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2024, Ideas on Board Oy + * + * Debug metadata helpers + */ + +#pragma once + +#include + +namespace libcamera { + +class DebugMetadata +{ +public: + DebugMetadata() = default; + + void checkForEnable(const ControlList &controls); + void enable(bool enable = true); + void assignUpstream(DebugMetadata *upstream); + void assignControlList(ControlList *list); + + template + void set(const Control &ctrl, const V &value) + { + if (upstream_) { + upstream_->set(ctrl, value); + return; + } + + if (!enabled_) + return; + + if (list_) { + list_->set(ctrl, value); + return; + } + + cache_.set(ctrl, value); + } + + void set(unsigned int id, const ControlValue &value); + +private: + bool enabled_ = false; + ControlList *list_ = nullptr; + DebugMetadata *upstream_ = nullptr; + ControlList cache_; +}; + +} /* namespace libcamera */ diff --git a/include/libcamera/internal/meson.build b/include/libcamera/internal/meson.build index 1c5eef9cab80..1dddcd50c90b 100644 --- a/include/libcamera/internal/meson.build +++ b/include/libcamera/internal/meson.build @@ -14,6 +14,7 @@ libcamera_internal_headers = files([ 'control_serializer.h', 'control_validator.h', 'converter.h', + 'debug_controls.h', 'delayed_controls.h', 'device_enumerator.h', 'device_enumerator_sysfs.h', diff --git a/src/libcamera/control_ids_core.yaml b/src/libcamera/control_ids_core.yaml index 1b1bd9507d25..103bcb593c4a 100644 --- a/src/libcamera/control_ids_core.yaml +++ b/src/libcamera/control_ids_core.yaml @@ -967,5 +967,11 @@ controls: The default gamma value must be 2.2 which closely mimics sRGB gamma. Note that this is camera gamma, so it is applied as 1.0/gamma. + + - DebugMetadataEnable: + type: bool + description: | + Enable or disable the debug metadata. + ... diff --git a/src/libcamera/debug_controls.cpp b/src/libcamera/debug_controls.cpp new file mode 100644 index 000000000000..11a92a6b5871 --- /dev/null +++ b/src/libcamera/debug_controls.cpp @@ -0,0 +1,144 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2024, Ideas on Board Oy. + * + * Helper to easily record debug metadata inside libcamera. + */ + +#include "libcamera/internal/debug_controls.h" + +namespace libcamera { + +/** + * \file debug_controls.h + * \brief Helper to easily record debug metadata inside libcamera + */ + +/** + * \class DebugMetadata + * \brief Helper to record metadata for later use + * + * When one wants to record debug metadata, the metadata list is often not + * directly available (either because we are inside process() of an IPA or + * because we are in a closed module). This class allows to record the data and + * at a later point in time forward it either to another DebugMetadata instance + * or to a ControlList. + */ + +/** + * \fn DebugMetadata::checkForEnable + * \brief Check for DebugMetadataEnable in the supplied ControlList + * \param[in] controls The supplied ControlList + * + * Looks for controls::DebugMetadataEnable and enables or disables debug + * metadata handling accordingly. + */ +void DebugMetadata::checkForEnable(const ControlList &controls) +{ + const auto &ctrl = controls.get(controls::DebugMetadataEnable); + if (ctrl) + enable(*ctrl); +} + +/** + * \fn DebugMetadata::enable + * \brief Enables or disabled metadata handling + * \param[in] enable The enable state + * + * Enables or disables metadata handling according to \a enable. When enable is + * false, the cache gets cleared and no further metadata is recorded. + */ +void DebugMetadata::enable(bool enable) +{ + enabled_ = enable; + if (!enabled_) + cache_.clear(); +} + +/** + * \fn DebugMetadata::assignUpstream + * \brief Assign an upstream metadata handler + * \param[in] upstream Pointer to the upstream handler + * + * When a upstream gets set, the cache is copies to that list and all further + * calls to DebugMetadata::set are forwarded to that list. + * + * The upstream can be reset by passing a nullptr. + */ +void DebugMetadata::assignUpstream(DebugMetadata *upstream) +{ + upstream_ = upstream; + + if (!upstream_) + return; + + for (const auto &ctrl : cache_) + upstream_->set(ctrl.first, ctrl.second); + + cache_.clear(); +} + +/** + * \fn DebugMetadata::assignControlList + * \brief Assign a control list + * \param[in] list Pointer to the list + * + * When a list gets set, the cache is copies to that list and all further calls + * to DebugMetadata::set are forwarded to that list. + * + * The upstream can be reset by passing a nullptr. + */ +void DebugMetadata::assignControlList(ControlList *list) +{ + list_ = list; + + if (list_) { + list_->merge(cache_); + cache_.clear(); + } +} + +/** + * \fn DebugMetadata::set(const Control &ctrl, const V &value) + * \brief Set a value + * \param[in] ctrl The ctrl to set + * \param[in] value The control value + * + * Sets the debug metadata for ctrl to value \a value. If an upstream or a + * control list is set, the value gets passed there (upstream takes precedence). + * Otherwise the value is cached until one of them gets assigned. + * + * When the instance is disabled and upstream is not set, the value gets dropped. + */ + +/** + * \fn DebugMetadata::set(unsigned int id, const ControlValue &value) + * \brief Set a value + * \param[in] id The id of the control + * \param[in] value The control value + * + * Sets the debug metadata to value \a value. If an upstream or a control list + * is set, the value gets passed there (upstream takes precedence). + * Otherwise the value is cached until one of them gets assigned. + * + * When the instance is disabled and upstream is not set, the value gets dropped. + */ +void DebugMetadata::set(unsigned int id, const ControlValue &value) +{ + if (upstream_) { + upstream_->set(id, value); + return; + } + + if (!enabled_) + return; + + if (list_) { + list_->set(id, value); + return; + } + + cache_.set(id, value); +} + +} /* namespace libcamera */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index aa9ab0291854..f7b5ee8dcc34 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -25,6 +25,7 @@ libcamera_internal_sources = files([ 'control_validator.cpp', 'converter.cpp', 'delayed_controls.cpp', + 'debug_controls.cpp', 'device_enumerator.cpp', 'device_enumerator_sysfs.cpp', 'dma_buf_allocator.cpp', From patchwork Wed Oct 2 16:19:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21474 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 4ADA6BD80A for ; Wed, 2 Oct 2024 16:20:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DED5C63522; Wed, 2 Oct 2024 18:20:21 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="p6JsRqk0"; 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 801DE63522 for ; Wed, 2 Oct 2024 18:20:20 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 87EF510D8; Wed, 2 Oct 2024 18:18:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885927; bh=h5CKhhbUcXkFYXZAwzQvEqeLYChhaFYFrU/ITQRA9TE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p6JsRqk0vjLJLsDm0VLQf6CEqSV4mJDb3IhU+qik0KGnkNhHcPTWobGWiUtTnJ+I9 ROc/8zOcDwYTpKG6APQ46bC+eyXW6laHZbYqQT6Lwk1uxhOHUTc1xso/VZKavibQCI cXrv7zMOM/EyYmbNLXN1bcPk5fKa+yLEByq5YMd8= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 3/8] utils: Add script to generate control_ids_debug.yaml Date: Wed, 2 Oct 2024 18:19:21 +0200 Message-ID: <20241002161933.247091-4-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" For flexible debugging it is helpful to minimize the roundtrip time. This scipts parses the sourcetree and loos for usages of set(controls::debug::Something, ...) and adds (or removes) the controls as necessary from the yaml description. Signed-off-by: Stefan Klug --- utils/gen-debug-controls.py | 161 ++++++++++++++++++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100755 utils/gen-debug-controls.py diff --git a/utils/gen-debug-controls.py b/utils/gen-debug-controls.py new file mode 100755 index 000000000000..6cb087e1e0ae --- /dev/null +++ b/utils/gen-debug-controls.py @@ -0,0 +1,161 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (C) 2024, Ideas on Board Inc. +# +# Author: Stefan Klug +# +# This script looks for occurrences of the debug metadata controls in the source +# tree and updates src/libcamera/control_ids_debug.yaml accordingly + +import argparse +import logging +import os +import re +import sys +from dataclasses import dataclass +from pathlib import Path + +logger = logging.getLogger(__name__) +logging.basicConfig(level=logging.INFO, format='%(levelname)s: %(message)s') + +try: + import ruyaml +except: + logger.error( + f'Failed to import ruyaml. Please install the ruyaml package.') + sys.exit(1) + + +@dataclass +class FoundMatch: + file: os.PathLike + whole_match: str + line: int + type: str + name: str + size: str = None + + +def get_control_name(control): + k = list(control.keys()) + if len(k) != 1: + raise Exception(f"Can't handle control entry with {len(k)} keys") + return k[0] + + +def find_debug_controls(dir): + extensions = ['.cpp', '.h'] + files = [p for p in dir.rglob('*') if p.suffix in extensions] + + # The following regex was tested on + # set>( controls::debug::something , static_cast(var) ) + # set<>( controls::debug::something , static_cast(var) ) + # set( controls::debug::something , static_cast (var) ) + exp = re.compile(r'set' # set function + # possibly followed by template param + r'(?:\<((?:[^)(])*)\>)?' + # referencing a debug control + r'\(\s*controls::debug::(\w+)\s*,.*\)' + ) + matches = [] + for p in files: + with p.open('r') as f: + for idx, line in enumerate(f): + match = exp.search(line) + if match: + m = FoundMatch(file=p, line=idx, type=match.group(1), + name=match.group(2), whole_match=match.group(0)) + if m.type is not None and m.type.startswith('Span'): + # simple span type detection treating the last word inside <> as type + r = re.match(r'Span<(?:.*\s+)(.*)>', m.type) + m.type = r.group(1) + m.size = '[n]' + matches.append(m) + return matches + + +def main(argv): + parser = argparse.ArgumentParser( + description='Automatically updates control_ids_debug.yaml',) + args = parser.parse_args(argv[1:]) + + yaml = ruyaml.YAML() + root_dir = Path(__file__).resolve().parent.parent + output = root_dir.joinpath('src/libcamera/control_ids_debug.yaml') + + matches = find_debug_controls(root_dir.joinpath('src')) + + doc = yaml.load(output) + + controls = doc['controls'] + + # create a map of names in the existing yaml for easier updating + controls_map = {} + for control in controls: + for k, v in control.items(): + controls_map[k] = v + + obsolete_names = list(controls_map.keys()) + + for m in matches: + if not m.type: + p = m.file.relative_to(Path.cwd(), walk_up=True) + logger.warning( + f'{p}:{m.line + 1}: Failed to deduce type from {m.whole_match} ... skipping') + continue + + p = m.file.relative_to(root_dir) + desc = {'type': m.type, + 'description': f'Debug control {m.name} found in {p}:{m.line}'} + if m.size is not None: + desc['size'] = m.size + + if m.name in controls_map: + # Can't use == for modified check because of the special yaml dicts. + update_needed = False + if list(controls_map[m.name].keys()) != list(desc.keys()): + update_needed = True + else: + for k, v in controls_map[m.name].items(): + if v != desc[k]: + update_needed = True + break + + if update_needed: + logger.info(f"Update control '{m.name}'") + controls_map[m.name].clear() + controls_map[m.name].update(desc) + + obsolete_names.remove(m.name) + else: + logger.info(f"Add control '{m.name}'") + insert_before = len(controls) + for idx, control in enumerate(controls): + if get_control_name(control).lower() > m.name.lower(): + insert_before = idx + break + controls.insert(insert_before, {m.name: desc}) + + # Remove elements from controls without recreating the list (to keep comments etc.) + idx = 0 + while idx < len(controls): + name = get_control_name(controls[idx]) + if name in obsolete_names: + logger.info(f"Remove control '{name}'") + controls.pop(idx) + else: + idx += 1 + + with output.open('w') as f: + # ruyaml looses the copyright header + f.write(("# SPDX-License-Identifier: LGPL-2.1-or-later\n" + "#\n" + "# Copyright (C) 2024, Ideas on Board Oy\n" + "#\n")) + yaml.dump(doc, f) + + return 0 + + +if __name__ == '__main__': + sys.exit(main(sys.argv)) From patchwork Wed Oct 2 16:19:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21475 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 E6644BD80A for ; Wed, 2 Oct 2024 16:20:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9F50F6352B; Wed, 2 Oct 2024 18:20:26 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="r+4KQYTj"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A69E663522 for ; Wed, 2 Oct 2024 18:20:24 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 775A91733; Wed, 2 Oct 2024 18:18:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885931; bh=xIKPhe6pTzRSzYnP19lvuQkJF2DFFtRQ4Nu3W63dRLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r+4KQYTjigqtOwRt16XQQ/b9HKwLx/dvEGnQxQkbLeQau0iy44s4k1eRY2DaF7Mda FDDs14psU/v4pf3kDGZofXcNvuMWW3Vs7No1nCes8rKGiOSPNi/4qwRqJbeH5DZwFD vTLIIWeOjNsjX0yPYNOp66AV1Zzh9Fepli3i2RCI= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 4/8] ipa: rkisp1: Add constructor to the ipa context Date: Wed, 2 Oct 2024 18:19:22 +0200 Message-ID: <20241002161933.247091-5-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" Initialization using the initializer list is cumbersome and requires modifications to the list whenever the context is modified. Fix that by adding a proper constructor to the context. Signed-off-by: Stefan Klug Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/ipa/rkisp1/ipa_context.h | 5 +++++ src/ipa/rkisp1/rkisp1.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index e274d9b01e1c..d52e73ad2503 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -180,6 +180,11 @@ struct IPAFrameContext : public FrameContext { }; struct IPAContext { + IPAContext(unsigned int frameContextSize) + : hw(nullptr), frameContexts(frameContextSize) + { + } + const IPAHwSettings *hw; IPACameraSensorInfo sensorInfo; IPASessionConfiguration configuration; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 9e161cabdea4..a579f21de56f 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -124,7 +124,7 @@ const ControlInfoMap::Map rkisp1Controls{ } /* namespace */ IPARkISP1::IPARkISP1() - : context_({ {}, {}, {}, {}, { kMaxFrameContexts }, {}, {} }) + : context_(kMaxFrameContexts) { } From patchwork Wed Oct 2 16:19:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21476 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 14A37BD80A for ; Wed, 2 Oct 2024 16:20:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B5F756352B; Wed, 2 Oct 2024 18:20:29 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="A/jAcXU1"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E49D63522 for ; Wed, 2 Oct 2024 18:20:28 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 958AF1961; Wed, 2 Oct 2024 18:18:55 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885935; bh=CssnFubvUamdyis/BcEWB10C/94940YtvnUa9bm7OMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A/jAcXU1XNzznEJqrjEcX36oAlHAzXnByQMynpUdagu9mKkScGXfHkIbS2gVjSgni xextvyaXIVco2cQCHG4TAnCy1h99cccSj9lmxA9ikUidSr5XQ50kpyPigEkyD+qtnA 3kD6WtmCviO5YxLgpDx8pLGTmgb1585LlOqNM/rQ= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 5/8] ipa: rkisp1: Add debug metadata support to the rkisp1 Date: Wed, 2 Oct 2024 18:19:23 +0200 Message-ID: <20241002161933.247091-6-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" Add a DebugMetadata helper to the context and add the corresponding plumbing. This is all that is needed to support debug metadata in an IPA. Signed-off-by: Stefan Klug --- src/ipa/rkisp1/ipa_context.h | 5 +++++ src/ipa/rkisp1/rkisp1.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/ipa/rkisp1/ipa_context.h b/src/ipa/rkisp1/ipa_context.h index d52e73ad2503..7b93a9e9461d 100644 --- a/src/ipa/rkisp1/ipa_context.h +++ b/src/ipa/rkisp1/ipa_context.h @@ -17,8 +17,11 @@ #include #include #include + #include +#include "libcamera/internal/debug_controls.h" + #include #include #include @@ -194,6 +197,8 @@ struct IPAContext { ControlInfoMap::Map ctrlMap; + DebugMetadata debugMetadata; + /* Interface to the Camera Helper */ std::unique_ptr camHelper; }; diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index a579f21de56f..5b1ef0c372c6 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -117,6 +117,7 @@ const IPAHwSettings ipaHwSettingsV12{ const ControlInfoMap::Map rkisp1Controls{ { &controls::AwbEnable, ControlInfo(false, true) }, { &controls::ColourGains, ControlInfo(0.0f, 3.996f, 1.0f) }, + { &controls::DebugMetadataEnable, ControlInfo(false, true, false) }, { &controls::Sharpness, ControlInfo(0.0f, 10.0f, 1.0f) }, { &controls::draft::NoiseReductionMode, ControlInfo(controls::draft::NoiseReductionModeValues) }, }; @@ -326,6 +327,7 @@ void IPARkISP1::unmapBuffers(const std::vector &ids) void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls) { IPAFrameContext &frameContext = context_.frameContexts.alloc(frame); + context_.debugMetadata.checkForEnable(controls); for (auto const &a : algorithms()) { Algorithm *algo = static_cast(a.get()); @@ -368,6 +370,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId context_.camHelper->gain(sensorControls.get(V4L2_CID_ANALOGUE_GAIN).get()); ControlList metadata(controls::controls); + context_.debugMetadata.assignControlList(&metadata); for (auto const &a : algorithms()) { Algorithm *algo = static_cast(a.get()); @@ -377,6 +380,7 @@ void IPARkISP1::processStatsBuffer(const uint32_t frame, const uint32_t bufferId } setControls(frame); + context_.debugMetadata.assignControlList(nullptr); metadataReady.emit(frame, metadata); } From patchwork Wed Oct 2 16:19:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21477 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 D8417BD80A for ; Wed, 2 Oct 2024 16:20:34 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7C04A6352A; Wed, 2 Oct 2024 18:20:34 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="AfamQfPx"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 2DAE56352A for ; Wed, 2 Oct 2024 18:20:32 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id F01391BC7; Wed, 2 Oct 2024 18:18:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885939; bh=eKtLY3QBGZK4eCYQ44bf5E8qhoHSYhXKt5FgzFB8w7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AfamQfPxA+ENuKL72SD3QotHcCIiAy2JWMJwIn8i4RIFH9giJf152E7DLOCoXrP2y PkkLPTcsXvhls8tGPQzAM7wNiTh6XYzVTc5mbHzvipXWacr42sRcH57U3EMAD+6HX3 7/xLfh8lwmKEc6A7ovcln78mo67p+grsK5tIE6xs= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 6/8] ipa: libipa: Add data accessor to Histogram Date: Wed, 2 Oct 2024 18:19:24 +0200 Message-ID: <20241002161933.247091-7-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" For debugging purposes it is helpful to access the internal data of the histogram. Add an accessor for that. Signed-off-by: Stefan Klug Reviewed-by: Laurent Pinchart --- src/ipa/libipa/histogram.cpp | 6 ++++++ src/ipa/libipa/histogram.h | 1 + 2 files changed, 7 insertions(+) diff --git a/src/ipa/libipa/histogram.cpp b/src/ipa/libipa/histogram.cpp index 5fbfadf5e4e1..10e44b54a0cf 100644 --- a/src/ipa/libipa/histogram.cpp +++ b/src/ipa/libipa/histogram.cpp @@ -62,6 +62,12 @@ Histogram::Histogram(Span data) * \return Number of bins */ +/** + * \fn Histogram::data() + * \brief Retrieve the internal data + * \return The data + */ + /** * \fn Histogram::total() * \brief Retrieve the total number of values in the data set diff --git a/src/ipa/libipa/histogram.h b/src/ipa/libipa/histogram.h index 6fd641683694..91ce05f17d9f 100644 --- a/src/ipa/libipa/histogram.h +++ b/src/ipa/libipa/histogram.h @@ -36,6 +36,7 @@ public: } size_t bins() const { return cumulative_.size() - 1; } + const std::vector &data() const { return cumulative_; } uint64_t total() const { return cumulative_[cumulative_.size() - 1]; } uint64_t cumulativeFrequency(double bin) const; double quantile(double q, uint32_t first = 0, uint32_t last = UINT_MAX) const; From patchwork Wed Oct 2 16:19:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21478 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 978F3BD80A for ; Wed, 2 Oct 2024 16:20:38 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4CDD36352A; Wed, 2 Oct 2024 18:20:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="JRKcnTTP"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 4F3486352F for ; Wed, 2 Oct 2024 18:20:36 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 569093098; Wed, 2 Oct 2024 18:19:03 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885943; bh=iUsHsXLqGVAZ7tiP76+J/RvkInfoITXfi1DDTtx72YA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JRKcnTTP06dd+D9YpP/g8pQ9O2CgcJTLu8IuxdOdGY4xsOpGFkwyirTfG+CdXZ8DG EWbAjLWJbPnu9SyHt4u9EslV44N5IlknM3djYEjS9g9abLC+aHTzOCPdSx49Ix8S0p QHW0HZeK6WJyR5qjmOmTfDydn3Puuva3ko4y7vz4= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 7/8] [WIP] ipa: Add debug controls to the agc algorithm Date: Wed, 2 Oct 2024 18:19:25 +0200 Message-ID: <20241002161933.247091-8-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" Add a few (arbitrary) debug metadata to the agc algorithm. This shows how easy it is to add debug metadata to an ipa even for classes that don't have direct access to the metadata list or the context like AgcMeanLuminance. The control_ids_debug.yaml was autogenerated by calling utils/gen-debug-controls.py Signed-off-by: Stefan Klug --- src/ipa/libipa/agc_mean_luminance.cpp | 8 ++++++++ src/ipa/libipa/agc_mean_luminance.h | 4 ++++ src/ipa/rkisp1/algorithms/agc.cpp | 8 ++++++++ src/libcamera/control_ids_debug.yaml | 17 ++++++++++++++++- 4 files changed, 36 insertions(+), 1 deletion(-) diff --git a/src/ipa/libipa/agc_mean_luminance.cpp b/src/ipa/libipa/agc_mean_luminance.cpp index f97ef11771c4..bd0f85afcd2e 100644 --- a/src/ipa/libipa/agc_mean_luminance.cpp +++ b/src/ipa/libipa/agc_mean_luminance.cpp @@ -133,6 +133,11 @@ static constexpr double kDefaultRelativeLuminanceTarget = 0.16; * values. */ +/** + * \var AgcMeanLuminance::debugMeta_ + * \brief DebugMetadata helper + */ + AgcMeanLuminance::AgcMeanLuminance() : frameCount_(0), filteredExposure_(0s), relativeLuminanceTarget_(0) { @@ -541,8 +546,11 @@ AgcMeanLuminance::calculateNewEv(uint32_t constraintModeIndex, exposureModeHelpers_.at(exposureModeIndex); double gain = estimateInitialGain(); + debugMeta_.set(controls::debug::AgcInitialGain, static_cast(gain)); gain = constraintClampGain(constraintModeIndex, yHist, gain); + debugMeta_.set(controls::debug::AgcNewGain, static_cast(gain)); + /* * We don't check whether we're already close to the target, because * even if the effective exposure value is the same as the last frame's diff --git a/src/ipa/libipa/agc_mean_luminance.h b/src/ipa/libipa/agc_mean_luminance.h index 576d28be8eb0..428465a11a36 100644 --- a/src/ipa/libipa/agc_mean_luminance.h +++ b/src/ipa/libipa/agc_mean_luminance.h @@ -16,6 +16,7 @@ #include +#include "libcamera/internal/debug_controls.h" #include "libcamera/internal/yaml_parser.h" #include "exposure_mode_helper.h" @@ -71,6 +72,9 @@ public: frameCount_ = 0; } +protected: + DebugMetadata debugMeta_; + private: virtual double estimateLuminance(const double gain) const = 0; diff --git a/src/ipa/rkisp1/algorithms/agc.cpp b/src/ipa/rkisp1/algorithms/agc.cpp index 17d074d9c03e..2dcee0ceaccf 100644 --- a/src/ipa/rkisp1/algorithms/agc.cpp +++ b/src/ipa/rkisp1/algorithms/agc.cpp @@ -139,6 +139,8 @@ int Agc::init(IPAContext &context, const YamlObject &tuningData) { int ret; + debugMeta_.assignUpstream(&context.debugMetadata); + ret = parseTuningData(tuningData); if (ret) return ret; @@ -444,6 +446,12 @@ void Agc::process(IPAContext &context, [[maybe_unused]] const uint32_t frame, frameContext.agc.exposureMode, hist, effectiveExposureValue); + debugMeta_.set(controls::debug::AgcAnalogGain, aGain); + debugMeta_.set(controls::debug::AgcDigitalGain, dGain); + + const auto &data = hist.data(); + debugMeta_.set>(controls::debug::AgcHistogram, Span(reinterpret_cast(&data[0]), data.size())); + LOG(RkISP1Agc, Debug) << "Divided up shutter, analogue gain and digital gain are " << shutterTime << ", " << aGain << " and " << dGain; diff --git a/src/libcamera/control_ids_debug.yaml b/src/libcamera/control_ids_debug.yaml index 11ddfd7cc8d8..d1da5cca2364 100644 --- a/src/libcamera/control_ids_debug.yaml +++ b/src/libcamera/control_ids_debug.yaml @@ -8,4 +8,19 @@ # set through Request::controls() and returned out through Request::metadata(). vendor: debug controls: - +- AgcAnalogGain: + type: float + description: Debug control AgcAnalogGain found in src/ipa/rkisp1/algorithms/agc.cpp:448 +- AgcDigitalGain: + type: float + description: Debug control AgcDigitalGain found in src/ipa/rkisp1/algorithms/agc.cpp:449 +- AgcHistogram: + type: int64_t + description: Debug control AgcHistogram found in src/ipa/rkisp1/algorithms/agc.cpp:452 + size: '[n]' +- AgcInitialGain: + type: float + description: Debug control AgcInitialGain found in src/ipa/libipa/agc_mean_luminance.cpp:543 +- AgcNewGain: + type: float + description: Debug control AgcNewGain found in src/ipa/libipa/agc_mean_luminance.cpp:546 From patchwork Wed Oct 2 16:19:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 21479 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 49039BD80A for ; Wed, 2 Oct 2024 16:20:42 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0A4A363532; Wed, 2 Oct 2024 18:20:42 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="kSp4vuln"; 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 A48916352F for ; Wed, 2 Oct 2024 18:20:40 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b246:b33f:c662:8ae1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A4F42320D; Wed, 2 Oct 2024 18:19:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1727885947; bh=KGv6J3Mw1x+xm5eUkpBW6wbhUyCGGCzzrLzCj7zFk9Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kSp4vulnGx8bBcQGjzT0vl9JI0p7lBOI9C9RYURTil2Bi96lY/CBChugribxxgmC4 CNNEPmpCvQxBQTylD/oUhXHec+EGQjV0e25h59RBGuQxMXwhrtS24EMs108Inv1X05 QfUYWhNT8+Bz3TiMK/xHVqXqumqCPG3HbuH4oNac= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v1 8/8] [WIP] ipa: enable debug metadata by default Date: Wed, 2 Oct 2024 18:19:26 +0200 Message-ID: <20241002161933.247091-9-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241002161933.247091-1-stefan.klug@ideasonboard.com> References: <20241002161933.247091-1-stefan.klug@ideasonboard.com> 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" Camshark currently doesn't support metadata values that are not there on every frame. Enable the debug metadata by default to test this series. Signed-off-by: Stefan Klug --- src/ipa/rkisp1/rkisp1.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ipa/rkisp1/rkisp1.cpp b/src/ipa/rkisp1/rkisp1.cpp index 5b1ef0c372c6..fc95f733a2e8 100644 --- a/src/ipa/rkisp1/rkisp1.cpp +++ b/src/ipa/rkisp1/rkisp1.cpp @@ -328,6 +328,11 @@ void IPARkISP1::queueRequest(const uint32_t frame, const ControlList &controls) { IPAFrameContext &frameContext = context_.frameContexts.alloc(frame); context_.debugMetadata.checkForEnable(controls); + /* + * Todo: Remove the unconditional enable as soon as camshark supports + * metadata that is not available on every frame + */ + context_.debugMetadata.enable(); for (auto const &a : algorithms()) { Algorithm *algo = static_cast(a.get());