| Message ID | 20261021090209.825057-1-ragaprasanth@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series |
|
| Related | show |
Quoting Prasanth R (2026-10-21 10:02:09) > Commit b5225f00cde0 added VIDIOC_PREPARE_BUF to the supported ioctls, > but did not add it to the switch case. Add the missing case. > > Also set V4L2_BUF_FLAG_PREPARED in QBUF and clear it in STREAMOFF, as > videobuf2 does, so a buffer can be prepared again after STREAMOFF. > > Fixes: b5225f00cde0 ("v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl") > Signed-off-by: Prasanth R <ragaprasanth@gmail.com> There's nothing that can automatically carry tags which are already given when you repost, so usually please try to add any tags you have on a patch for resending. Re-adding: Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> > --- > Tested on a Raspberry Pi 4 with a UVC webcam - preparing a buffer again > after STREAMOFF failed with EINVAL in v1 and works in v3. > > src/v4l2/v4l2_camera_proxy.cpp | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp > index 7f8522d5e..d1f3ac7df 100644 > --- a/src/v4l2/v4l2_camera_proxy.cpp > +++ b/src/v4l2/v4l2_camera_proxy.cpp > @@ -708,7 +708,8 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg) > if (ret < 0) > return ret; > > - buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED; > + buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED | > + V4L2_BUF_FLAG_PREPARED; > > arg->flags = buffers_[arg->index].flags; > > @@ -835,7 +836,8 @@ int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg) > int ret = vcam_->streamOff(); > > for (struct v4l2_buffer &buf : buffers_) > - buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE); > + buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE | > + V4L2_BUF_FLAG_PREPARED); > > return ret; > } > @@ -997,6 +999,9 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long longRequest, void > case VIDIOC_QUERYBUF: > ret = vidioc_querybuf(file, static_cast<struct v4l2_buffer *>(arg)); > break; > + case VIDIOC_PREPARE_BUF: > + ret = vidioc_prepare_buf(file, static_cast<struct v4l2_buffer *>(arg)); > + break; > case VIDIOC_QBUF: > ret = vidioc_qbuf(file, static_cast<struct v4l2_buffer *>(arg)); > break; > -- > 2.34.1 >
diff --git a/src/v4l2/v4l2_camera_proxy.cpp b/src/v4l2/v4l2_camera_proxy.cpp index 7f8522d5e..d1f3ac7df 100644 --- a/src/v4l2/v4l2_camera_proxy.cpp +++ b/src/v4l2/v4l2_camera_proxy.cpp @@ -708,7 +708,8 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg) if (ret < 0) return ret; - buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED; + buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED | + V4L2_BUF_FLAG_PREPARED; arg->flags = buffers_[arg->index].flags; @@ -835,7 +836,8 @@ int V4L2CameraProxy::vidioc_streamoff(V4L2CameraFile *file, int *arg) int ret = vcam_->streamOff(); for (struct v4l2_buffer &buf : buffers_) - buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE); + buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE | + V4L2_BUF_FLAG_PREPARED); return ret; } @@ -997,6 +999,9 @@ int V4L2CameraProxy::ioctl(V4L2CameraFile *file, unsigned long longRequest, void case VIDIOC_QUERYBUF: ret = vidioc_querybuf(file, static_cast<struct v4l2_buffer *>(arg)); break; + case VIDIOC_PREPARE_BUF: + ret = vidioc_prepare_buf(file, static_cast<struct v4l2_buffer *>(arg)); + break; case VIDIOC_QBUF: ret = vidioc_qbuf(file, static_cast<struct v4l2_buffer *>(arg)); break;
Commit b5225f00cde0 added VIDIOC_PREPARE_BUF to the supported ioctls, but did not add it to the switch case. Add the missing case. Also set V4L2_BUF_FLAG_PREPARED in QBUF and clear it in STREAMOFF, as videobuf2 does, so a buffer can be prepared again after STREAMOFF. Fixes: b5225f00cde0 ("v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl") Signed-off-by: Prasanth R <ragaprasanth@gmail.com> --- Tested on a Raspberry Pi 4 with a UVC webcam - preparing a buffer again after STREAMOFF failed with EINVAL in v1 and works in v3. src/v4l2/v4l2_camera_proxy.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)