From patchwork Thu Aug 13 00:52:46 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: 9303 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 33744BD87D for ; Thu, 13 Aug 2020 00:53:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 04DD0613BF; Thu, 13 Aug 2020 02:53:50 +0200 (CEST) Received: from vsp-unauthed02.binero.net (vsp-unauthed02.binero.net [195.74.38.227]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9592261388 for ; Thu, 13 Aug 2020 02:53:46 +0200 (CEST) X-Halon-ID: 706cbe79-dcff-11ea-92dc-005056917a89 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p54ac52a8.dip0.t-ipconnect.de [84.172.82.168]) by bin-vsp-out-01.atm.binero.net (Halon) with ESMTPA id 706cbe79-dcff-11ea-92dc-005056917a89; Thu, 13 Aug 2020 02:53:45 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: libcamera-devel@lists.libcamera.org Date: Thu, 13 Aug 2020 02:52:46 +0200 Message-Id: <20200813005246.3265807-14-niklas.soderlund@ragnatech.se> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200813005246.3265807-1-niklas.soderlund@ragnatech.se> References: <20200813005246.3265807-1-niklas.soderlund@ragnatech.se> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 13/13] libcamera: pipeline: rkisp1: Expose self path stream 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" Expose the self stream to applications and prefers it for the viewfinder and video roles as it can produce RGB. Keep preferring the main path for still capture as it could be extended to support RAW formats which makes most sens for still capture. With this change the self path becomes available to applications and a camera backed by this pipeline can produce two streams simultaneously. Signed-off-by: Niklas Söderlund --- src/libcamera/pipeline/rkisp1/rkisp1.cpp | 44 ++++++++++++++++++------ 1 file changed, 34 insertions(+), 10 deletions(-) diff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp index f106b105a47bb4f7..0ab235d80f6c677e 100644 --- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp +++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp @@ -729,17 +729,38 @@ CameraConfiguration *PipelineHandlerRkISP1::generateConfiguration(Camera *camera if (roles.empty()) return config; - std::map> streamFormats; - for (const PixelFormat &format : RKISP1_RSZ_MP_FORMATS) - streamFormats[format] = - { { RKISP1_RSZ_MP_SRC_MIN, RKISP1_RSZ_MP_SRC_MAX } }; + for (const StreamRole role : roles) { + std::map> streamFormats; - StreamFormats formats(streamFormats); - StreamConfiguration cfg(formats); - cfg.pixelFormat = formats::NV12; - cfg.size = data->sensor_->resolution(); + switch (role) { + case StreamRole::StillCapture: { + for (const PixelFormat &format : RKISP1_RSZ_MP_FORMATS) + streamFormats[format] = + { { RKISP1_RSZ_MP_SRC_MIN, RKISP1_RSZ_MP_SRC_MAX } }; + break; + } + case StreamRole::Viewfinder: + case StreamRole::VideoRecording: { + for (const PixelFormat &format : RKISP1_RSZ_SP_FORMATS) + streamFormats[format] = + { { RKISP1_RSZ_SP_SRC_MIN, RKISP1_RSZ_SP_SRC_MAX } }; + break; + } + default: + LOG(RkISP1, Warning) + << "Requested stream role not supported: " << role; + delete config; + return nullptr; + } - config->addConfiguration(cfg); + StreamFormats formats(streamFormats); + StreamConfiguration cfg(formats); + cfg.pixelFormat = formats::NV12; + cfg.size = data->sensor_->resolution(); + cfg.bufferCount = 4; + + config->addConfiguration(cfg); + } config->validate(); @@ -1214,7 +1235,10 @@ int PipelineHandlerRkISP1::createCamera(MediaEntity *sensor) if (ret) return ret; - std::set streams{ &data->mainPathStream_ }; + std::set streams{ + &data->mainPathStream_, + &data->selfPathStream_, + }; std::shared_ptr camera = Camera::create(this, data->sensor_->id(), streams); registerCamera(std::move(camera), std::move(data));