[{"id":21428,"web_url":"https://patchwork.libcamera.org/comment/21428/","msgid":"<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>","date":"2021-11-30T09:24:52","subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Vedant,\n\nOn Tue, Nov 30, 2021 at 02:28:30PM +0530, Vedant Paranjape wrote:\n> To support importing DMABUF, we need to reqbufs with DMABUF mode.\n> \n> This patch enables using V4L2_MEMORY_DMABUF as one of the memory types\n> in vidioc_reqbuf to initialise DMA Buffer I/O\n\nHave you tested that this patch enables DMABUF support ?\n\n> Bug: https://bugs.libcamera.org/show_bug.cgi?id=89\n> \n> Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> ---\n>  src/v4l2/v4l2_camera_proxy.cpp | 8 +++++---\n>  1 file changed, 5 insertions(+), 3 deletions(-)\n> \n> diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> index f194e06345b7..49db766d9f9d 100644\n> --- a/src/v4l2/v4l2_camera_proxy.cpp\n> +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> @@ -160,7 +160,8 @@ bool V4L2CameraProxy::validateBufferType(uint32_t type)\n>  \n>  bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n>  {\n> -\treturn memory == V4L2_MEMORY_MMAP;\n> +\treturn (memory == V4L2_MEMORY_MMAP) ||\n> +\t       (memory == V4L2_MEMORY_DMABUF);\n\nNo need for parentheses.\n\nAs pointed by Paul, this introduces an issue in the EXPBUF\nimplementation.\n\nPlease stop ignoring review comments when sending new versions, or I'll\nhave to ignore your patches.\n\n>  }\n>  \n>  void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig)\n> @@ -468,7 +469,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n>  \tif (!hasOwnership(file) && owner_)\n>  \t\treturn -EBUSY;\n>  \n> -\targ->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP;\n> +\targ->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP |\n> +\t\t\t    V4L2_BUF_CAP_SUPPORTS_DMABUF;\n>  \tmemset(arg->reserved, 0, sizeof(arg->reserved));\n>  \n>  \tif (arg->count == 0) {\n> @@ -511,7 +513,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n>  \t\tstruct v4l2_buffer buf = {};\n>  \t\tbuf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;\n>  \t\tbuf.length = v4l2PixFormat_.sizeimage;\n> -\t\tbuf.memory = V4L2_MEMORY_MMAP;\n> +\t\tbuf.memory = arg->memory;\n>  \t\tbuf.m.offset = i * v4l2PixFormat_.sizeimage;\n>  \t\tbuf.index = i;\n>  \t\tbuf.flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;","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 9C969BDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 09:25:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E30D8605B4;\n\tTue, 30 Nov 2021 10:25:19 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C3D8460230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 10:25:17 +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 34CE38F0;\n\tTue, 30 Nov 2021 10:25:17 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"cS//2wM8\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638264317;\n\tbh=h+CHmt/6JBxEzNgmkjCUqi9Cq73Ku+BuqkWw/sz+shI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=cS//2wM84B89ohg2M2RKZPqq2py2Tgcaq1FywPSYlZdB/ChnqkDpChx6gJaqDTpAQ\n\tXZgQcFkG2ewEey197nCFiaOWXIOEYMlhaucJpPhtxvR9mmrz10E6m70GQz0XU3p8vN\n\t0ChM+xSuB/xyF+Z+1HbEpMIRnVmnfkiOegufYY6c=","Date":"Tue, 30 Nov 2021 11:24:52 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>","References":"<20211130085830.1529550-1-vedantparanjape160201@gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211130085830.1529550-1-vedantparanjape160201@gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","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>"}},{"id":21429,"web_url":"https://patchwork.libcamera.org/comment/21429/","msgid":"<CACGrz-M9GbRH7eye=FUsDW2Qk1wEUPeU2P7J0S_4hSCy4Qem_Q@mail.gmail.com>","date":"2021-11-30T09:32:15","subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"content":"Hi Laurent,\nI wanted to send this as an RFC, my bad.\n\nOn Tue, Nov 30, 2021 at 2:55 PM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Vedant,\n>\n> On Tue, Nov 30, 2021 at 02:28:30PM +0530, Vedant Paranjape wrote:\n> > To support importing DMABUF, we need to reqbufs with DMABUF mode.\n> >\n> > This patch enables using V4L2_MEMORY_DMABUF as one of the memory types\n> > in vidioc_reqbuf to initialise DMA Buffer I/O\n>\n> Have you tested that this patch enables DMABUF support ?\n>\n> > Bug: https://bugs.libcamera.org/show_bug.cgi?id=89\n> >\n> > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > ---\n> >  src/v4l2/v4l2_camera_proxy.cpp | 8 +++++---\n> >  1 file changed, 5 insertions(+), 3 deletions(-)\n> >\n> > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > index f194e06345b7..49db766d9f9d 100644\n> > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > @@ -160,7 +160,8 @@ bool V4L2CameraProxy::validateBufferType(uint32_t type)\n> >\n> >  bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n> >  {\n> > -     return memory == V4L2_MEMORY_MMAP;\n> > +     return (memory == V4L2_MEMORY_MMAP) ||\n> > +            (memory == V4L2_MEMORY_DMABUF);\n>\n> No need for parentheses.\n>\n> As pointed by Paul, this introduces an issue in the EXPBUF\n> implementation.\n>\n> Please stop ignoring review comments when sending new versions, or I'll\n> have to ignore your patches.\n\nI'm extremely sorry, didn't mean to ignore. I had a chat with Paul\nregarding solving this, I wanted to send this as an RFC instead.\n\n>\n> >  }\n> >\n> >  void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig)\n> > @@ -468,7 +469,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> >       if (!hasOwnership(file) && owner_)\n> >               return -EBUSY;\n> >\n> > -     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP;\n> > +     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP |\n> > +                         V4L2_BUF_CAP_SUPPORTS_DMABUF;\n> >       memset(arg->reserved, 0, sizeof(arg->reserved));\n> >\n> >       if (arg->count == 0) {\n> > @@ -511,7 +513,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> >               struct v4l2_buffer buf = {};\n> >               buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;\n> >               buf.length = v4l2PixFormat_.sizeimage;\n> > -             buf.memory = V4L2_MEMORY_MMAP;\n> > +             buf.memory = arg->memory;\n> >               buf.m.offset = i * v4l2PixFormat_.sizeimage;\n> >               buf.index = i;\n> >               buf.flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n\nRegards,\nVedant Paranjape","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 1C9E4BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 09:32:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 568F5605B7;\n\tTue, 30 Nov 2021 10:32:29 +0100 (CET)","from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com\n\t[IPv6:2607:f8b0:4864:20::b33])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5BCFE60230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 10:32:27 +0100 (CET)","by mail-yb1-xb33.google.com with SMTP id x32so50686072ybi.12\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 01:32:27 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Sr/IRnw5\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=zFY+rqrtpr9Jwr3ELIsBzBPJMEPYORWPmi5sReTISVQ=;\n\tb=Sr/IRnw58UlND8dXg0eKmUoqL34gf/emPPERqH2icOIbjbZFmVTU00+MPtzPo7fYx+\n\tqrcMNzZSpPwHNqlU/lBPKbcVWdsQOmO2ODWXgZkY+rOwFV4fh9cj3sGULO6xpd78HKlP\n\t56dhgqruipCSLcKVxUxjRWZtgnd00W3JNUSvVMBRHdH9RHLNleoxQ8yg/+n2JoC6vdDb\n\tufLPeF166FK8aowfcWis0Q5OP4uoKyx6KarRnSvtYycgVwf9qKytja7GKtehyhHB5chg\n\tbE57RrRZIagumKiJBrq0yF81bsHiiOfc6QtXi+sJfqb9Vp5WCJIU371eH7KOrnCJDBed\n\tmMRA==","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=zFY+rqrtpr9Jwr3ELIsBzBPJMEPYORWPmi5sReTISVQ=;\n\tb=yDfY/PHVkg6z7IkkhECAaCioRO6fpcJYdFg4O9a+8p4FBFU3w1IUDdS9A4u/KI2cUj\n\tFiaRYfTS46KKnntYh4zG9zJWEj5uq/0jDe11FfumgVVFR28mac+w+4ah0vrWft6nRZPq\n\tG7xvWk71gATyP/YA0nRIT06+Q+3psu7R4o6UhGNYB27GFzcyLW67SF/0+uLhGvaR69TY\n\tamUcC/Q/NhYAMx2DhbqDOZOPGZ205vhRNionM/6ejPwXYEOnEKb9qx/hW9SyhgDQxShn\n\tAZ2ltTJIdZYsH3YxxkN8kDKW2sgfoQWNjkHQUzuhioQdobMtDYUik/xizhaZ2wpqVEOe\n\tWdXw==","X-Gm-Message-State":"AOAM5326iqgEfbhFqbfR6bgxCCaIxOXtr/dkKHIiX4SQ1xS7UWhfVnKS\n\ti0Q1TNY3yzpzLs4yuOotdY++biMtSOGotbdh9NWC0iKY4ZSkgw==","X-Google-Smtp-Source":"ABdhPJz/FnLe1FByQneIOrDkM1XYcNQbxDw+lqAaOPKU7iSw6s06AUNyd8Ae0b/gzAokLAr0CU3XZsSEdxIC/SG4VbM=","X-Received":"by 2002:a25:ba0e:: with SMTP id\n\tt14mr11606866ybg.49.1638264746158; \n\tTue, 30 Nov 2021 01:32:26 -0800 (PST)","MIME-Version":"1.0","References":"<20211130085830.1529550-1-vedantparanjape160201@gmail.com>\n\t<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>","In-Reply-To":"<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Date":"Tue, 30 Nov 2021 15:02:15 +0530","Message-ID":"<CACGrz-M9GbRH7eye=FUsDW2Qk1wEUPeU2P7J0S_4hSCy4Qem_Q@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21437,"web_url":"https://patchwork.libcamera.org/comment/21437/","msgid":"<20211130102839.GC3297112@pyrite.rasen.tech>","date":"2021-11-30T10:28:39","subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","submitter":{"id":17,"url":"https://patchwork.libcamera.org/api/people/17/","name":"Paul Elder","email":"paul.elder@ideasonboard.com"},"content":"On Tue, Nov 30, 2021 at 03:02:15PM +0530, Vedant Paranjape wrote:\n> Hi Laurent,\n> I wanted to send this as an RFC, my bad.\n\nIf it was an RFC it would've be nice to know it was an RFC :D\n\n> \n> On Tue, Nov 30, 2021 at 2:55 PM Laurent Pinchart\n> <laurent.pinchart@ideasonboard.com> wrote:\n> >\n> > Hi Vedant,\n> >\n> > On Tue, Nov 30, 2021 at 02:28:30PM +0530, Vedant Paranjape wrote:\n> > > To support importing DMABUF, we need to reqbufs with DMABUF mode.\n> > >\n> > > This patch enables using V4L2_MEMORY_DMABUF as one of the memory types\n> > > in vidioc_reqbuf to initialise DMA Buffer I/O\n> >\n> > Have you tested that this patch enables DMABUF support ?\n> >\n> > > Bug: https://bugs.libcamera.org/show_bug.cgi?id=89\n> > >\n> > > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > > ---\n> > >  src/v4l2/v4l2_camera_proxy.cpp | 8 +++++---\n> > >  1 file changed, 5 insertions(+), 3 deletions(-)\n> > >\n> > > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > > index f194e06345b7..49db766d9f9d 100644\n> > > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > > @@ -160,7 +160,8 @@ bool V4L2CameraProxy::validateBufferType(uint32_t type)\n> > >\n> > >  bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n> > >  {\n> > > -     return memory == V4L2_MEMORY_MMAP;\n> > > +     return (memory == V4L2_MEMORY_MMAP) ||\n> > > +            (memory == V4L2_MEMORY_DMABUF);\n> >\n> > No need for parentheses.\n> >\n> > As pointed by Paul, this introduces an issue in the EXPBUF\n> > implementation.\n> >\n> > Please stop ignoring review comments when sending new versions, or I'll\n> > have to ignore your patches.\n> \n> I'm extremely sorry, didn't mean to ignore. I had a chat with Paul\n> regarding solving this, I wanted to send this as an RFC instead.\n\nSo clearly this patch depends on the other stuff that you were planning\nto send separately from this patch. Which means that on this patch you\nneed to (besides mentioning that it's RFC) mention that you depend on X\nfeatures that you'll send patches for later.\n\n\nPaul\n\n> \n> >\n> > >  }\n> > >\n> > >  void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig)\n> > > @@ -468,7 +469,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > >       if (!hasOwnership(file) && owner_)\n> > >               return -EBUSY;\n> > >\n> > > -     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP;\n> > > +     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP |\n> > > +                         V4L2_BUF_CAP_SUPPORTS_DMABUF;\n> > >       memset(arg->reserved, 0, sizeof(arg->reserved));\n> > >\n> > >       if (arg->count == 0) {\n> > > @@ -511,7 +513,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > >               struct v4l2_buffer buf = {};\n> > >               buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;\n> > >               buf.length = v4l2PixFormat_.sizeimage;\n> > > -             buf.memory = V4L2_MEMORY_MMAP;\n> > > +             buf.memory = arg->memory;\n> > >               buf.m.offset = i * v4l2PixFormat_.sizeimage;\n> > >               buf.index = i;\n> > >               buf.flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;\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 31D80BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 10:28:49 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CE6E2605B4;\n\tTue, 30 Nov 2021 11:28:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 315AC60230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 11:28:47 +0100 (CET)","from pyrite.rasen.tech (unknown\n\t[IPv6:2400:4051:61:600:2c71:1b79:d06d:5032])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 762762A5;\n\tTue, 30 Nov 2021 11:28:45 +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=\"DpaxUxzN\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638268127;\n\tbh=3ekoVmGj+gyeG37nIUWIaAy5CT8hwiaSOM4xNeACPvg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DpaxUxzN8ubwdNMHrIOg1kMhEZStAm5jw4sRqYpkqDWa5eGUeXqjy4FZ60v2PFkuW\n\tfNOsnz0N3NQ61UJuXsIm/KlAPn+MHQk3+wslZVCDZUrGOWc8Rvef/rChdVqYhKNMz9\n\tT5zfOlRtUUos0XjGeD4s/r40WQPUPa1GQ9WEchqg=","Date":"Tue, 30 Nov 2021 19:28:39 +0900","From":"paul.elder@ideasonboard.com","To":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Message-ID":"<20211130102839.GC3297112@pyrite.rasen.tech>","References":"<20211130085830.1529550-1-vedantparanjape160201@gmail.com>\n\t<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>\n\t<CACGrz-M9GbRH7eye=FUsDW2Qk1wEUPeU2P7J0S_4hSCy4Qem_Q@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=us-ascii","Content-Disposition":"inline","In-Reply-To":"<CACGrz-M9GbRH7eye=FUsDW2Qk1wEUPeU2P7J0S_4hSCy4Qem_Q@mail.gmail.com>","Subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21439,"web_url":"https://patchwork.libcamera.org/comment/21439/","msgid":"<YaX+EIVDLgSKlSop@pendragon.ideasonboard.com>","date":"2021-11-30T10:33:52","subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Tue, Nov 30, 2021 at 07:28:39PM +0900, paul.elder@ideasonboard.com wrote:\n> On Tue, Nov 30, 2021 at 03:02:15PM +0530, Vedant Paranjape wrote:\n> > Hi Laurent,\n> > I wanted to send this as an RFC, my bad.\n> \n> If it was an RFC it would've be nice to know it was an RFC :D\n> \n> > \n> > On Tue, Nov 30, 2021 at 2:55 PM Laurent Pinchart\n> > <laurent.pinchart@ideasonboard.com> wrote:\n> > >\n> > > Hi Vedant,\n> > >\n> > > On Tue, Nov 30, 2021 at 02:28:30PM +0530, Vedant Paranjape wrote:\n> > > > To support importing DMABUF, we need to reqbufs with DMABUF mode.\n> > > >\n> > > > This patch enables using V4L2_MEMORY_DMABUF as one of the memory types\n> > > > in vidioc_reqbuf to initialise DMA Buffer I/O\n> > >\n> > > Have you tested that this patch enables DMABUF support ?\n> > >\n> > > > Bug: https://bugs.libcamera.org/show_bug.cgi?id=89\n> > > >\n> > > > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > > > ---\n> > > >  src/v4l2/v4l2_camera_proxy.cpp | 8 +++++---\n> > > >  1 file changed, 5 insertions(+), 3 deletions(-)\n> > > >\n> > > > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > > > index f194e06345b7..49db766d9f9d 100644\n> > > > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > > > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > > > @@ -160,7 +160,8 @@ bool V4L2CameraProxy::validateBufferType(uint32_t type)\n> > > >\n> > > >  bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n> > > >  {\n> > > > -     return memory == V4L2_MEMORY_MMAP;\n> > > > +     return (memory == V4L2_MEMORY_MMAP) ||\n> > > > +            (memory == V4L2_MEMORY_DMABUF);\n> > >\n> > > No need for parentheses.\n> > >\n> > > As pointed by Paul, this introduces an issue in the EXPBUF\n> > > implementation.\n> > >\n> > > Please stop ignoring review comments when sending new versions, or I'll\n> > > have to ignore your patches.\n> > \n> > I'm extremely sorry, didn't mean to ignore. I had a chat with Paul\n> > regarding solving this, I wanted to send this as an RFC instead.\n> \n> So clearly this patch depends on the other stuff that you were planning\n> to send separately from this patch. Which means that on this patch you\n> need to (besides mentioning that it's RFC) mention that you depend on X\n> features that you'll send patches for later.\n\nAnd I don't think there's more feedback that can be provided on this\npatch alone without the rest of the implementation, we need to look at\nit in its entirety.\n\nRFC submissions should make it clear what comments are requested, and\nwhy they're sent as RFCs and not normal patches.\n\n> > > >  }\n> > > >\n> > > >  void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig)\n> > > > @@ -468,7 +469,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > > >       if (!hasOwnership(file) && owner_)\n> > > >               return -EBUSY;\n> > > >\n> > > > -     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP;\n> > > > +     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP |\n> > > > +                         V4L2_BUF_CAP_SUPPORTS_DMABUF;\n> > > >       memset(arg->reserved, 0, sizeof(arg->reserved));\n> > > >\n> > > >       if (arg->count == 0) {\n> > > > @@ -511,7 +513,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > > >               struct v4l2_buffer buf = {};\n> > > >               buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;\n> > > >               buf.length = v4l2PixFormat_.sizeimage;\n> > > > -             buf.memory = V4L2_MEMORY_MMAP;\n> > > > +             buf.memory = arg->memory;\n> > > >               buf.m.offset = i * v4l2PixFormat_.sizeimage;\n> > > >               buf.index = i;\n> > > >               buf.flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;","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 716BABDB13\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 10:34:19 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BD8D0605B4;\n\tTue, 30 Nov 2021 11:34:18 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id C1E1460230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 11:34:17 +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 242392A5;\n\tTue, 30 Nov 2021 11:34:17 +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=\"Ra67Q6UQ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1638268457;\n\tbh=KpkaA8nmwjHmW3SqUyuKyT9g3PVvRJrtTCRM1UM2Wc4=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=Ra67Q6UQtl8ADXMi+IWDx3bbcEy+GFWkdds3bZlIR0a59Xp/UA+qvGs5LMI8bXpJE\n\ttZHUkxjh46cUVFJRvsni/NpLuDeJyvQlvCMG3UIWGrSaJQSDkDZ/3jr5FUt3e1+HT0\n\tf+apws0bvhO86g6vNNR+f+jvg4gZLQ4tMr7rKJEU=","Date":"Tue, 30 Nov 2021 12:33:52 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"paul.elder@ideasonboard.com","Message-ID":"<YaX+EIVDLgSKlSop@pendragon.ideasonboard.com>","References":"<20211130085830.1529550-1-vedantparanjape160201@gmail.com>\n\t<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>\n\t<CACGrz-M9GbRH7eye=FUsDW2Qk1wEUPeU2P7J0S_4hSCy4Qem_Q@mail.gmail.com>\n\t<20211130102839.GC3297112@pyrite.rasen.tech>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20211130102839.GC3297112@pyrite.rasen.tech>","Subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","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 <libcamera-devel@lists.libcamera.org>,\n\tVedant Paranjape <vedantparanjape160201@gmail.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21440,"web_url":"https://patchwork.libcamera.org/comment/21440/","msgid":"<CACGrz-Pi_JZE6DbitiH_K_7VoHV8ejiPqowUYk9na_riQBKbag@mail.gmail.com>","date":"2021-11-30T10:38:35","subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"content":"Hi Paul,\n\nOn Tue, Nov 30, 2021 at 3:58 PM <paul.elder@ideasonboard.com> wrote:\n>\n> On Tue, Nov 30, 2021 at 03:02:15PM +0530, Vedant Paranjape wrote:\n> > Hi Laurent,\n> > I wanted to send this as an RFC, my bad.\n>\n> If it was an RFC it would've be nice to know it was an RFC :D\n>\n> >\n> > On Tue, Nov 30, 2021 at 2:55 PM Laurent Pinchart\n> > <laurent.pinchart@ideasonboard.com> wrote:\n> > >\n> > > Hi Vedant,\n> > >\n> > > On Tue, Nov 30, 2021 at 02:28:30PM +0530, Vedant Paranjape wrote:\n> > > > To support importing DMABUF, we need to reqbufs with DMABUF mode.\n> > > >\n> > > > This patch enables using V4L2_MEMORY_DMABUF as one of the memory types\n> > > > in vidioc_reqbuf to initialise DMA Buffer I/O\n> > >\n> > > Have you tested that this patch enables DMABUF support ?\n> > >\n> > > > Bug: https://bugs.libcamera.org/show_bug.cgi?id=89\n> > > >\n> > > > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > > > ---\n> > > >  src/v4l2/v4l2_camera_proxy.cpp | 8 +++++---\n> > > >  1 file changed, 5 insertions(+), 3 deletions(-)\n> > > >\n> > > > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > > > index f194e06345b7..49db766d9f9d 100644\n> > > > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > > > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > > > @@ -160,7 +160,8 @@ bool V4L2CameraProxy::validateBufferType(uint32_t type)\n> > > >\n> > > >  bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n> > > >  {\n> > > > -     return memory == V4L2_MEMORY_MMAP;\n> > > > +     return (memory == V4L2_MEMORY_MMAP) ||\n> > > > +            (memory == V4L2_MEMORY_DMABUF);\n> > >\n> > > No need for parentheses.\n> > >\n> > > As pointed by Paul, this introduces an issue in the EXPBUF\n> > > implementation.\n> > >\n> > > Please stop ignoring review comments when sending new versions, or I'll\n> > > have to ignore your patches.\n> >\n> > I'm extremely sorry, didn't mean to ignore. I had a chat with Paul\n> > regarding solving this, I wanted to send this as an RFC instead.\n>\n> So clearly this patch depends on the other stuff that you were planning\n> to send separately from this patch. Which means that on this patch you\n> need to (besides mentioning that it's RFC) mention that you depend on X\n> features that you'll send patches for later.\n\nRight, noted. I'll send a patch series as RFC only after I am done with it.\n\n>\n>\n> Paul\n>\n> >\n> > >\n> > > >  }\n> > > >\n> > > >  void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig)\n> > > > @@ -468,7 +469,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > > >       if (!hasOwnership(file) && owner_)\n> > > >               return -EBUSY;\n> > > >\n> > > > -     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP;\n> > > > +     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP |\n> > > > +                         V4L2_BUF_CAP_SUPPORTS_DMABUF;\n> > > >       memset(arg->reserved, 0, sizeof(arg->reserved));\n> > > >\n> > > >       if (arg->count == 0) {\n> > > > @@ -511,7 +513,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > > >               struct v4l2_buffer buf = {};\n> > > >               buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;\n> > > >               buf.length = v4l2PixFormat_.sizeimage;\n> > > > -             buf.memory = V4L2_MEMORY_MMAP;\n> > > > +             buf.memory = arg->memory;\n> > > >               buf.m.offset = i * v4l2PixFormat_.sizeimage;\n> > > >               buf.index = i;\n> > > >               buf.flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;\n> > >\n\nRegards,\nVedant Paranjape","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 5154FBF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 10:38:51 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8B4CA605B4;\n\tTue, 30 Nov 2021 11:38:50 +0100 (CET)","from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com\n\t[IPv6:2607:f8b0:4864:20::b2b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE26260230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 11:38:48 +0100 (CET)","by mail-yb1-xb2b.google.com with SMTP id e136so51121482ybc.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 02:38:48 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"Q7bb87X0\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=krbqbJ7HZleUG5/+F/cCLAMVwgYfOK64qwGI6gp0SxY=;\n\tb=Q7bb87X0+Kd1zIT5DUKOSdnPF8R6Q7tFGOEl5XLX44b4WOnmWzV0L6yeSdzGIccF0w\n\t+kZurtQ3af2i9zbnOLR/q19VI6Lu7CbkvYkgol+Flm46GdRA47b15VQhMRpGVwgwJi+U\n\tyvo1heLk0mDQgXKtF1FLrdV0Oo+xBI9iwjt3ZGG7/SARyfe9gpF2tIwc+Y9C3iKJeql5\n\tAe2vpVu2NcJ46o2BVUVGjM8xaRZ87WF8F4FoZ3rdguHYu5XMWCeuNWeQP1l1s4+LZy+F\n\tTolzqAyKU6NaS9GXaF1/fGKpaJi4/hMQIOAQG4LJxGzm3GpcTzaFI91xRKe+mJUB8Oeg\n\tOddg==","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=krbqbJ7HZleUG5/+F/cCLAMVwgYfOK64qwGI6gp0SxY=;\n\tb=NAOY202mPmUpQ+0yzbaW+U/LfI9Sgfl8jE/p+TmXbaWv8L5D0jYCRVGEVKUrdx21YC\n\tkM2dYOsGEkjLhk/niSz0LzE5DxpgIoJCd12WlxdlxpM6x7BOqizII77ZyaxsSaYwWpsb\n\t18uHQOTmesFV80Ir0GXXXgLRExQncxAGfTCcB+n4amJUXi2+HxV4rX5lV2lXLOI0a2lS\n\tUJn1QuZ/5hy+zLkgBDgd1Y7ULM13hGzQXpi0Al95PBFe3e4vcrvNRP8hJD2IyZ/+gRSj\n\tCrulB4HExdALdM8NLRbB2b1Fjk41MI4udPVJZQfSHWHLyp/dFWQzg7COe1/HIA/xIEfF\n\tUZUQ==","X-Gm-Message-State":"AOAM531wzHKGzVYykmWAOQeNPjCmZ71RZ/WJFknbOD1MueyvAdfa4PAn\n\t1Llryc5dnnuWCRHWjpf+XdB8wjeHexujOXJVzAA=","X-Google-Smtp-Source":"ABdhPJyT4lhrqAJsMNFTv2rAbecTsRU/sRun/ageel+Y+0BnnpaTUvXK1I9pslmLo5ZRjmY/Blb14vfX3zpfbZ00ED8=","X-Received":"by 2002:a25:baca:: with SMTP id\n\ta10mr12063814ybk.598.1638268727514; \n\tTue, 30 Nov 2021 02:38:47 -0800 (PST)","MIME-Version":"1.0","References":"<20211130085830.1529550-1-vedantparanjape160201@gmail.com>\n\t<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>\n\t<CACGrz-M9GbRH7eye=FUsDW2Qk1wEUPeU2P7J0S_4hSCy4Qem_Q@mail.gmail.com>\n\t<20211130102839.GC3297112@pyrite.rasen.tech>","In-Reply-To":"<20211130102839.GC3297112@pyrite.rasen.tech>","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Date":"Tue, 30 Nov 2021 16:08:35 +0530","Message-ID":"<CACGrz-Pi_JZE6DbitiH_K_7VoHV8ejiPqowUYk9na_riQBKbag@mail.gmail.com>","To":"Paul Elder <paul.elder@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":21441,"web_url":"https://patchwork.libcamera.org/comment/21441/","msgid":"<CACGrz-Ptw_EAhf=kjKEWtJsgHnHArav8zzjmF=XcaqUu2UQ13g@mail.gmail.com>","date":"2021-11-30T10:42:09","subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","submitter":{"id":85,"url":"https://patchwork.libcamera.org/api/people/85/","name":"Vedant Paranjape","email":"vedantparanjape160201@gmail.com"},"content":"HI Laurent,\n\nOn Tue, Nov 30, 2021 at 4:04 PM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> On Tue, Nov 30, 2021 at 07:28:39PM +0900, paul.elder@ideasonboard.com wrote:\n> > On Tue, Nov 30, 2021 at 03:02:15PM +0530, Vedant Paranjape wrote:\n> > > Hi Laurent,\n> > > I wanted to send this as an RFC, my bad.\n> >\n> > If it was an RFC it would've be nice to know it was an RFC :D\n> >\n> > >\n> > > On Tue, Nov 30, 2021 at 2:55 PM Laurent Pinchart\n> > > <laurent.pinchart@ideasonboard.com> wrote:\n> > > >\n> > > > Hi Vedant,\n> > > >\n> > > > On Tue, Nov 30, 2021 at 02:28:30PM +0530, Vedant Paranjape wrote:\n> > > > > To support importing DMABUF, we need to reqbufs with DMABUF mode.\n> > > > >\n> > > > > This patch enables using V4L2_MEMORY_DMABUF as one of the memory types\n> > > > > in vidioc_reqbuf to initialise DMA Buffer I/O\n> > > >\n> > > > Have you tested that this patch enables DMABUF support ?\n> > > >\n> > > > > Bug: https://bugs.libcamera.org/show_bug.cgi?id=89\n> > > > >\n> > > > > Signed-off-by: Vedant Paranjape <vedantparanjape160201@gmail.com>\n> > > > > ---\n> > > > >  src/v4l2/v4l2_camera_proxy.cpp | 8 +++++---\n> > > > >  1 file changed, 5 insertions(+), 3 deletions(-)\n> > > > >\n> > > > > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp\n> > > > > index f194e06345b7..49db766d9f9d 100644\n> > > > > --- a/src/v4l2/v4l2_camera_proxy.cpp\n> > > > > +++ b/src/v4l2/v4l2_camera_proxy.cpp\n> > > > > @@ -160,7 +160,8 @@ bool V4L2CameraProxy::validateBufferType(uint32_t type)\n> > > > >\n> > > > >  bool V4L2CameraProxy::validateMemoryType(uint32_t memory)\n> > > > >  {\n> > > > > -     return memory == V4L2_MEMORY_MMAP;\n> > > > > +     return (memory == V4L2_MEMORY_MMAP) ||\n> > > > > +            (memory == V4L2_MEMORY_DMABUF);\n> > > >\n> > > > No need for parentheses.\n> > > >\n> > > > As pointed by Paul, this introduces an issue in the EXPBUF\n> > > > implementation.\n> > > >\n> > > > Please stop ignoring review comments when sending new versions, or I'll\n> > > > have to ignore your patches.\n> > >\n> > > I'm extremely sorry, didn't mean to ignore. I had a chat with Paul\n> > > regarding solving this, I wanted to send this as an RFC instead.\n> >\n> > So clearly this patch depends on the other stuff that you were planning\n> > to send separately from this patch. Which means that on this patch you\n> > need to (besides mentioning that it's RFC) mention that you depend on X\n> > features that you'll send patches for later.\n>\n> And I don't think there's more feedback that can be provided on this\n> patch alone without the rest of the implementation, we need to look at\n> it in its entirety.\n>\n> RFC submissions should make it clear what comments are requested, and\n> why they're sent as RFCs and not normal patches.\n\nSure, I'll keep this in mind next time I send a patch (or RFC patch).\n\n>\n> > > > >  }\n> > > > >\n> > > > >  void V4L2CameraProxy::setFmtFromConfig(const StreamConfiguration &streamConfig)\n> > > > > @@ -468,7 +469,8 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > > > >       if (!hasOwnership(file) && owner_)\n> > > > >               return -EBUSY;\n> > > > >\n> > > > > -     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP;\n> > > > > +     arg->capabilities = V4L2_BUF_CAP_SUPPORTS_MMAP |\n> > > > > +                         V4L2_BUF_CAP_SUPPORTS_DMABUF;\n> > > > >       memset(arg->reserved, 0, sizeof(arg->reserved));\n> > > > >\n> > > > >       if (arg->count == 0) {\n> > > > > @@ -511,7 +513,7 @@ int V4L2CameraProxy::vidioc_reqbufs(V4L2CameraFile *file, struct v4l2_requestbuf\n> > > > >               struct v4l2_buffer buf = {};\n> > > > >               buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;\n> > > > >               buf.length = v4l2PixFormat_.sizeimage;\n> > > > > -             buf.memory = V4L2_MEMORY_MMAP;\n> > > > > +             buf.memory = arg->memory;\n> > > > >               buf.m.offset = i * v4l2PixFormat_.sizeimage;\n> > > > >               buf.index = i;\n> > > > >               buf.flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;\n>\n> --\n> Regards,\n>\n> Laurent Pinchart\n\nRegards,\nVedant Paranjape","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 4C1B6BF415\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 30 Nov 2021 10:42:24 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8F0CC605B7;\n\tTue, 30 Nov 2021 11:42:23 +0100 (CET)","from mail-yb1-xb2b.google.com (mail-yb1-xb2b.google.com\n\t[IPv6:2607:f8b0:4864:20::b2b])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 1311460230\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 11:42:22 +0100 (CET)","by mail-yb1-xb2b.google.com with SMTP id y68so51291825ybe.1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 30 Nov 2021 02:42:21 -0800 (PST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"e+6keWqD\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;\n\th=mime-version:references:in-reply-to:from:date:message-id:subject:to\n\t:cc; bh=m2dLdtJQcGafaSDyob70UocXu+U3JMZMfngsOov2NAM=;\n\tb=e+6keWqDx99zNOUX4wC4X5HhEToUXJE/kW1P0LGEYiZ4TeQW0o2F3NOdqa+tCpAQG8\n\txNUFTABoXBVV5NVqKseoeB+Wo60Rp7Gv0c+gpE843Y6WAvOOgVcm6nvJq/NUuXc0Vmag\n\tC9Jd0zJ16ta/08rzVOiLuadRGGNd1REpVegf0mVm0tdt8DVxIQV1VRBwYOjiJU4TttC4\n\tcSolIQNHp8IFfaI4lPcmoLgWhgfjOu1c0t5RGHY6qI/Azs4KTXWF/wSGlfbZ72X8ZK84\n\t60ezzTRoSQml7g7BEDTXR09x/APCTGIl1EwKtmfJZ+teaAibU5WnfEUzx/5HXeV6RIYB\n\tCtUw==","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=m2dLdtJQcGafaSDyob70UocXu+U3JMZMfngsOov2NAM=;\n\tb=0c7/lLSuQ9TCJ0pJ/jeE6t1nmJsS44vjzYXYR26axGN0NmV9yQBq/23IU/mJ3X9ktt\n\t5rKaKBMHOMMqOiVCXRqyl5mAxClJYBrfvZbx0e8DxOgy3X4e/uvymQtufENiy7DlXU4V\n\tJ9t17wBIjy4pPAoKasGfE3sLZwoWRGapapmBHAdOH6/B/AQl+6C7f9OZ9o/pDpAFzoV6\n\tS0e6Wus5D5x6WBsOIRcoxdkDbFM9bZlGiijfcyXvwsyCYuzwHp09LcoacSIV+fNG6BSb\n\tBcwdTooaiEMC/5qUCG/3Y5bBN/CClysiMU5Hyq2QwW6IU3jBkTs/6TQNcqBkQ7eO3pyE\n\tfi3w==","X-Gm-Message-State":"AOAM531ThFTDVwTB0Q9CuHCLeKlp86XFJWTNgfl3NzXt8k4vqSwFaKkr\n\tSknFjfRpBFBbN8j9mm99tei9yGKEoEOx2jzgmeNe+x+jYiwscWiS","X-Google-Smtp-Source":"ABdhPJyAiRsJufIPxs5SdFo2r2n2GIK2Ar7oEDdy5u5Rc1YdUbmRDmFEHNF33vvgMu1HM7rSuTijegWFHlzg0u0srvU=","X-Received":"by 2002:a25:ba0e:: with SMTP id\n\tt14mr11991903ybg.49.1638268940906; \n\tTue, 30 Nov 2021 02:42:20 -0800 (PST)","MIME-Version":"1.0","References":"<20211130085830.1529550-1-vedantparanjape160201@gmail.com>\n\t<YaXt5HFFz5CGqE9d@pendragon.ideasonboard.com>\n\t<CACGrz-M9GbRH7eye=FUsDW2Qk1wEUPeU2P7J0S_4hSCy4Qem_Q@mail.gmail.com>\n\t<20211130102839.GC3297112@pyrite.rasen.tech>\n\t<YaX+EIVDLgSKlSop@pendragon.ideasonboard.com>","In-Reply-To":"<YaX+EIVDLgSKlSop@pendragon.ideasonboard.com>","From":"Vedant Paranjape <vedantparanjape160201@gmail.com>","Date":"Tue, 30 Nov 2021 16:12:09 +0530","Message-ID":"<CACGrz-Ptw_EAhf=kjKEWtJsgHnHArav8zzjmF=XcaqUu2UQ13g@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [PATCH v2] v4l2: V4L2CameraProxy: Add support\n\tfor DMABUF buffer I/O in REQBUF ioctl","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 <libcamera-devel@lists.libcamera.org>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]