From patchwork Tue Mar 23 14:36:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11672 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 0FF72C32E5 for ; Tue, 23 Mar 2021 14:36:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9B6EF68D85; Tue, 23 Mar 2021 15:36:25 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="A3D5AS8z"; dkim-atps=neutral Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A7CCA68D7D for ; Tue, 23 Mar 2021 15:36:22 +0100 (CET) Received: by mail-ej1-x62d.google.com with SMTP id jy13so27456033ejc.2 for ; Tue, 23 Mar 2021 07:36:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wLRxumWPRLBVEvwTd/U5tZ0D639aXVHsrXNw8yQchI4=; b=A3D5AS8zkIYYMyMq9UP1MGhqG492pS4EQXDpDNBr9SBuRb6zjBy/2eBQ0P7UZjen6X cicRhfbhCLc/7oTlGGDYQ4x2l8qCMjwyCN7uRFlZSh6cpHJlypg3wZEdyWrtFQ7OdjLv cXVzC4N6KCX84FsiP5Iy4vLj443iAgtH9d6X+8tpB8Kw4VbKoP4VncueMxTTQv3HOrWD POgBsnosOpLwCQ/rMV7SmBSdUQs2LAXfPwTBKDrG9w+qppkv8ZlSgCq9qkxOLuoCbsXJ ied6bSVozfTMCwJE3gyZtccjdCiBw6qRjF5UIaO0ogeHu1V1s12sozyDuElfz5U+Yovn wE+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wLRxumWPRLBVEvwTd/U5tZ0D639aXVHsrXNw8yQchI4=; b=QXfuunBwmvSc3n755kVNsVafQuqke9KSMl8AvfzvM9QmvBF7+j4fewVpMFzW+9InIP bj58p6wqS7EpF7sfNUUDuDJUbA55eAQCdW+Aovs2lULx3n7mRvuzYY+jBfsj8nmIy2cg JQSahLl8xQf0a52n9mkZm4a4rNUMdOBjkw3fqzNtdmAwfk0NiI/25yhJoIL0A7pL5ot3 Ax12UmFAKeaTE/wwoitSBjCb8ChGOckpyGp2qub8NRfwfN0iUt5pVKWpTnvJv5+AFa/Z CjHWCLG+JddT+E7R2/5K6VCl3w1e431if8BU4FyfmvW2dQK753P1ROojAWfwW570FN3D HRAw== X-Gm-Message-State: AOAM533yhgMG1+sW2ZnzzAzghtl5B/ucVZfqKngm/tzA9r6VARyDGSkT 4/szD83FnhOKob2rkEuXVgbc16L5zQ9+AA== X-Google-Smtp-Source: ABdhPJyz6VLYGraO3htHiR7xGlhocD75K1Omrc0wOyTfG+Gma8eaD5GF6DykWIQfOMnMSuKaMioKLg== X-Received: by 2002:a17:907:720a:: with SMTP id dr10mr5162634ejc.375.1616510182034; Tue, 23 Mar 2021 07:36:22 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id n6sm11282430eji.37.2021.03.23.07.36.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 07:36:21 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 23 Mar 2021 14:36:09 +0000 Message-Id: <20210323143610.787760-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210323143610.787760-1-naush@raspberrypi.com> References: <20210323143610.787760-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 6/7] ipa: raspberrypi: Rationalise parameters to ipa::start() 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" Separate out the in and out parameters in ipa::start() as they are not the same. This function now takes in a ControlList and returns out a struct StartConfig which holds a ControlList and drop frame count for the pipeline handler to action. Signed-off-by: Naushir Patuck Tested-by: David Plowman Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.mojom | 4 ++-- src/ipa/raspberrypi/raspberrypi.cpp | 16 +++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 15 +++++---------- 3 files changed, 14 insertions(+), 21 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index fafbd6c0cff3..55824eebb700 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -39,14 +39,14 @@ struct ConfigOutput { ControlList controls; }; -struct StartControls { +struct StartConfig { ControlList controls; int32 dropFrameCount; }; interface IPARPiInterface { init(IPASettings settings) => (int32 ret, SensorConfig sensorConfig); - start(StartControls controls) => (StartControls result); + start(ControlList controls) => (StartConfig startConfig); stop(); /** diff --git a/src/ipa/raspberrypi/raspberrypi.cpp b/src/ipa/raspberrypi/raspberrypi.cpp index 93e43f0626fb..b717a83e14b5 100644 --- a/src/ipa/raspberrypi/raspberrypi.cpp +++ b/src/ipa/raspberrypi/raspberrypi.cpp @@ -79,8 +79,7 @@ public: } int init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConfig) override; - void start(const ipa::RPi::StartControls &data, - ipa::RPi::StartControls *result) override; + void start(const ControlList &controls, ipa::RPi::StartConfig *startConfig) override; void stop() override {} int configure(const CameraSensorInfo &sensorInfo, @@ -192,15 +191,14 @@ int IPARPi::init(const IPASettings &settings, ipa::RPi::SensorConfig *sensorConf return 0; } -void IPARPi::start(const ipa::RPi::StartControls &data, - ipa::RPi::StartControls *result) +void IPARPi::start(const ControlList &controls, ipa::RPi::StartConfig *startConfig) { RPiController::Metadata metadata; - ASSERT(result); - if (!data.controls.empty()) { + ASSERT(startConfig); + if (!controls.empty()) { /* We have been given some controls to action before start. */ - queueRequest(data.controls); + queueRequest(controls); } controller_.SwitchMode(mode_, &metadata); @@ -215,7 +213,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data, if (agcStatus.shutter_time != 0.0 && agcStatus.analogue_gain != 0.0) { ControlList ctrls(sensorCtrls_); applyAGC(&agcStatus, ctrls); - result->controls = std::move(ctrls); + startConfig->controls = std::move(ctrls); } /* @@ -262,7 +260,7 @@ void IPARPi::start(const ipa::RPi::StartControls &data, mistrustCount_ = helper_->MistrustFramesModeSwitch(); } - result->dropFrameCount = dropFrame; + startConfig->dropFrameCount = dropFrame; firstStart_ = false; } diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index ed8cc4ead771..a65d53898362 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -815,20 +815,15 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) data->applyScalerCrop(*controls); /* Start the IPA. */ - ipa::RPi::StartControls ipaData; - ipa::RPi::StartControls result; - if (controls) - ipaData.controls = *controls; - data->ipa_->start(ipaData, &result); + ipa::RPi::StartConfig startConfig; + data->ipa_->start(controls ? *controls : ControlList{}, &startConfig); /* Apply any gain/exposure settings that the IPA may have passed back. */ - if (!result.controls.empty()) { - ControlList &ctrls = result.controls; - data->unicam_[Unicam::Image].dev()->setControls(&ctrls); - } + if (!startConfig.controls.empty()) + data->unicam_[Unicam::Image].dev()->setControls(&startConfig.controls); /* Configure the number of dropped frames required on startup. */ - data->dropFrameCount_ = result.dropFrameCount; + data->dropFrameCount_ = startConfig.dropFrameCount; /* We need to set the dropFrameCount_ before queueing buffers. */ ret = queueAllBuffers(camera);