summaryrefslogtreecommitdiffstats
path: root/drivers/media/common/videobuf2/videobuf2-core.c
diff options
context:
space:
mode:
authorHans Verkuil2018-05-30 08:46:22 +0200
committerMauro Carvalho Chehab2018-08-31 17:19:30 +0200
commit394dc588809158826e2877adb670391829f91c63 (patch)
tree0d8efd884d299507f54d857640cb5ebfa8c72d23 /drivers/media/common/videobuf2/videobuf2-core.c
parentmedia: videobuf2-core: integrate with media requests (diff)
downloadkernel-qcow2-linux-394dc588809158826e2877adb670391829f91c63.tar.gz
kernel-qcow2-linux-394dc588809158826e2877adb670391829f91c63.tar.xz
kernel-qcow2-linux-394dc588809158826e2877adb670391829f91c63.zip
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>
Diffstat (limited to 'drivers/media/common/videobuf2/videobuf2-core.c')
-rw-r--r--drivers/media/common/videobuf2/videobuf2-core.c13
1 files changed, 12 insertions, 1 deletions
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;