From patchwork Tue Sep 29 01:43:33 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: 9851 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 D8B18C3B5B for ; Tue, 29 Sep 2020 01:43:58 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id B494862140; 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 6D0E460BD4 for ; Tue, 29 Sep 2020 03:43:55 +0200 (CEST) X-Halon-ID: 39da3677-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 39da3677-01f5-11eb-b295-0050569116f7; Tue, 29 Sep 2020 03:43:51 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Tue, 29 Sep 2020 03:43:33 +0200 Message-Id: <20200929014334.49719-7-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 6/7] libcamera: pipeline: rkisp1: Move path link handling to RkISP1Path 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" Move the path link handling to RkISP1Path, there is no functional change. Signed-off-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- * Changes since v3 - Rename enable() to setEnabled(bool enable) to make it less confusing for users. --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 11 ++--------- src/libcamera/pipeline/rkisp1/rkisp1_path.cpp | 6 +++++- src/libcamera/pipeline/rkisp1/rkisp1_path.h | 4 ++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index 2eaf7b491d13397b..72593a06b0f502b0 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -1010,20 +1010,13 @@ int PipelineHandlerRkISP1::initLinks(const Camera *camera, } for (const StreamConfiguration &cfg : config) { - MediaLink *link; if (cfg.stream() == &data->mainPathStream_) - link = media_->link("rkisp1_isp", 2, - "rkisp1_resizer_mainpath", 0); + ret = data->mainPath_->setEnabled(true); else if (cfg.stream() == &data->selfPathStream_) - link = media_->link("rkisp1_isp", 2, - "rkisp1_resizer_selfpath", 0); + ret = data->selfPath_->setEnabled(true); else return -EINVAL; - if (!link) - return -ENODEV; - - ret = link->setEnabled(true); if (ret < 0) return ret; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp index 9f1706c78f41465b..0ce133dd04048cbb 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.cpp @@ -22,7 +22,7 @@ RkISP1Path::RkISP1Path(const char *name, const Span &formats, const Size &minResolution, const Size &maxResolution) : name_(name), running_(false), formats_(formats), minResolution_(minResolution), maxResolution_(maxResolution), - resizer_(nullptr), video_(nullptr) + resizer_(nullptr), video_(nullptr), link_(nullptr) { } @@ -45,6 +45,10 @@ bool RkISP1Path::init(MediaDevice *media) if (video_->open() < 0) return false; + link_ = media->link("rkisp1_isp", 2, resizer, 0); + if (!link_) + return false; + return true; } diff --git a/src/libcamera/pipeline/rkisp1/rkisp1_path.h b/src/libcamera/pipeline/rkisp1/rkisp1_path.h index e2eb1be9a445ba41..98863a2e693729be 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1_path.h +++ b/src/libcamera/pipeline/rkisp1/rkisp1_path.h @@ -15,6 +15,7 @@ #include #include +#include "libcamera/internal/media_object.h" #include "libcamera/internal/v4l2_videodevice.h" namespace libcamera { @@ -33,6 +34,8 @@ public: bool init(MediaDevice *media); + int setEnabled(bool enable) { return link_->setEnabled(enable); } + StreamConfiguration generateConfiguration(const Size &resolution); CameraConfiguration::Status validate(StreamConfiguration *cfg); @@ -63,6 +66,7 @@ private: V4L2Subdevice *resizer_; V4L2VideoDevice *video_; + MediaLink *link_; }; class RkISP1MainPath : public RkISP1Path