Commit e6f32f39 authored by Gerd Knorr's avatar Gerd Knorr Committed by Linus Torvalds

[PATCH] v4l: update video-buf for per-frame input switching.

This patch updates the video-buf module to support the per-frame input
switching added by the v4l2 API patch.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent cc843d2e
...@@ -491,6 +491,11 @@ videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, ...@@ -491,6 +491,11 @@ videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
break; break;
} }
if (vb->input != UNSET) {
b->flags |= V4L2_BUF_FLAG_INPUT;
b->input = vb->input;
}
b->field = vb->field; b->field = vb->field;
b->timestamp = vb->ts; b->timestamp = vb->ts;
b->bytesused = vb->size; b->bytesused = vb->size;
...@@ -574,6 +579,14 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q, ...@@ -574,6 +579,14 @@ videobuf_qbuf(struct file *file, struct videobuf_queue *q,
buf->state == STATE_ACTIVE) buf->state == STATE_ACTIVE)
goto done; goto done;
if (b->flags & V4L2_BUF_FLAG_INPUT) {
if (b->input >= q->inputs)
goto done;
buf->input = b->input;
} else {
buf->input = UNSET;
}
switch (b->memory) { switch (b->memory) {
case V4L2_MEMORY_MMAP: case V4L2_MEMORY_MMAP:
if (0 == buf->baddr) if (0 == buf->baddr)
...@@ -1075,6 +1088,7 @@ int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q, ...@@ -1075,6 +1088,7 @@ int videobuf_mmap_setup(struct file *file, struct videobuf_queue *q,
for (i = 0; i < bcount; i++) { for (i = 0; i < bcount; i++) {
q->bufs[i] = videobuf_alloc(q->msize); q->bufs[i] = videobuf_alloc(q->msize);
q->bufs[i]->i = i; q->bufs[i]->i = i;
q->bufs[i]->input = UNSET;
q->bufs[i]->memory = memory; q->bufs[i]->memory = memory;
q->bufs[i]->bsize = bsize; q->bufs[i]->bsize = bsize;
switch (memory) { switch (memory) {
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include <linux/videodev.h> #include <linux/videodev.h>
#define UNSET (-1U)
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* /*
...@@ -140,6 +142,7 @@ struct videobuf_buffer { ...@@ -140,6 +142,7 @@ struct videobuf_buffer {
unsigned int height; unsigned int height;
unsigned int bytesperline; /* use only if != 0 */ unsigned int bytesperline; /* use only if != 0 */
unsigned long size; unsigned long size;
unsigned int input;
enum v4l2_field field; enum v4l2_field field;
enum videobuf_state state; enum videobuf_state state;
struct videobuf_dmabuf dma; struct videobuf_dmabuf dma;
...@@ -174,9 +177,10 @@ struct videobuf_queue { ...@@ -174,9 +177,10 @@ struct videobuf_queue {
struct pci_dev *pci; struct pci_dev *pci;
enum v4l2_buf_type type; enum v4l2_buf_type type;
unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */
unsigned int msize; unsigned int msize;
enum v4l2_field field; enum v4l2_field field;
enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */ enum v4l2_field last; /* for field=V4L2_FIELD_ALTERNATE */
struct videobuf_buffer *bufs[VIDEO_MAX_FRAME]; struct videobuf_buffer *bufs[VIDEO_MAX_FRAME];
struct videobuf_queue_ops *ops; struct videobuf_queue_ops *ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment