From 394dc588809158826e2877adb670391829f91c63 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Wed, 30 May 2018 02:46:22 -0400 Subject: 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 Reviewed-by: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/videobuf2/videobuf2-core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'drivers/media/common/videobuf2/videobuf2-core.c') diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index a6f4e9ac77b0..16c9a08192cf 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -1338,6 +1338,14 @@ static void vb2_req_queue(struct media_request_object *obj) mutex_unlock(vb->vb2_queue->lock); } +static void vb2_req_unbind(struct media_request_object *obj) +{ + struct vb2_buffer *vb = container_of(obj, struct vb2_buffer, req_obj); + + if (vb->state == VB2_BUF_STATE_IN_REQUEST) + call_void_bufop(vb->vb2_queue, init_buffer, vb); +} + static void vb2_req_release(struct media_request_object *obj) { struct vb2_buffer *vb = container_of(obj, struct vb2_buffer, req_obj); @@ -1350,6 +1358,7 @@ static const struct media_request_object_ops vb2_core_req_ops = { .prepare = vb2_req_prepare, .unprepare = vb2_req_unprepare, .queue = vb2_req_queue, + .unbind = vb2_req_unbind, .release = vb2_req_release, }; @@ -1481,8 +1490,10 @@ int vb2_core_qbuf(struct vb2_queue *q, unsigned int index, void *pb, vb->state = VB2_BUF_STATE_IN_REQUEST; /* Fill buffer information for the userspace */ - if (pb) + if (pb) { + call_void_bufop(q, copy_timestamp, vb, pb); call_void_bufop(q, fill_user_buffer, vb, pb); + } dprintk(2, "qbuf of buffer %d succeeded\n", vb->index); return 0; -- cgit v1.2.3-55-g7522