From patchwork Mon Feb 15 09:38:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 11293 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 1AA94BD160 for ; Mon, 15 Feb 2021 09:38:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 90C71637BB; Mon, 15 Feb 2021 10:38:55 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PkoxBdnl"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 55CBC6375F for ; Mon, 15 Feb 2021 10:38:53 +0100 (CET) Received: from pyrite.rasen.tech (unknown [IPv6:2400:4051:61:600:2c71:1b79:d06d:5032]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 45DAD743; Mon, 15 Feb 2021 10:38:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1613381932; bh=g++3CiYVM6cvC1AV2v6Yn+Pt/3jS1dRD5YxG883nZ/E=; h=From:To:Cc:Subject:Date:From; b=PkoxBdnlfxVGw/t1jto6T+vlIHQ3MockLu34p9b0AviujK9jG37S8nLttOzPsmC+B bOA+S6vBcY2kPkqjh2SYgKPT7LeWh5bt+Z+kvFaYdZbsG0zJuXRQcXyJlPYzspr3hQ hih73woqIpdEHSn+ziwwQy6L4WJ5V8bhBHMQDKv8= From: Paul Elder To: libcamera-devel@lists.libcamera.org Date: Mon, 15 Feb 2021 18:38:43 +0900 Message-Id: <20210215093843.144886-1-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Dafna Hirschfeld 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. [Original patch] Signed-off-by: Dafna Hirschfeld Reviewed-by: Paul Elder Reviewed-by: Laurent Pinchart [v2] Signed-off-by: Paul Elder --- Hi Dafna, The IPA IPC series is ready to be merged but depends on this patch, so I've taken the liberty to send a v2 to speed things up. Changes in v2: - remove path isEnabled() checks from configure() --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 62 ++++++++++++------------ 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index e85979a7..7cb89eb0 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -607,11 +607,22 @@ 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 + streamConfig[0] = { + .pixelFormat = cfg.pixelFormat, + .size = cfg.size, + }; + } else { ret = selfPath_.configure(cfg, format); + streamConfig[1] = { + .pixelFormat = cfg.pixelFormat, + .size = cfg.size, + }; + } if (ret) return ret; @@ -629,6 +640,23 @@ 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 into a 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 +787,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 +796,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 +808,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; }