diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-07-18 09:53:04 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-07-30 18:20:00 -0400 |
commit | 08eb85100d114a907e01c76d52d5c95eb4100d20 (patch) | |
tree | 0571fce8026edbb5b3b4a81d2896c819513fa5b5 /drivers/media | |
parent | b0d1499634503ea8947cd8694ada01b263f25ec4 (diff) |
[media] v4l2-mem2mem: support events in v4l2_m2m_poll
v4l2_m2m_poll didn't support events, but that's essential if you want to
be able to use control events for example.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/v4l2-mem2mem.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/media/video/v4l2-mem2mem.c b/drivers/media/video/v4l2-mem2mem.c index 975d0fa938c6..97b48318aee1 100644 --- a/drivers/media/video/v4l2-mem2mem.c +++ b/drivers/media/video/v4l2-mem2mem.c | |||
@@ -19,6 +19,9 @@ | |||
19 | 19 | ||
20 | #include <media/videobuf2-core.h> | 20 | #include <media/videobuf2-core.h> |
21 | #include <media/v4l2-mem2mem.h> | 21 | #include <media/v4l2-mem2mem.h> |
22 | #include <media/v4l2-dev.h> | ||
23 | #include <media/v4l2-fh.h> | ||
24 | #include <media/v4l2-event.h> | ||
22 | 25 | ||
23 | MODULE_DESCRIPTION("Mem to mem device framework for videobuf"); | 26 | MODULE_DESCRIPTION("Mem to mem device framework for videobuf"); |
24 | MODULE_AUTHOR("Pawel Osciak, <pawel@osciak.com>"); | 27 | MODULE_AUTHOR("Pawel Osciak, <pawel@osciak.com>"); |
@@ -407,11 +410,24 @@ EXPORT_SYMBOL_GPL(v4l2_m2m_streamoff); | |||
407 | unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | 410 | unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, |
408 | struct poll_table_struct *wait) | 411 | struct poll_table_struct *wait) |
409 | { | 412 | { |
413 | struct video_device *vfd = video_devdata(file); | ||
414 | unsigned long req_events = poll_requested_events(wait); | ||
410 | struct vb2_queue *src_q, *dst_q; | 415 | struct vb2_queue *src_q, *dst_q; |
411 | struct vb2_buffer *src_vb = NULL, *dst_vb = NULL; | 416 | struct vb2_buffer *src_vb = NULL, *dst_vb = NULL; |
412 | unsigned int rc = 0; | 417 | unsigned int rc = 0; |
413 | unsigned long flags; | 418 | unsigned long flags; |
414 | 419 | ||
420 | if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { | ||
421 | struct v4l2_fh *fh = file->private_data; | ||
422 | |||
423 | if (v4l2_event_pending(fh)) | ||
424 | rc = POLLPRI; | ||
425 | else if (req_events & POLLPRI) | ||
426 | poll_wait(file, &fh->wait, wait); | ||
427 | if (!(req_events & (POLLOUT | POLLWRNORM | POLLIN | POLLRDNORM))) | ||
428 | return rc; | ||
429 | } | ||
430 | |||
415 | src_q = v4l2_m2m_get_src_vq(m2m_ctx); | 431 | src_q = v4l2_m2m_get_src_vq(m2m_ctx); |
416 | dst_q = v4l2_m2m_get_dst_vq(m2m_ctx); | 432 | dst_q = v4l2_m2m_get_dst_vq(m2m_ctx); |
417 | 433 | ||
@@ -422,7 +438,7 @@ unsigned int v4l2_m2m_poll(struct file *file, struct v4l2_m2m_ctx *m2m_ctx, | |||
422 | */ | 438 | */ |
423 | if ((!src_q->streaming || list_empty(&src_q->queued_list)) | 439 | if ((!src_q->streaming || list_empty(&src_q->queued_list)) |
424 | && (!dst_q->streaming || list_empty(&dst_q->queued_list))) { | 440 | && (!dst_q->streaming || list_empty(&dst_q->queued_list))) { |
425 | rc = POLLERR; | 441 | rc |= POLLERR; |
426 | goto end; | 442 | goto end; |
427 | } | 443 | } |
428 | 444 | ||