From patchwork Tue Mar 19 12:05:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 19740 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 F41AABD160 for ; Tue, 19 Mar 2024 12:05:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8669D62CAA; Tue, 19 Mar 2024 13:05:29 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="MeMgt+QQ"; 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 8A20562973 for ; Tue, 19 Mar 2024 13:05:27 +0100 (CET) Received: from jasper.fritz.box (unknown [IPv6:2a00:6020:448c:6c00:1478:344b:8fcb:baf5]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A87AC480; Tue, 19 Mar 2024 13:05:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1710849900; bh=ybj8HVHuZT74963GJubgMqXGvoEgBMJXWhA8Whf/jgQ=; h=From:To:Cc:Subject:Date:From; b=MeMgt+QQIJYRIG+0YaGgoBPEiDrTL1VmxIvIyHA6hrSw8Dwp2hiwokKgjI506ZnPz vDeqSpllRwGubpdtDl/54sIthJLf/SKq671KvjWemt7rptAHr/HYYiynbMHJhLBeNB vaVe8eKL/ALSBOqkzPoAgwvS10BH1b2Qxd9NhNnQ= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 00/16] Preparation for per-frame-controls and initial tests Date: Tue, 19 Mar 2024 13:05:01 +0100 Message-Id: <20240319120517.362082-1-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.40.1 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" v1->v2: v1 errornously contained patch 08 two time and therefore didn't apply. v2->v3: - Fixed compile issues found in CI - Fixed style issues from reviews - Implemented most suggestions from reviews - Time sheet now uses unique_ptr - Time sheet uses lambdas for pixel access - Fixed unchecked access to vector in time sheet - Tests are now in a proper testsuite PerFrameControlTests - Replaced DelayedControls::pushForFrame() with overload for push(). I left the existing semantics (without sequence) in place for now, so that the tests can run on both impementations - Fixed another corner case in delayed controls and added a test for that (12/16) - Reworked the big delayed controls patch into smaller patches that are easier to digest (4/16 - 12/16) - Cover letter mostly unchanged Hi everyone, unknowingly I stumbled into a topic that is way larger than I thought in the beginning. Delayed-controls and a closely related topic per-frame-controls. I (now) know that a lot of work already went into this, noteably by Jacopo Mondi, David Plowman and Naushir Patuck: https://patchwork.libcamera.org/cover/16458/ https://github.com/raspberrypi/libcamera/tree/pfc Thanks for that! I started off without per-frame-controls in mind (only delayed-controls) and soon realized, that these two are closely related. (It's difficult to test delayed-controls in a real pipeline without working per-frame-controls) To be able to tackle the whole topic in the long run I'd like to split it into parts: 1. Get a initial set of tests on mainline I'd like to have them as a discussion basis and a reference to test against. These shouldn't be treated as mandatory for now (ideas on how to express that in code are very welcome) - Initial lc-compliance tests for delayed-controls (and because these are system tests also for per-frame-controls) - A reworked delayed controls class that hopefully makes things easier - Tested on rkisp1 2. Get an agreement on "RaspberryPi" mode In the previous work by David and Naushir, the (in my understanding) most prominent requiremnet was the ability to set a control ASAP even when multiple requests are queued already (which makes complete sense IMHO). This requirement shall not get lost and I think there is a way to make it work. 3. Get the tests to pass on rkisp1, rpi and ipu3 I guess this will take a while and involve different parties, so let's not wait until everything works everywhere... 4. Make the tests mandatory (details tbd) This series contains part 1. One change of thought is, that we add the ability to push requests to delayed controls for a given sequence number and to re-push for the same sequence number. This has the benefit, that we don't have to decide early on if we operate in strict per-frame-controls mode (sometimes called "android mode") or in "raspberry pi" mode. Stefan Klug (16): libcamera: lc-compliance: Add controls param to start() function libcamera: lc-compliance: Add TimeSheet class libcamera: lc-compliance: Add initial set of per-frame-control tests libcamera: delayed_controls: Update unit tests to expected semantics libcamera: delayed_controls: Rename class members libcamera: delayed_controls: Make listSize unsigned libcamera: delayed_controls: Add controlsAreQueued() helper libcamera: delayed_controls: Add ctrls list parameter to reset() function libcamera: delayed_controls: Add sourceSequence property libcamera: delayed_controls: Add fillValues() helper libcamera: delayed_controls: Rework delayed controls implementation libcamera: delayed_controls: Ignore delayed request, if there is a newer one pipeline: rkisp1: Move call to setSensorControls.emit() pipeline: rkisp1: Add more debug logging pipeline: rkisp1: Fix per-frame-controls in manual mode pipeline: rkisp1: Apply initial controls include/libcamera/internal/delayed_controls.h | 25 +- include/libcamera/ipa/rkisp1.mojom | 7 +- src/apps/lc-compliance/meson.build | 2 + .../lc-compliance/per_frame_controls_test.cpp | 398 ++++++++++++++++++ src/apps/lc-compliance/simple_capture.cpp | 4 +- src/apps/lc-compliance/simple_capture.h | 2 +- src/apps/lc-compliance/time_sheet.cpp | 148 +++++++ src/apps/lc-compliance/time_sheet.h | 62 +++ src/ipa/rkisp1/algorithms/agc.cpp | 4 +- src/ipa/rkisp1/rkisp1.cpp | 49 ++- src/libcamera/delayed_controls.cpp | 262 ++++++++++-- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 +- test/delayed_controls.cpp | 389 ++++++++++++++--- 13 files changed, 1239 insertions(+), 124 deletions(-) create mode 100644 src/apps/lc-compliance/per_frame_controls_test.cpp create mode 100644 src/apps/lc-compliance/time_sheet.cpp create mode 100644 src/apps/lc-compliance/time_sheet.h