[v2] v4l2: v4l2_camera_proxy: Dispatch VIDIOC_PREPARE_BUF
diff mbox series

Message ID 20261020052333.123580-1-ragaprasanth@gmail.com
State New
Headers show
Series
  • [v2] v4l2: v4l2_camera_proxy: Dispatch VIDIOC_PREPARE_BUF
Related show

Commit Message

Prasanth R Oct. 20, 2026, 5:23 a.m. UTC
Commit b5225f00cde0 added VIDIOC_PREPARE_BUF to the supported ioctls,
but did not add it to the switch case. Add the missing case.

Fixes: b5225f00cde0 ("v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl")
Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
---
 src/v4l2/v4l2_camera_proxy.cpp | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Barnabás Pőcze Oct. 20, 2026, 7:48 a.m. UTC | #1
Hi

2026. 10. 20. 7:23 keltezéssel, Prasanth R írta:
> Commit b5225f00cde0 added VIDIOC_PREPARE_BUF to the supported ioctls,
> but did not add it to the switch case. Add the missing case.
> 
> Fixes: b5225f00cde0 ("v4l2: V4L2CameraProxy: Add support for PREPARE_BUF as one of the supported ioctl")
> Signed-off-by: Prasanth R <prasanth.r@lineo.co.jp>
> ---
>   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;
>   }

The above ones are new and significantly "distinct" changes compared to the previous version.
It would be good to mention them in a small changelog, but more importantly, to mention them
in the commit message, which currently lacks any reference to those. What is the motivation
for these changes?


> @@ -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

Patch
diff mbox series

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;