v4l2: v4l2_camera_proxy: Fix buffer flags related to queueing
Fix buffer flags related to queueing and dequeueing: - don't allow a buffer with the same index that is already in the queue to be enqueued again - don't clear the done flag upon qbuf - do clear the done flag upon dqbuf - set the flags in V4L2CameraProxy's internal buffers, and not just in the buffers returned from qbuf Signed-off-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
3f01ccf24b
commit
12fa2fe020
1 changed files with 7 additions and 3 deletions
|
@ -565,6 +565,9 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)
|
||||||
if (arg->index >= bufferCount_)
|
if (arg->index >= bufferCount_)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
if (buffers_[arg->index].flags & V4L2_BUF_FLAG_QUEUED)
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
if (!hasOwnership(file))
|
if (!hasOwnership(file))
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
|
|
||||||
|
@ -577,8 +580,9 @@ int V4L2CameraProxy::vidioc_qbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
arg->flags |= V4L2_BUF_FLAG_QUEUED;
|
buffers_[arg->index].flags |= V4L2_BUF_FLAG_QUEUED;
|
||||||
arg->flags &= ~V4L2_BUF_FLAG_DONE;
|
|
||||||
|
arg->flags = buffers_[arg->index].flags;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -616,7 +620,7 @@ int V4L2CameraProxy::vidioc_dqbuf(V4L2CameraFile *file, struct v4l2_buffer *arg)
|
||||||
|
|
||||||
struct v4l2_buffer &buf = buffers_[currentBuf_];
|
struct v4l2_buffer &buf = buffers_[currentBuf_];
|
||||||
|
|
||||||
buf.flags &= ~V4L2_BUF_FLAG_QUEUED;
|
buf.flags &= ~(V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE);
|
||||||
buf.length = sizeimage_;
|
buf.length = sizeimage_;
|
||||||
*arg = buf;
|
*arg = buf;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue