[{"id":19282,"web_url":"https://patchwork.libcamera.org/comment/19282/","msgid":"<822cd24b-2920-bdff-f029-9e8013108b63@ideasonboard.com>","date":"2021-09-02T10:42:24","subject":"Re: [libcamera-devel] [RFC PATCH v1 12/12] libcamera:\n\tv4l2_videodevice: Use utils::enumerate()","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"On 02/09/2021 05:23, Laurent Pinchart wrote:\n> Replace a manual counter with the utils::enumerate() utility function.\n> \n> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> ---\n>  src/libcamera/v4l2_videodevice.cpp | 11 +++++------\n>  1 file changed, 5 insertions(+), 6 deletions(-)\n> \n> diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> index b80b9038a914..8a7d847c060e 100644\n> --- a/src/libcamera/v4l2_videodevice.cpp\n> +++ b/src/libcamera/v4l2_videodevice.cpp\n> @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)\n>  \t\tplanes.resize(formatInfo_->numPlanes());\n>  \t\tconst FileDescriptor &fd = planes[0].fd;\n>  \t\tsize_t offset = 0;\n> -\t\tfor (size_t i = 0; i < planes.size(); ++i) {\n> -\t\t\tplanes[i].fd = fd;\n> -\t\t\tplanes[i].offset = offset;\n> -\n> +\t\tfor (auto [i, plane] : utils::enumerate(planes)) {\n> +\t\t\tplane.fd = fd;\n> +\t\t\tplane.offset = offset;\n>  \t\t\t/* \\todo Take the V4L2 stride into account */\n\nIs this todo still valid ?\n\nI don't think it's affected by this patch anyway though so:\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n\n> -\t\t\tplanes[i].length = formatInfo_->planeSize(format_.size, i);\n> -\t\t\toffset += planes[i].length;\n> +\t\t\tplane.length = formatInfo_->planeSize(format_.size, i);\n> +\t\t\toffset += plane.length;\n>  \t\t}\n>  \t}\n>  \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 4EBB2BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Sep 2021 10:42:30 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 919556916A;\n\tThu,  2 Sep 2021 12:42:29 +0200 (CEST)","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 2611A60255\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Sep 2021 12:42:28 +0200 (CEST)","from [192.168.0.20]\n\t(cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 9549645E;\n\tThu,  2 Sep 2021 12:42:27 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"LVrbvSUh\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630579347;\n\tbh=vXcVscws3mlIc53+Db1evVoOiom4EeE2ALdUFcsjzPA=;\n\th=Subject:To:References:From:Date:In-Reply-To:From;\n\tb=LVrbvSUh7PWfb7tT7TvJDUhHrtDZ74dSvIKw9QEF8vQlCCDr+DAMQIiLxePACOC5h\n\t/OpxxYl4xggKDGInNG+CNcLnGkXqtBw5sPtQOFDor0rck9LUlSPWGuhvAPbCh3G+Wj\n\tZnkgjoIYS8X6nLnRmsOdu+eFvYTOxox4hsDtSv7o=","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20210902042303.2254-1-laurent.pinchart@ideasonboard.com>\n\t<20210902042303.2254-13-laurent.pinchart@ideasonboard.com>","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<822cd24b-2920-bdff-f029-9e8013108b63@ideasonboard.com>","Date":"Thu, 2 Sep 2021 11:42:24 +0100","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101\n\tThunderbird/78.11.0","MIME-Version":"1.0","In-Reply-To":"<20210902042303.2254-13-laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=utf-8","Content-Language":"en-GB","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [RFC PATCH v1 12/12] libcamera:\n\tv4l2_videodevice: Use utils::enumerate()","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>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":19308,"web_url":"https://patchwork.libcamera.org/comment/19308/","msgid":"<YTEYyINQ0owNM+38@pendragon.ideasonboard.com>","date":"2021-09-02T18:32:40","subject":"Re: [libcamera-devel] [RFC PATCH v1 12/12] libcamera:\n\tv4l2_videodevice: Use utils::enumerate()","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nOn Thu, Sep 02, 2021 at 11:42:24AM +0100, Kieran Bingham wrote:\n> On 02/09/2021 05:23, Laurent Pinchart wrote:\n> > Replace a manual counter with the utils::enumerate() utility function.\n> > \n> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> > ---\n> >  src/libcamera/v4l2_videodevice.cpp | 11 +++++------\n> >  1 file changed, 5 insertions(+), 6 deletions(-)\n> > \n> > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > index b80b9038a914..8a7d847c060e 100644\n> > --- a/src/libcamera/v4l2_videodevice.cpp\n> > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)\n> >  \t\tplanes.resize(formatInfo_->numPlanes());\n> >  \t\tconst FileDescriptor &fd = planes[0].fd;\n> >  \t\tsize_t offset = 0;\n> > -\t\tfor (size_t i = 0; i < planes.size(); ++i) {\n> > -\t\t\tplanes[i].fd = fd;\n> > -\t\t\tplanes[i].offset = offset;\n> > -\n> > +\t\tfor (auto [i, plane] : utils::enumerate(planes)) {\n> > +\t\t\tplane.fd = fd;\n> > +\t\t\tplane.offset = offset;\n> >  \t\t\t/* \\todo Take the V4L2 stride into account */\n> \n> Is this todo still valid ?\n\nYes it is, we don't support programming a non-default stride yet.\n\n> I don't think it's affected by this patch anyway though so:\n> \n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> \n> > -\t\t\tplanes[i].length = formatInfo_->planeSize(format_.size, i);\n> > -\t\t\toffset += planes[i].length;\n> > +\t\t\tplane.length = formatInfo_->planeSize(format_.size, i);\n> > +\t\t\toffset += plane.length;\n> >  \t\t}\n> >  \t}\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 AFBF9BDC71\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  2 Sep 2021 18:32:58 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 694A46916B;\n\tThu,  2 Sep 2021 20:32:58 +0200 (CEST)","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 EB18660255\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  2 Sep 2021 20:32:56 +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 850BC45E;\n\tThu,  2 Sep 2021 20:32:56 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"RiH1Yq18\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1630607576;\n\tbh=qTlekDK8L94YEOXQ6mJN/O/X474/gjCmRqh99fXrtHc=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RiH1Yq18cB7ZbolsRkmuJq+cuZfuvituzMBVOFQJlsMp/Uq3blLc99qZxXqt5+B1L\n\tIgdV30ZjVyt6HnlI/fvQDktq33xnq5DTxbi3BRam/W4E1cX/FuFwnRcXkbtQ3V7uGi\n\tFOU6ak16imcbHUhYP/kAiUTDIec/o9Vl3RNmGeT0=","Date":"Thu, 2 Sep 2021 21:32:40 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Message-ID":"<YTEYyINQ0owNM+38@pendragon.ideasonboard.com>","References":"<20210902042303.2254-1-laurent.pinchart@ideasonboard.com>\n\t<20210902042303.2254-13-laurent.pinchart@ideasonboard.com>\n\t<822cd24b-2920-bdff-f029-9e8013108b63@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<822cd24b-2920-bdff-f029-9e8013108b63@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH v1 12/12] libcamera:\n\tv4l2_videodevice: Use utils::enumerate()","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":19370,"web_url":"https://patchwork.libcamera.org/comment/19370/","msgid":"<CAO5uPHN80Y3NuxAxfsi_QzAjSPHmVVfC0g8ZnJzqHK7fz5Hvyw@mail.gmail.com>","date":"2021-09-03T12:37:27","subject":"Re: [libcamera-devel] [RFC PATCH v1 12/12] libcamera:\n\tv4l2_videodevice: Use utils::enumerate()","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"content":"Hi Laurent,\n\nOn Fri, Sep 3, 2021 at 3:32 AM Laurent Pinchart\n<laurent.pinchart@ideasonboard.com> wrote:\n>\n> Hi Kieran,\n>\n> On Thu, Sep 02, 2021 at 11:42:24AM +0100, Kieran Bingham wrote:\n> > On 02/09/2021 05:23, Laurent Pinchart wrote:\n> > > Replace a manual counter with the utils::enumerate() utility function.\n> > >\n> > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\nReviewed-by: Hirokazu Honda <hiroh@chromium.org>\n\nThanks,\n-Hiro\n> > > ---\n> > >  src/libcamera/v4l2_videodevice.cpp | 11 +++++------\n> > >  1 file changed, 5 insertions(+), 6 deletions(-)\n> > >\n> > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp\n> > > index b80b9038a914..8a7d847c060e 100644\n> > > --- a/src/libcamera/v4l2_videodevice.cpp\n> > > +++ b/src/libcamera/v4l2_videodevice.cpp\n> > > @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index)\n> > >             planes.resize(formatInfo_->numPlanes());\n> > >             const FileDescriptor &fd = planes[0].fd;\n> > >             size_t offset = 0;\n> > > -           for (size_t i = 0; i < planes.size(); ++i) {\n> > > -                   planes[i].fd = fd;\n> > > -                   planes[i].offset = offset;\n> > > -\n> > > +           for (auto [i, plane] : utils::enumerate(planes)) {\n> > > +                   plane.fd = fd;\n> > > +                   plane.offset = offset;\n> > >                     /* \\todo Take the V4L2 stride into account */\n> >\n> > Is this todo still valid ?\n>\n> Yes it is, we don't support programming a non-default stride yet.\n>\n> > I don't think it's affected by this patch anyway though so:\n> >\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> >\n> > > -                   planes[i].length = formatInfo_->planeSize(format_.size, i);\n> > > -                   offset += planes[i].length;\n> > > +                   plane.length = formatInfo_->planeSize(format_.size, i);\n> > > +                   offset += plane.length;\n> > >             }\n> > >     }\n> > >\n>\n> --\n> Regards,\n>\n> Laurent Pinchart","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 86589BD87D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  3 Sep 2021 12:37:41 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3AEA26916A;\n\tFri,  3 Sep 2021 14:37:41 +0200 (CEST)","from mail-ej1-x636.google.com (mail-ej1-x636.google.com\n\t[IPv6:2a00:1450:4864:20::636])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 7896569167\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  3 Sep 2021 14:37:39 +0200 (CEST)","by mail-ej1-x636.google.com with SMTP id n27so11820469eja.5\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 03 Sep 2021 05:37:39 -0700 (PDT)"],"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=\"i4EPfOmd\"; 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=M9FUjv+ZEVwHv6zrnmGepOCkmbeRLLWNceQa/m1Yqu4=;\n\tb=i4EPfOmdVryOxpaRqPJRoLaLhdHvNQBcAZXoKIKhcb2Eb9zQSXm9aUyrK8UW6NblT9\n\t5btWx91yiFaiKTciPPrg0eROmGmVDXNjWkhGWB1gF9wA1yp1hZc8vTs/iJgGWWHV0TGU\n\tePHZ5/wgizmeVOBetDFZTNjpNZJHXPnN0q7q8=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:mime-version:references:in-reply-to:from:date\n\t:message-id:subject:to:cc;\n\tbh=M9FUjv+ZEVwHv6zrnmGepOCkmbeRLLWNceQa/m1Yqu4=;\n\tb=Qcj1hTWumSd/jpzYTahOFUT/WcC4xIQh/PfFjV+NBIx1jy9Vm2e5PK4lgZ1WntHLjT\n\twCS5jxTEQ08DUIJI0snb3CIBpPVSW2ktoytFX6lk03Vb+d/ap1Yh9j/ExSVQhQ8nH+uv\n\tDjKU8qAK/YKaQMaoGJzovsfbrg0d/JVSq5YTPDCdnDe6sh3j4CtE6IVbcjkCkJ7+ojxP\n\thiuKpphNABJITpje/A3sfQIsS67dbIQqKEMmFIGHNNl9hnuGSjMuZqh5/B4YKvRalr6Q\n\tVv1P1zCFTE4Jy0gaCKybqImZ63jK68Rv7OM6F6yjb59TPu15Ras4plFnjuX+RGy5jHwP\n\tqnrw==","X-Gm-Message-State":"AOAM531wVDFkWBGA/loDoNl0q1HdvomyyRw63SdfXDz/4d1ufQaAlv2V\n\tf4YMkeUyPPqPlUqU63VIUgaRwPsGm7UEFuZKn//fCQ==","X-Google-Smtp-Source":"ABdhPJxMz6WDjyWVnluZLp2zvqhzCO2IKrPGkfKtxPisjFwkySJZ4V9BNlVjYv7A5aB+XWIq3ae9CwQ0rcEo/7hAYuw=","X-Received":"by 2002:a17:906:32c9:: with SMTP id\n\tk9mr4046628ejk.218.1630672659187; \n\tFri, 03 Sep 2021 05:37:39 -0700 (PDT)","MIME-Version":"1.0","References":"<20210902042303.2254-1-laurent.pinchart@ideasonboard.com>\n\t<20210902042303.2254-13-laurent.pinchart@ideasonboard.com>\n\t<822cd24b-2920-bdff-f029-9e8013108b63@ideasonboard.com>\n\t<YTEYyINQ0owNM+38@pendragon.ideasonboard.com>","In-Reply-To":"<YTEYyINQ0owNM+38@pendragon.ideasonboard.com>","From":"Hirokazu Honda <hiroh@chromium.org>","Date":"Fri, 3 Sep 2021 21:37:27 +0900","Message-ID":"<CAO5uPHN80Y3NuxAxfsi_QzAjSPHmVVfC0g8ZnJzqHK7fz5Hvyw@mail.gmail.com>","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Content-Type":"text/plain; charset=\"UTF-8\"","Subject":"Re: [libcamera-devel] [RFC PATCH v1 12/12] libcamera:\n\tv4l2_videodevice: Use utils::enumerate()","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>"}}]