From patchwork Wed Mar 17 10:02:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 11605 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 13F46BD80C for ; Wed, 17 Mar 2021 10:02:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9BC3C68D61; Wed, 17 Mar 2021 11:02:28 +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="U6tAdZ88"; dkim-atps=neutral Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 53ACA68D70 for ; Wed, 17 Mar 2021 11:02:23 +0100 (CET) Received: by mail-ed1-x536.google.com with SMTP id w18so1525489edc.0 for ; Wed, 17 Mar 2021 03:02:23 -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=vf26R/+BQ3DxH+cRVpdFU3E7Pa4DtHwiBHbuzqa+d8k=; b=U6tAdZ88sclQsDuAal/9H6SHg2iGpiL92wvZt8QC1U2Jr7pfnl3qCWdD1DVn9kXfml OeZVFKjJrCvmP/DNuNSTXc1h4qvY3sLUzhQrt17csMJ/UkAGtZ7XqjgYbL6AiJqk0Ejv MO9BXmrGifsrQ9WwIACDi4FWjbI03u1LrQyYaJkCVD8tdOGiPgjpTrr0t6GYOnoGTNdF 5qfv24BR/sqn71ThimGQ+r8M+v7c2toMXGInx6fZ9wApiHwLWZ+pMdCtSUQCsx1OYTkE 4yEYXMxPynsJmDrckeOxLWlu7ldNhFfpLjWEjimma3NUcHBdmHox2yQ9718WQwMsw1y+ GU3g== 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=vf26R/+BQ3DxH+cRVpdFU3E7Pa4DtHwiBHbuzqa+d8k=; b=sflj0XYvH0ovrATqFtRwsLApWAjlpDiQaCj9rATrlB6SNU4roUw0h/k1Zc5GtvR57F TMaHb5RCu+u7y5ikkqfQ5pzqa38ozlnVtUtEznD/6qk1gNF+Ff7oFFft239E/HFxaBMB 5HvT0pQSWQRBGeNpzJfxW9lNXUJ7x+/U4sHREuk+kVwpQuNRheaxjKV1sN8JTG/XHJ3q e48o6Szwi4C3Kwtr6OtcsFVgzcF5FFIJ5QYezdHkYAjV7ZSiAlQuZJIw1ejnGaMlhsGp YhY1BuFo093tosmYKQHHBV4e0kIH2FbZt1LThEHRY5pogMjk/qUdazvV2mAOkh26meD7 oJ3w== X-Gm-Message-State: AOAM532J+9CVlqL1AGOI/l/KoBjOXdEyRd0gPfjN3SMWa53unDZROGJW ZDanpbAuhDk/5UwyBBhQdgx1iYoBax2J9A== X-Google-Smtp-Source: ABdhPJxvpWiQbZuW1k1PvbY5dhWOM/pbtqGeCg+6abkp7bCMIqP2g8zGe5edQ8G1x05wogEOF18EDg== X-Received: by 2002:aa7:d4cb:: with SMTP id t11mr40516083edr.202.1615975342767; Wed, 17 Mar 2021 03:02:22 -0700 (PDT) Received: from naush-laptop.patuck.local ([88.97.76.4]) by smtp.gmail.com with ESMTPSA id p24sm12061179edt.5.2021.03.17.03.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Mar 2021 03:02:22 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Date: Wed, 17 Mar 2021 10:02:10 +0000 Message-Id: <20210317100211.1067585-7-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210317100211.1067585-1-naush@raspberrypi.com> References: <20210317100211.1067585-1-naush@raspberrypi.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 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 Reviewed-by: Laurent Pinchart Reviewed-by: Laurent Pinchart --- include/libcamera/ipa/raspberrypi.mojom | 4 ++-- src/ipa/raspberrypi/raspberrypi.cpp | 16 +++++++--------- .../pipeline/raspberrypi/raspberrypi.cpp | 16 +++++++--------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/libcamera/ipa/raspberrypi.mojom b/include/libcamera/ipa/raspberrypi.mojom index a713c88eee19..7549397a27c4 100644 --- a/include/libcamera/ipa/raspberrypi.mojom +++ b/include/libcamera/ipa/raspberrypi.mojom @@ -40,14 +40,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 2ca64bcdb80a..417a7922c3bd 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 cd8a10a5747f..16568d56f31c 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -815,20 +815,18 @@ int PipelineHandlerRPi::start(Camera *camera, const ControlList *controls) data->applyScalerCrop(*controls); /* Start the IPA. */ - ipa::RPi::StartControls ipaData; - ipa::RPi::StartControls result; + ControlList startControls; + ipa::RPi::StartConfig startConfig; if (controls) - ipaData.controls = *controls; - data->ipa_->start(ipaData, &result); + startControls = *controls; + data->ipa_->start(startControls, &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);