media: videobuf2-v4l2: integrate with media requests
This implements the V4L2 part of the request support. The main change is that vb2_qbuf and vb2_prepare_buf now have a new media_device pointer. This required changes to several drivers that did not use the vb2_ioctl_qbuf/prepare_buf helper functions. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:

committed by
Mauro Carvalho Chehab

parent
fd89e0bb6e
commit
394dc58880
@@ -32,6 +32,7 @@
|
||||
* &enum v4l2_field.
|
||||
* @timecode: frame timecode.
|
||||
* @sequence: sequence count of this frame.
|
||||
* @request_fd: the request_fd associated with this buffer
|
||||
* @planes: plane information (userptr/fd, length, bytesused, data_offset).
|
||||
*
|
||||
* Should contain enough information to be able to cover all the fields
|
||||
@@ -44,6 +45,7 @@ struct vb2_v4l2_buffer {
|
||||
__u32 field;
|
||||
struct v4l2_timecode timecode;
|
||||
__u32 sequence;
|
||||
__s32 request_fd;
|
||||
struct vb2_plane planes[VB2_MAX_PLANES];
|
||||
};
|
||||
|
||||
@@ -79,6 +81,7 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
|
||||
* vb2_prepare_buf() - Pass ownership of a buffer from userspace to the kernel
|
||||
*
|
||||
* @q: pointer to &struct vb2_queue with videobuf2 queue.
|
||||
* @mdev: pointer to &struct media_device, may be NULL.
|
||||
* @b: buffer structure passed from userspace to
|
||||
* &v4l2_ioctl_ops->vidioc_prepare_buf handler in driver
|
||||
*
|
||||
@@ -90,15 +93,19 @@ int vb2_create_bufs(struct vb2_queue *q, struct v4l2_create_buffers *create);
|
||||
* #) verifies the passed buffer,
|
||||
* #) calls &vb2_ops->buf_prepare callback in the driver (if provided),
|
||||
* in which driver-specific buffer initialization can be performed.
|
||||
* #) if @b->request_fd is non-zero and @mdev->ops->req_queue is set,
|
||||
* then bind the prepared buffer to the request.
|
||||
*
|
||||
* The return values from this function are intended to be directly returned
|
||||
* from &v4l2_ioctl_ops->vidioc_prepare_buf handler in driver.
|
||||
*/
|
||||
int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
|
||||
int vb2_prepare_buf(struct vb2_queue *q, struct media_device *mdev,
|
||||
struct v4l2_buffer *b);
|
||||
|
||||
/**
|
||||
* vb2_qbuf() - Queue a buffer from userspace
|
||||
* @q: pointer to &struct vb2_queue with videobuf2 queue.
|
||||
* @mdev: pointer to &struct media_device, may be NULL.
|
||||
* @b: buffer structure passed from userspace to
|
||||
* &v4l2_ioctl_ops->vidioc_qbuf handler in driver
|
||||
*
|
||||
@@ -107,6 +114,8 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
|
||||
* This function:
|
||||
*
|
||||
* #) verifies the passed buffer;
|
||||
* #) if @b->request_fd is non-zero and @mdev->ops->req_queue is set,
|
||||
* then bind the buffer to the request.
|
||||
* #) if necessary, calls &vb2_ops->buf_prepare callback in the driver
|
||||
* (if provided), in which driver-specific buffer initialization can
|
||||
* be performed;
|
||||
@@ -116,7 +125,8 @@ int vb2_prepare_buf(struct vb2_queue *q, struct v4l2_buffer *b);
|
||||
* The return values from this function are intended to be directly returned
|
||||
* from &v4l2_ioctl_ops->vidioc_qbuf handler in driver.
|
||||
*/
|
||||
int vb2_qbuf(struct vb2_queue *q, struct v4l2_buffer *b);
|
||||
int vb2_qbuf(struct vb2_queue *q, struct media_device *mdev,
|
||||
struct v4l2_buffer *b);
|
||||
|
||||
/**
|
||||
* vb2_expbuf() - Export a buffer as a file descriptor
|
||||
|
Reference in New Issue
Block a user