[{"id":15685,"web_url":"https://patchwork.libcamera.org/comment/15685/","msgid":"<YE6m23LBjgkHxPzz@pendragon.ideasonboard.com>","date":"2021-03-15T00:14:19","subject":"Re: [libcamera-devel] [PATCH v2] gst: use the streams of\n\tCameraConfiguration when allocating buffers","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Dafna,\n\nThank you for the patch.\n\nOn Thu, Feb 25, 2021 at 05:11:06PM +0100, Dafna Hirschfeld wrote:\n> Currently, when allocating buffers, the streams of\n> the Camera object are used. Instead the streams of\n> the CameraConfiguration object should be used.\n> This is because the Camera object holds all available\n> streams while the CameraConfiguration holds only the streams\n> associated with the current configuration.\n> \n> Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>\n> Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n> ---\n> Changes from v1: change the prefix to 'gst:' and extend\n> the commit log.\n> \n>  src/gstreamer/gstlibcameraallocator.cpp | 6 ++++--\n>  src/gstreamer/gstlibcameraallocator.h   | 4 +++-\n>  src/gstreamer/gstlibcamerasrc.cpp       | 2 +-\n>  3 files changed, 8 insertions(+), 4 deletions(-)\n> \n> diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp\n> index 13c6b493..7bd8ba2d 100644\n> --- a/src/gstreamer/gstlibcameraallocator.cpp\n> +++ b/src/gstreamer/gstlibcameraallocator.cpp\n> @@ -183,13 +183,15 @@ gst_libcamera_allocator_class_init(GstLibcameraAllocatorClass *klass)\n>  }\n>  \n>  GstLibcameraAllocator *\n> -gst_libcamera_allocator_new(std::shared_ptr<Camera> camera)\n> +gst_libcamera_allocator_new(std::shared_ptr<Camera> camera,\n> +\t\t\t    CameraConfiguration *config_)\n>  {\n>  \tauto *self = GST_LIBCAMERA_ALLOCATOR(g_object_new(GST_TYPE_LIBCAMERA_ALLOCATOR,\n>  \t\t\t\t\t\t\t  nullptr));\n>  \n>  \tself->fb_allocator = new FrameBufferAllocator(camera);\n> -\tfor (Stream *stream : camera->streams()) {\n> +\tfor (StreamConfiguration &streamCfg : *config_) {\n> +\t\tStream *stream = streamCfg.stream();\n>  \t\tgint ret;\n>  \n>  \t\tret = self->fb_allocator->allocate(stream);\n> diff --git a/src/gstreamer/gstlibcameraallocator.h b/src/gstreamer/gstlibcameraallocator.h\n> index befdcad6..f7fa6acd 100644\n> --- a/src/gstreamer/gstlibcameraallocator.h\n> +++ b/src/gstreamer/gstlibcameraallocator.h\n> @@ -13,12 +13,14 @@\n>  #include <gst/allocators/allocators.h>\n>  \n>  #include <libcamera/stream.h>\n> +#include <libcamera/camera.h>\n\nWith the header in alphabetical order,\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nNo need to resend, I'll change this when applying.\n\n>  \n>  #define GST_TYPE_LIBCAMERA_ALLOCATOR gst_libcamera_allocator_get_type()\n>  G_DECLARE_FINAL_TYPE(GstLibcameraAllocator, gst_libcamera_allocator,\n>  \t\t     GST_LIBCAMERA, ALLOCATOR, GstDmaBufAllocator)\n>  \n> -GstLibcameraAllocator *gst_libcamera_allocator_new(std::shared_ptr<libcamera::Camera> camera);\n> +GstLibcameraAllocator *gst_libcamera_allocator_new(std::shared_ptr<libcamera::Camera> camera,\n> +\t\t\t\t\t\t   libcamera::CameraConfiguration *config_);\n>  \n>  bool gst_libcamera_allocator_prepare_buffer(GstLibcameraAllocator *self,\n>  \t\t\t\t\t    libcamera::Stream *stream,\n> diff --git a/src/gstreamer/gstlibcamerasrc.cpp b/src/gstreamer/gstlibcamerasrc.cpp\n> index 636c14df..7b13667b 100644\n> --- a/src/gstreamer/gstlibcamerasrc.cpp\n> +++ b/src/gstreamer/gstlibcamerasrc.cpp\n> @@ -429,7 +429,7 @@ gst_libcamera_src_task_enter(GstTask *task, [[maybe_unused]] GThread *thread,\n>  \t\treturn;\n>  \t}\n>  \n> -\tself->allocator = gst_libcamera_allocator_new(state->cam_);\n> +\tself->allocator = gst_libcamera_allocator_new(state->cam_, state->config_.get());\n>  \tif (!self->allocator) {\n>  \t\tGST_ELEMENT_ERROR(self, RESOURCE, NO_SPACE_LEFT,\n>  \t\t\t\t  (\"Failed to allocate memory\"),","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 3F228BD80E\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 15 Mar 2021 00:14:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id B01ED6084E;\n\tMon, 15 Mar 2021 01:14:57 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 0D191602E0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 15 Mar 2021 01:14:56 +0100 (CET)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 7DC10908;\n\tMon, 15 Mar 2021 01:14:55 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"mVSM3oKY\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1615767295;\n\tbh=lFuTHtcsQfvbqZh0KsZW4SFJeKIn3jFNlkYAnIxF1Cg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=mVSM3oKYadnCIHAvxds/Af0YoP+LB3ayEZQ26YC0W2RLG4DKOOnu7PS6jDv+VtzyL\n\tVJSXseGTmDCrT8BdTWVVqTCq8Js7u5Vrrgak08Q6oe5Nj+mAhZcbRbLKk19B8RXpOO\n\tx6xkkGMON7qikGixb6Mm8AZV07I/LM/XTbWlPMCU=","Date":"Mon, 15 Mar 2021 02:14:19 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Dafna Hirschfeld <dafna.hirschfeld@collabora.com>","Message-ID":"<YE6m23LBjgkHxPzz@pendragon.ideasonboard.com>","References":"<20210225161106.15954-1-dafna.hirschfeld@collabora.com>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<20210225161106.15954-1-dafna.hirschfeld@collabora.com>","Subject":"Re: [libcamera-devel] [PATCH v2] gst: use the streams of\n\tCameraConfiguration when allocating buffers","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, kernel@collabora.com,\n\tnicolas.dufresne@collabora.com","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]