Message ID | 20210902042303.2254-13-laurent.pinchart@ideasonboard.com |
---|---|
State | Superseded |
Headers | show |
Series |
|
Related | show |
On 02/09/2021 05:23, Laurent Pinchart wrote: > Replace a manual counter with the utils::enumerate() utility function. > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > src/libcamera/v4l2_videodevice.cpp | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > index b80b9038a914..8a7d847c060e 100644 > --- a/src/libcamera/v4l2_videodevice.cpp > +++ b/src/libcamera/v4l2_videodevice.cpp > @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index) > planes.resize(formatInfo_->numPlanes()); > const FileDescriptor &fd = planes[0].fd; > size_t offset = 0; > - for (size_t i = 0; i < planes.size(); ++i) { > - planes[i].fd = fd; > - planes[i].offset = offset; > - > + for (auto [i, plane] : utils::enumerate(planes)) { > + plane.fd = fd; > + plane.offset = offset; > /* \todo Take the V4L2 stride into account */ Is this todo still valid ? I don't think it's affected by this patch anyway though so: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > - planes[i].length = formatInfo_->planeSize(format_.size, i); > - offset += planes[i].length; > + plane.length = formatInfo_->planeSize(format_.size, i); > + offset += plane.length; > } > } > >
Hi Kieran, On Thu, Sep 02, 2021 at 11:42:24AM +0100, Kieran Bingham wrote: > On 02/09/2021 05:23, Laurent Pinchart wrote: > > Replace a manual counter with the utils::enumerate() utility function. > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > --- > > src/libcamera/v4l2_videodevice.cpp | 11 +++++------ > > 1 file changed, 5 insertions(+), 6 deletions(-) > > > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > > index b80b9038a914..8a7d847c060e 100644 > > --- a/src/libcamera/v4l2_videodevice.cpp > > +++ b/src/libcamera/v4l2_videodevice.cpp > > @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index) > > planes.resize(formatInfo_->numPlanes()); > > const FileDescriptor &fd = planes[0].fd; > > size_t offset = 0; > > - for (size_t i = 0; i < planes.size(); ++i) { > > - planes[i].fd = fd; > > - planes[i].offset = offset; > > - > > + for (auto [i, plane] : utils::enumerate(planes)) { > > + plane.fd = fd; > > + plane.offset = offset; > > /* \todo Take the V4L2 stride into account */ > > Is this todo still valid ? Yes it is, we don't support programming a non-default stride yet. > I don't think it's affected by this patch anyway though so: > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > - planes[i].length = formatInfo_->planeSize(format_.size, i); > > - offset += planes[i].length; > > + plane.length = formatInfo_->planeSize(format_.size, i); > > + offset += plane.length; > > } > > } > >
Hi Laurent, On Fri, Sep 3, 2021 at 3:32 AM Laurent Pinchart <laurent.pinchart@ideasonboard.com> wrote: > > Hi Kieran, > > On Thu, Sep 02, 2021 at 11:42:24AM +0100, Kieran Bingham wrote: > > On 02/09/2021 05:23, Laurent Pinchart wrote: > > > Replace a manual counter with the utils::enumerate() utility function. > > > > > > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Thanks, -Hiro > > > --- > > > src/libcamera/v4l2_videodevice.cpp | 11 +++++------ > > > 1 file changed, 5 insertions(+), 6 deletions(-) > > > > > > diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp > > > index b80b9038a914..8a7d847c060e 100644 > > > --- a/src/libcamera/v4l2_videodevice.cpp > > > +++ b/src/libcamera/v4l2_videodevice.cpp > > > @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index) > > > planes.resize(formatInfo_->numPlanes()); > > > const FileDescriptor &fd = planes[0].fd; > > > size_t offset = 0; > > > - for (size_t i = 0; i < planes.size(); ++i) { > > > - planes[i].fd = fd; > > > - planes[i].offset = offset; > > > - > > > + for (auto [i, plane] : utils::enumerate(planes)) { > > > + plane.fd = fd; > > > + plane.offset = offset; > > > /* \todo Take the V4L2 stride into account */ > > > > Is this todo still valid ? > > Yes it is, we don't support programming a non-default stride yet. > > > I don't think it's affected by this patch anyway though so: > > > > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > > > > > - planes[i].length = formatInfo_->planeSize(format_.size, i); > > > - offset += planes[i].length; > > > + plane.length = formatInfo_->planeSize(format_.size, i); > > > + offset += plane.length; > > > } > > > } > > > > > -- > Regards, > > Laurent Pinchart
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index b80b9038a914..8a7d847c060e 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1338,13 +1338,12 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index) planes.resize(formatInfo_->numPlanes()); const FileDescriptor &fd = planes[0].fd; size_t offset = 0; - for (size_t i = 0; i < planes.size(); ++i) { - planes[i].fd = fd; - planes[i].offset = offset; - + for (auto [i, plane] : utils::enumerate(planes)) { + plane.fd = fd; + plane.offset = offset; /* \todo Take the V4L2 stride into account */ - planes[i].length = formatInfo_->planeSize(format_.size, i); - offset += planes[i].length; + plane.length = formatInfo_->planeSize(format_.size, i); + offset += plane.length; } }
Replace a manual counter with the utils::enumerate() utility function. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- src/libcamera/v4l2_videodevice.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)