From patchwork Fri Feb 12 19:05:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dafna Hirschfeld X-Patchwork-Id: 11268 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 64BE8BD162 for ; Fri, 12 Feb 2021 19:06:15 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id C0AFF6379C; Fri, 12 Feb 2021 20:06:14 +0100 (CET) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B10B163794 for ; Fri, 12 Feb 2021 20:06:13 +0100 (CET) Received: from guri.fritz.box (p200300c7cf1cce00ddb3fb9d3f058872.dip0.t-ipconnect.de [IPv6:2003:c7:cf1c:ce00:ddb3:fb9d:3f05:8872]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dafna) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1B9431F4642D; Fri, 12 Feb 2021 19:06:13 +0000 (GMT) From: Dafna Hirschfeld To: libcamera-devel@lists.libcamera.org Date: Fri, 12 Feb 2021 20:05:57 +0100 Message-Id: <20210212190557.13905-1-dafna.hirschfeld@collabora.com> X-Mailer: git-send-email 2.17.1 Subject: [libcamera-devel] [PATCH] libcamera: pipeline: rkisp1: configure IPA from configure method instead of start method 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: , Cc: kernel@collabora.com MIME-Version: 1.0 Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Currently the call to the configure method of rkisp1 IPA is called upon the 'start' of the pipeline. This should be done in the 'configure' method instead. Signed-off-by: Dafna Hirschfeld Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 63 ++++++++++++------------ 1 file changed, 31 insertions(+), 32 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index e85979a7..f15efa9f 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -607,11 +607,24 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) << "ISP output pad configured with " << format.toString() << " crop " << rect.toString(); + std::map streamConfig; + for (const StreamConfiguration &cfg : *config) { - if (cfg.stream() == &data->mainPathStream_) + if (cfg.stream() == &data->mainPathStream_) { ret = mainPath_.configure(cfg, format); - else + if (data->mainPath_->isEnabled()) + streamConfig[0] = { + .pixelFormat = cfg.pixelFormat, + .size = cfg.size, + }; + } else { ret = selfPath_.configure(cfg, format); + if (data->selfPath_->isEnabled()) + streamConfig[1] = { + .pixelFormat = cfg.pixelFormat, + .size = cfg.size, + }; + } if (ret) return ret; @@ -629,6 +642,22 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) if (ret) return ret; + /* Inform IPA of stream configuration and sensor controls. */ + CameraSensorInfo sensorInfo = {}; + ret = data->sensor_->sensorInfo(&sensorInfo); + if (ret) { + /* \todo Turn this in an hard failure. */ + LOG(RkISP1, Warning) << "Camera sensor information not available"; + sensorInfo = {}; + ret = 0; + } + + std::map entityControls; + entityControls.emplace(0, data->sensor_->controls()); + + IPAOperationData ipaConfig; + data->ipa_->configure(sensorInfo, streamConfig, entityControls, ipaConfig, nullptr); + return 0; } @@ -759,8 +788,6 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c return ret; } - std::map streamConfig; - if (data->mainPath_->isEnabled()) { ret = mainPath_.start(); if (ret) { @@ -770,11 +797,6 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c freeBuffers(camera); return ret; } - - streamConfig[0] = { - .pixelFormat = data->mainPathStream_.configuration().pixelFormat, - .size = data->mainPathStream_.configuration().size, - }; } if (data->selfPath_->isEnabled()) { @@ -787,34 +809,11 @@ int PipelineHandlerRkISP1::start(Camera *camera, [[maybe_unused]] ControlList *c freeBuffers(camera); return ret; } - - streamConfig[1] = { - .pixelFormat = data->selfPathStream_.configuration().pixelFormat, - .size = data->selfPathStream_.configuration().size, - }; } isp_->setFrameStartEnabled(true); activeCamera_ = camera; - - /* Inform IPA of stream configuration and sensor controls. */ - CameraSensorInfo sensorInfo = {}; - ret = data->sensor_->sensorInfo(&sensorInfo); - if (ret) { - /* \todo Turn this in an hard failure. */ - LOG(RkISP1, Warning) << "Camera sensor information not available"; - sensorInfo = {}; - ret = 0; - } - - std::map entityControls; - entityControls.emplace(0, data->sensor_->controls()); - - IPAOperationData ipaConfig; - data->ipa_->configure(sensorInfo, streamConfig, entityControls, - ipaConfig, nullptr); - return ret; }