From patchwork Sat Jun 4 09:30:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16150 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 DDDB2C326B for ; Sat, 4 Jun 2022 09:30:36 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 022C065639; Sat, 4 Jun 2022 11:30:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1654335036; bh=Hoqdya9B4Hp6D3ZANuwtESF8KiPwTBDUe3zSKVjQOkE=; 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=nizT4Jb2wEqYNCzJXIdyY1h8V/xxDrxpDg7F3W9lNiY6N4ImXSrxbIdf+jOTlHjN1 S6shByPj3GwXFgE8LWmakQIFNRHOgkDJazyEi9MbTTPVsZt8odqilsRtKdXB/Khj5V HsRuVkgq9KjO4CHanDiYvhy03b0gccLICJVU1u+CdjJ03fTO0tuQ8xQ2PU5P8TzGWp O7QNHoYQYIG2Zm3lypKtgWprZNblmRtaFrjPBJTI9b4it9R5w+2zLd9BBJqNX5zpW7 Blhx4CMieGsioRxAMAIjp/ryU+FSMplEGFSsRtseIiARYo40hMuIFuWQXEqq4mI+4Z p+PmqfvxbPU0Q== Received: from relay4-d.mail.gandi.net (relay4-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::224]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E600565638 for ; Sat, 4 Jun 2022 11:30:33 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id B1211E0005; Sat, 4 Jun 2022 09:30:32 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Sat, 4 Jun 2022 11:30:21 +0200 Message-Id: <20220604093025.77737-2-jacopo@jmondi.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220604093025.77737-1-jacopo@jmondi.org> References: <20220604093025.77737-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v3 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: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Hirokazu Honda Add a sourceStream field to the CameraStream class, meant to contain a reference to the direct stream which produces actual image data for streams of type CameraStream::Mapped. 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 --- src/android/camera_device.cpp | 15 ++++++++++++++- src/android/camera_stream.cpp | 6 ++++-- src/android/camera_stream.h | 6 +++++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index 8e804d4d5aed..773cb3b66d48 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -681,10 +681,23 @@ 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()); + + /* + * The streamConfig.streams vector contains as its first + * element a Direct (or Internal) stream, and then an + * optional set of Mapped streams derived from the + * Direct stream. Cache the Direct stream pointer, to + * be used when constructing the subsequent mapped + * streams. + */ + if (stream.type == CameraStream::Type::Direct) + sourceStream = &streams_.back(); } } diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp index 94f1884caa53..154e088e1b86 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 f9504462b253..4c5078b2c26d 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_;