From patchwork Tue Sep 29 01:43:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 9852 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 2CF2EC3B5E for ; Tue, 29 Sep 2020 01:43:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EE5C362146; Tue, 29 Sep 2020 03:43:58 +0200 (CEST) Received: from bin-mail-out-06.binero.net (bin-mail-out-06.binero.net [195.74.38.229]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 39C6E62048 for ; Tue, 29 Sep 2020 03:43:56 +0200 (CEST) X-Halon-ID: 3a46364f-01f5-11eb-b295-0050569116f7 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de [84.172.82.168]) by bin-vsp-out-03.atm.binero.net (Halon) with ESMTPA id 3a46364f-01f5-11eb-b295-0050569116f7; Tue, 29 Sep 2020 03:43:52 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 29 Sep 2020 03:43:34 +0200 Message-Id: <20200929014334.49719-8-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929014334.49719-1-niklas.soderlund@ragnatech.se> References: <20200929014334.49719-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v4 7/7] libcamera: pipeline: rkisp1: Use the media link to track if a path is enabled 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" Instead of manually tracking if a path is enable or not use the media graph link status. There is no functional change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- * Changes since v3 - Update spelling in commit message. - Do not check path status in RkISP1Path::start() instead keep check in pipeline start(). --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 26 +++++++-------------- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 1 + 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 72593a06b0f502b0..48d00970aba3beda 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -122,8 +122,7 @@ public: RkISP1CameraData(PipelineHandler *pipe, RkISP1MainPath *mainPath, RkISP1SelfPath *selfPath) : CameraData(pipe), sensor_(nullptr), frame_(0), - frameInfo_(pipe), mainPath_(mainPath), selfPath_(selfPath), - mainPathActive_(false), selfPathActive_(false) + frameInfo_(pipe), mainPath_(mainPath), selfPath_(selfPath) { } @@ -145,9 +144,6 @@ public: RkISP1MainPath *mainPath_; RkISP1SelfPath *selfPath_; - bool mainPathActive_; - bool selfPathActive_; - private: void queueFrameAction(unsigned int frame, const IPAOperationData &action); @@ -709,20 +705,14 @@ int PipelineHandlerRkISP1::configure(Camera *camera, CameraConfiguration *c) LOG(RkISP1, Debug) << "ISP output pad configured with " << format.toString(); - data->mainPathActive_ = false; - data->selfPathActive_ = false; for (const StreamConfiguration &cfg : *config) { - if (cfg.stream() == &data->mainPathStream_) { + if (cfg.stream() == &data->mainPathStream_) ret = mainPath_.configure(cfg, format); - if (ret) - return ret; - data->mainPathActive_ = true; - } else { + else ret = selfPath_.configure(cfg, format); - if (ret) - return ret; - data->selfPathActive_ = true; - } + + if (ret) + return ret; } V4L2DeviceFormat paramFormat = {}; @@ -868,7 +858,7 @@ int PipelineHandlerRkISP1::start(Camera *camera) std::map streamConfig; - if (data->mainPathActive_) { + if (data->mainPath_->isEnabled()) { ret = mainPath_.start(); if (ret) { param_->streamOff(); @@ -884,7 +874,7 @@ int PipelineHandlerRkISP1::start(Camera *camera) }; } - if (data->selfPathActive_) { + if (data->selfPath_->isEnabled()) { ret = selfPath_.start(); if (ret) { mainPath_.stop(); diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h index 98863a2e693729be..f34d6bacd49c8f02 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h @@ -35,6 +35,7 @@ public: bool init(MediaDevice *media); int setEnabled(bool enable) { return link_->setEnabled(enable); } + bool isEnabled() { return link_->flags() & MEDIA_LNK_FL_ENABLED; } StreamConfiguration generateConfiguration(const Size &resolution); CameraConfiguration::Status validate(StreamConfiguration *cfg);