[{"id":22012,"web_url":"https://patchwork.libcamera.org/comment/22012/","msgid":"<CAO5uPHO-eofsvfSpXtQuc5qoQa4g596r4-RBGzs1-gGZY=jYRQ@mail.gmail.com>","date":"2022-01-12T06:01:41","subject":"Re: [libcamera-devel] [PATCH 1/5] android: camera_stream: Add\n\tsourceStream","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Jacopo,\n\nOn Tue, Jan 11, 2022 at 1:54 AM Jacopo Mondi <jacopo@jmondi.org> wrote:\n>\n> From: Hirokazu Honda <hiroh@chromium.org>\n>\n> Add to the CameraStream class a sourceStream field, which for streams\n> of type Mapped contains a reference to the stream which produces the\n> actual image data.\n>\n> The sourceStream of mapped streams will be used in later patches to make\n> sure for each Mapped stream at least one libcamera::Stream is queued to\n> the libcamera::Camera.\n>\n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>\n> ---\n>  src/android/camera_device.cpp | 9 ++++++++-\n>  src/android/camera_stream.cpp | 6 ++++--\n>  src/android/camera_stream.h   | 6 +++++-\n>  3 files changed, 17 insertions(+), 4 deletions(-)\n>\n> diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\n> index 83825736ce31..005d95b51a0c 100644\n> --- a/src/android/camera_device.cpp\n> +++ b/src/android/camera_device.cpp\n> @@ -681,10 +681,17 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list)\n>         for (const auto &streamConfig : streamConfigs) {\n>                 config->addConfiguration(streamConfig.config);\n>\n> +               CameraStream *sourceStream = nullptr;\n>                 for (auto &stream : streamConfig.streams) {\n> +\n>                         streams_.emplace_back(this, config.get(), stream.type,\n> -                                             stream.stream, config->size() - 1);\n> +                                             stream.stream, sourceStream,\n> +                                             config->size() - 1);\n>                         stream.stream->priv = static_cast<void *>(&streams_.back());\n\nAlthough this is not critical problem, I would set to nullptr if the\nstream is not Mapped.\nBecause sourceStream for Direct and Internal streams is not used.\n\nRegards,\n -Hiro\n> +\n> +                       /* Mapped streams are always associated with a Direct one. */\n> +                       if (stream.type == CameraStream::Type::Direct)\n> +                               sourceStream = &streams_.back();\n>                 }\n>         }\n>\n> diff --git a/src/android/camera_stream.cpp b/src/android/camera_stream.cpp\n> index c21574501916..032b0407bd32 100644\n> --- a/src/android/camera_stream.cpp\n> +++ b/src/android/camera_stream.cpp\n> @@ -52,9 +52,11 @@ LOG_DECLARE_CATEGORY(HAL)\n>\n>  CameraStream::CameraStream(CameraDevice *const cameraDevice,\n>                            CameraConfiguration *config, Type type,\n> -                          camera3_stream_t *camera3Stream, unsigned int index)\n> +                          camera3_stream_t *camera3Stream,\n> +                          CameraStream *const sourceStream, unsigned int index)\n>         : cameraDevice_(cameraDevice), config_(config), type_(type),\n> -         camera3Stream_(camera3Stream), index_(index)\n> +         camera3Stream_(camera3Stream), sourceStream_(sourceStream),\n> +         index_(index)\n>  {\n>  }\n>\n> diff --git a/src/android/camera_stream.h b/src/android/camera_stream.h\n> index f9504462b253..4c5078b2c26d 100644\n> --- a/src/android/camera_stream.h\n> +++ b/src/android/camera_stream.h\n> @@ -114,7 +114,9 @@ public:\n>         };\n>         CameraStream(CameraDevice *const cameraDevice,\n>                      libcamera::CameraConfiguration *config, Type type,\n> -                    camera3_stream_t *camera3Stream, unsigned int index);\n> +                    camera3_stream_t *camera3Stream,\n> +                    CameraStream *const sourceStream,\n> +                    unsigned int index);\n>         CameraStream(CameraStream &&other);\n>         ~CameraStream();\n>\n> @@ -122,6 +124,7 @@ public:\n>         camera3_stream_t *camera3Stream() const { return camera3Stream_; }\n>         const libcamera::StreamConfiguration &configuration() const;\n>         libcamera::Stream *stream() const;\n> +       CameraStream *sourceStream() const { return sourceStream_; }\n>\n>         int configure();\n>         int process(Camera3RequestDescriptor::StreamBuffer *streamBuffer);\n> @@ -167,6 +170,7 @@ private:\n>         const libcamera::CameraConfiguration *config_;\n>         const Type type_;\n>         camera3_stream_t *camera3Stream_;\n> +       CameraStream *const sourceStream_;\n>         const unsigned int index_;\n>\n>         std::unique_ptr<PlatformFrameBufferAllocator> allocator_;\n> --\n> 2.34.1\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 7294CBE080\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 12 Jan 2022 06:01:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BE9FE6021A;\n\tWed, 12 Jan 2022 07:01:54 +0100 (CET)","from mail-ed1-x534.google.com (mail-ed1-x534.google.com\n\t[IPv6:2a00:1450:4864:20::534])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 948FB60217\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 12 Jan 2022 07:01:52 +0100 (CET)","by mail-ed1-x534.google.com with SMTP id i5so5428726edf.9\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Jan 2022 22:01:52 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"Etd/B2wC\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; \n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=fMSA7ISobD0x9JqFLOCRH2Mvmvy0d/GDNwh0ixspBtA=;\n\tb=Etd/B2wCjKAIxMaoSfLTIbvhLt6duT7W2abEwsjloFBajh8fOcYU2TglYlr/RMrO4s\n\tpYcD3OdK9gqJgdkCy2FJ8bkXAp1p17OB0Grv9u4BGnZ9PcGQaf4S69t+cX5eZ+yQvlHf\n\t1xWVM/QLPHzup9YMMrvH1NEcMKOyPQItP9jEQ=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20210112;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=fMSA7ISobD0x9JqFLOCRH2Mvmvy0d/GDNwh0ixspBtA=;\n\tb=Cp/h4zTjA/vWVkXVEOmyQX6nxSOw12CW/WMnvMyGdgADuROmPJB68NdGeI1OnKbXtw\n\t7XFOMk4WKtOZOsOGg/L5NMu+F5Lo7vpD4i+0P8gVRdCXcNsZBha0q6jiV+ZNPwsMQ8NA\n\tfxPf2nKQFte7y1BQoxI+i1a0U4aUlJu4glZN4Cm4Hf7cgnEBmOw8If2zHGhX8U64kVJq\n\tHBLAX2AmYlPGqkNRkv3fMLuRoVf5oUg5J8YHZ7FTJ6B6/n/6rcav1s2POWqlG3xyUipl\n\tsd1AXnFrRVRTBTqC5Jk0TWd5kmUWq/H6xnoGQP4AQRHsldxfUX6Q3U7mAhqSGdvy0AIy\n\tJ5vA==","X-Gm-Message-State":"AOAM531E42S9YZpVEoaX13io3jE47UyLSavzSOs4Bop31oM5cWEE/YSi\n\tiYjAlZXmGX1VLgKITXITUC6CwanF1hMTDXCeUB9I2ZjaOsA=","X-Google-Smtp-Source":"ABdhPJwJaLmrc4beFScRbfRwnDogsU1m0Umtq022dOHcvpR2b8PO2QEgr/nUnDR7Efkj0w4KIC0ljw8VYYGV62lKKg8=","X-Received":"by 2002:a17:907:6e26:: with SMTP id\n\tsd38mr3982946ejc.558.1641967312196; \n\tTue, 11 Jan 2022 22:01:52 -0800 (PST)","MIME-Version":"1.0","References":"<20220110165524.72978-1-jacopo@jmondi.org>\n\t<20220110165524.72978-2-jacopo@jmondi.org>","In-Reply-To":"<20220110165524.72978-2-jacopo@jmondi.org>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Wed, 12 Jan 2022 15:01:41 +0900","Message-ID":"<CAO5uPHO-eofsvfSpXtQuc5qoQa4g596r4-RBGzs1-gGZY=jYRQ@mail.gmail.com>","To":"Jacopo Mondi <jacopo@jmondi.org>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH 1/5] android: camera_stream: Add\n\tsourceStream","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]