From patchwork Tue Mar 23 12:27:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11663 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 325E4C32E5 for ; Tue, 23 Mar 2021 12:27:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B90B468D75; Tue, 23 Mar 2021 13:27:54 +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="L7HSBC7B"; dkim-atps=neutral Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D6D668D63 for ; Tue, 23 Mar 2021 13:27:50 +0100 (CET) Received: by mail-ed1-x534.google.com with SMTP id e7so23158316edu.10 for ; Tue, 23 Mar 2021 05:27:50 -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=6qT0xpw199Qo1K/XH0auRp8A0Asf+uacqMTPUf1Eap0=; b=L7HSBC7BmRs8vwKBz3ULs0qkUhZKds4NPSAFXITh0NPDLva3j1DphwdMV5AYQbBVT0 D5/6loT/tIGm/PMf0OJOKGxXPHm9+wbK4OvO1sTrOD5gUCoz7Gh9hv4BXuG08JOkDWQx GIbAr9BgUYaBpD5hVQXcf8pAOIybgS+sbc3wkQlsHiJqz64BfTHJI1wp5nLf6Dw70YIk 67z8MAhJd5ywTmI1QeQGwWIjAvoAu2VcsHqu3LgFhpF4U+OZr6xzTKEAAzQNggeBBqt6 YfsjTXzgSEdw5DG/UtW9aEevxHj2p5CcaikiMDS/+Sq+lMRzOYqvaWXB7H4s1oNKw3CW Xz3Q== 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=6qT0xpw199Qo1K/XH0auRp8A0Asf+uacqMTPUf1Eap0=; b=lrELRiWmPv1hLRz9Oo4A+mcOcbWNHEWOTIPQP58Dp2hPW0JV+gOhh0nnEc8om13CUk UaaMwo+sMkWtHMEv0lxt9qkjybaBdSYQAui+bYgpC6RlyRs+1o9yk9IKvb+aa3Nkt7w/ z6+1kQVuWhA43fKtBW0hsarJ1HnLfZb50AGICn/NdZ1gvmt/0eBgnuGiMdfweOtpW0cX y3X8R+nxJSEt+URDSlHV/9GO0x5mCh+o4k23UncA0WorQuV/mEVkJ1a4TvboEYUCoQkv 0ZnSTkUnwJsvSK9xmriRNxiDUgbEsCozOUA7FLOpjrwbzKdxFjOd+RHdfKId54M3qGVN a+VA== X-Gm-Message-State: AOAM533znKr+um80G/1uJfxgO45QdAKilAoATqDwqCzQdbOiw+wLr2hg 7LPKYTM4lOTaOReIMq7ArWJGspO2K0KNRA== X-Google-Smtp-Source: ABdhPJwVstSz+Gt8arui1MX5HiQ4dLMeEueJMsMfqSM8xmQiQJGx44KUSu5cTfCIvVHRk1QguiaUew== X-Received: by 2002:aa7:c14a:: with SMTP id r10mr4218914edp.132.1616502469398; Tue, 23 Mar 2021 05:27:49 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id u13sm11082295ejy.31.2021.03.23.05.27.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Mar 2021 05:27:49 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Tue, 23 Mar 2021 12:27:38 +0000 Message-Id: <20210323122739.680560-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210323122739.680560-1-naush@raspberrypi.com> References: <20210323122739.680560-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 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 4a3f7cbe3065..1e4861a0c121 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);