From patchwork Fri May 27 09:34:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 16066 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 B2628BD161 for ; Fri, 27 May 2022 09:34:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 12BD8633A1; Fri, 27 May 2022 11:34:56 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1653644096; bh=KxO/2uimKBM3LYo5hU7ddWIH7jib6xtDBlgFtCwVJsU=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=VWyjsTG6DJzA1MNkH+4rnARAY0nn0jPxHehETilcR0neSkdNoWWKSTSYtWNCYj2dQ 1UgMeNdLppy+VrLuLxyBSuTdGpsqnkeArvqtUCov6Vu6CC9uDprpmSDVAbXkt16d2C 73Yn/jccAzO6Dfo1q1QlJtC6U1MXEbYG+V6kcjq0XkzRCcGTodvVKl1qdr1ZdOHvOM 7A0Ay1MCrhHkqglkGm76UX/X1iecWcri0xQJheKDecAktCwbFzMe4fVI5VYBMYXpf0 mIvnQCxqM61o2xqmLr2JPkyDb6wDwuCLn2wf1jyncaA1JNN1LSolUUC+kLB5Vg85BV 56t81XDKK0/pw== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D2657633A0 for ; Fri, 27 May 2022 11:34:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ItOYIBHp"; dkim-atps=neutral Received: from pyrite.rasen.tech (softbank036240126034.bbtec.net [36.240.126.34]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5403E31A; Fri, 27 May 2022 11:34:51 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1653644093; bh=KxO/2uimKBM3LYo5hU7ddWIH7jib6xtDBlgFtCwVJsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ItOYIBHp2MV8LvuDpdgEFEW7P3sBMTpHeYXzN9mIGABCqz05R0q11rZa2md7rS1A5 cZg/gs9lIF3XK+HArDKMqdTXzkptwIzfpzCn9DGVTCMaK/+TvJ2pjqf15sabsAqoVQ llR4OAjzBM+MwaCY1fJ77MQG0EzZi5UbqyWpr0/E= To: libcamera-devel@lists.libcamera.org Date: Fri, 27 May 2022 18:34:36 +0900 Message-Id: <20220527093440.953377-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220527093440.953377-1-paul.elder@ideasonboard.com> References: <20220527093440.953377-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 1/5] android: camera_stream: Add sourceStream 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: , X-Patchwork-Original-From: Paul Elder via libcamera-devel From: Paul Elder Reply-To: Paul Elder Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Hirokazu Honda Add to the CameraStream class a sourceStream field, which for streams of type Mapped contains a reference to the stream which produces the actual image data. The sourceStream of mapped streams will be used in later patches to make sure for each Mapped stream at least one libcamera::Stream is queued to the libcamera::Camera. Signed-off-by: Hirokazu Honda Signed-off-by: Jacopo Mondi Signed-off-by: Paul Elder Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- Changes in v2: - fix whitespace --- src/android/camera_device.cpp | 8 +++++++- src/android/camera_stream.cpp | 6 ++++-- src/android/camera_stream.h | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 8e804d4d..20599665 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -681,10 +681,16 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) for (const auto &streamConfig : streamConfigs) { config->addConfiguration(streamConfig.config); + CameraStream *sourceStream = nullptr; for (auto &stream : streamConfig.streams) { streams_.emplace_back(this, config.get(), stream.type, - stream.stream, config->size() - 1); + stream.stream, sourceStream, + config->size() - 1); stream.stream->priv = static_cast(&streams_.back()); + + /* Mapped streams are always associated with a Direct one. */ + if (stream.type == CameraStream::Type::Direct) + sourceStream = &streams_.back(); } } diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 94f1884c..154e088e 100644 --- a/src/android/camera_stream.cpp +++ b/src/android/camera_stream.cpp @@ -52,9 +52,11 @@ LOG_DECLARE_CATEGORY(HAL) CameraStream::CameraStream(CameraDevice *const cameraDevice, CameraConfiguration *config, Type type, - camera3_stream_t *camera3Stream, unsigned int index) + camera3_stream_t *camera3Stream, + CameraStream *const sourceStream, unsigned int index) : cameraDevice_(cameraDevice), config_(config), type_(type), - camera3Stream_(camera3Stream), index_(index) + camera3Stream_(camera3Stream), sourceStream_(sourceStream), + index_(index) { } diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h index f9504462..4c5078b2 100644 --- a/src/android/camera_stream.h +++ b/src/android/camera_stream.h @@ -114,7 +114,9 @@ public: }; CameraStream(CameraDevice *const cameraDevice, libcamera::CameraConfiguration *config, Type type, - camera3_stream_t *camera3Stream, unsigned int index); + camera3_stream_t *camera3Stream, + CameraStream *const sourceStream, + unsigned int index); CameraStream(CameraStream &&other); ~CameraStream(); @@ -122,6 +124,7 @@ public: camera3_stream_t *camera3Stream() const { return camera3Stream_; } const libcamera::StreamConfiguration &configuration() const; libcamera::Stream *stream() const; + CameraStream *sourceStream() const { return sourceStream_; } int configure(); int process(Camera3RequestDescriptor::StreamBuffer *streamBuffer); @@ -167,6 +170,7 @@ private: const libcamera::CameraConfiguration *config_; const Type type_; camera3_stream_t *camera3Stream_; + CameraStream *const sourceStream_; const unsigned int index_; std::unique_ptr allocator_;