[{"id":19018,"web_url":"https://patchwork.libcamera.org/comment/19018/","msgid":"<YSQru2dZfkCJAngS@pendragon.ideasonboard.com>","date":"2021-08-23T23:14:03","subject":"Re: [libcamera-devel] [RFC PATCH v2 07/10] gstreamer:\n\tgstlibcameraallocator: Use offset in creating a buffer","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Hiro,\n\nThank you for the patch.\n\nI'm deferring review of this to Nicolas as he knows much better than I\ndo :-)\n\nOn Mon, Aug 23, 2021 at 10:12:18PM +0900, Hirokazu Honda wrote:\n> The plane length is the length of the plane size. The buffer length\n> to be allocated for a plane is the offset and the length of\n> FrameBuffer::Plane.\n> \n> Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> ---\n>  src/gstreamer/gstlibcameraallocator.cpp | 4 +++-\n>  1 file changed, 3 insertions(+), 1 deletion(-)\n> \n> diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp\n> index 7bd8ba2d..60ead273 100644\n> --- a/src/gstreamer/gstlibcameraallocator.cpp\n> +++ b/src/gstreamer/gstlibcameraallocator.cpp\n> @@ -52,8 +52,10 @@ FrameWrap::FrameWrap(GstAllocator *allocator, FrameBuffer *buffer,\n>  \t  outstandingPlanes_(0)\n>  {\n>  \tfor (const FrameBuffer::Plane &plane : buffer->planes()) {\n> -\t\tGstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(), plane.length,\n> +\t\tGstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(),\n> +\t\t\t\t\t\t\tplane.offset + plane.length,\n>  \t\t\t\t\t\t\tGST_FD_MEMORY_FLAG_DONT_CLOSE);\n> +\t\tgst_memory_resize(mem, plane.offset, plane.length);\n>  \t\tgst_mini_object_set_qdata(GST_MINI_OBJECT(mem), getQuark(), this, nullptr);\n>  \t\tGST_MINI_OBJECT(mem)->dispose = gst_libcamera_allocator_release;\n>  \t\tg_object_unref(mem->allocator);","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 73306BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 23 Aug 2021 23:14:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 98AD2688A3;\n\tTue, 24 Aug 2021 01:14:15 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 824F968890\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Aug 2021 01:14:13 +0200 (CEST)","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 EC5402A5;\n\tTue, 24 Aug 2021 01:14:12 +0200 (CEST)"],"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=\"KIX8n+RA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1629760453;\n\tbh=CU0lqznoYDhJyzgtLn2p3Q5gQHeIa3EaZlZIo5Z8m+U=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=KIX8n+RAMbPJgO6kJmzYT8DtvLFk1nJSfaztsQI1KR1ZVZCSa5QTQmqJSB0Em3zES\n\ttoKt+PkJ8VR+kVkNkQYbgVDxbWBI/6f070bJar7aAfsnzWaDcP7c2TLep4jjXWq/Fw\n\t8yrmPRY1NddpvvA/5jxhHvV089ogUBJ4DXfMhWFs=","Date":"Tue, 24 Aug 2021 02:14:03 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Hirokazu Honda <hiroh@chromium.org>","Message-ID":"<YSQru2dZfkCJAngS@pendragon.ideasonboard.com>","References":"<20210823131221.1034059-1-hiroh@chromium.org>\n\t<20210823131221.1034059-8-hiroh@chromium.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20210823131221.1034059-8-hiroh@chromium.org>","Subject":"Re: [libcamera-devel] [RFC PATCH v2 07/10] gstreamer:\n\tgstlibcameraallocator: Use offset in creating a buffer","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":"Nicolas Dufresne <nicolas.dufresne@collabora.com>,\n\tlibcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19023,"web_url":"https://patchwork.libcamera.org/comment/19023/","msgid":"<9a8d6a66dd8017e6577f6d45be486258b3cd4c51.camel@collabora.com>","date":"2021-08-24T00:28:10","subject":"Re: [libcamera-devel] [RFC PATCH v2 07/10] gstreamer:\n\tgstlibcameraallocator: Use offset in creating a buffer","submitter":{"id":31,"url":"https://patchwork.libcamera.org/api/people/31/","name":"Nicolas Dufresne","email":"nicolas.dufresne@collabora.com"},"content":"Le mardi 24 août 2021 à 02:14 +0300, Laurent Pinchart a écrit :\n> Hi Hiro,\n> \n> Thank you for the patch.\n> \n> I'm deferring review of this to Nicolas as he knows much better than I\n> do :-)\n> \n> On Mon, Aug 23, 2021 at 10:12:18PM +0900, Hirokazu Honda wrote:\n> > The plane length is the length of the plane size. The buffer length\n> > to be allocated for a plane is the offset and the length of\n> > FrameBuffer::Plane.\n> > \n> > Signed-off-by: Hirokazu Honda <hiroh@chromium.org>\n> > ---\n> >  src/gstreamer/gstlibcameraallocator.cpp | 4 +++-\n> >  1 file changed, 3 insertions(+), 1 deletion(-)\n> > \n> > diff --git a/src/gstreamer/gstlibcameraallocator.cpp b/src/gstreamer/gstlibcameraallocator.cpp\n> > index 7bd8ba2d..60ead273 100644\n> > --- a/src/gstreamer/gstlibcameraallocator.cpp\n> > +++ b/src/gstreamer/gstlibcameraallocator.cpp\n> > @@ -52,8 +52,10 @@ FrameWrap::FrameWrap(GstAllocator *allocator, FrameBuffer *buffer,\n> >  \t  outstandingPlanes_(0)\n> >  {\n> >  \tfor (const FrameBuffer::Plane &plane : buffer->planes()) {\n> > -\t\tGstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(), plane.length,\n> > +\t\tGstMemory *mem = gst_fd_allocator_alloc(allocator, plane.fd.fd(),\n> > +\t\t\t\t\t\t\tplane.offset + plane.length,\n> >  \t\t\t\t\t\t\tGST_FD_MEMORY_FLAG_DONT_CLOSE);\n> > +\t\tgst_memory_resize(mem, plane.offset, plane.length);\n\nThis looks better indeed. Assuming you have done the inverse (removing the\noffset from V4L2 provided value) in the backend.\n\nReviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>\n\n> >  \t\tgst_mini_object_set_qdata(GST_MINI_OBJECT(mem), getQuark(), this, nullptr);\n> >  \t\tGST_MINI_OBJECT(mem)->dispose = gst_libcamera_allocator_release;\n> >  \t\tg_object_unref(mem->allocator);\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 CB886BD87C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 24 Aug 2021 00:28:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A2E17688A6;\n\tTue, 24 Aug 2021 02:28:24 +0200 (CEST)","from bhuna.collabora.co.uk (bhuna.collabora.co.uk\n\t[IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 31BE468890\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 24 Aug 2021 02:28:23 +0200 (CEST)","from [127.0.0.1] (localhost [127.0.0.1])\n\t(Authenticated sender: nicolas) with ESMTPSA id EFDFF1F41A7E"],"Message-ID":"<9a8d6a66dd8017e6577f6d45be486258b3cd4c51.camel@collabora.com>","From":"Nicolas Dufresne <nicolas.dufresne@collabora.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>, Hirokazu Honda\n\t<hiroh@chromium.org>","Date":"Mon, 23 Aug 2021 20:28:10 -0400","In-Reply-To":"<YSQru2dZfkCJAngS@pendragon.ideasonboard.com>","References":"<20210823131221.1034059-1-hiroh@chromium.org>\n\t<20210823131221.1034059-8-hiroh@chromium.org>\n\t<YSQru2dZfkCJAngS@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","User-Agent":"Evolution 3.40.4 (3.40.4-1.fc34) ","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Subject":"Re: [libcamera-devel] [RFC PATCH v2 07/10] gstreamer:\n\tgstlibcameraallocator: Use offset in creating a buffer","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>"}}]