Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 76720
b: refs/heads/master
c: d05051c
h: refs/heads/master
v: v3
  • Loading branch information
Mauro Carvalho Chehab committed Jan 25, 2008
1 parent 4af0acd commit 38a1406
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c6243d9c3de82e46467c88898db45ca14b6843a0
refs/heads/master: d05051c82e0e8ff748e9c9a06a061bda3ad656e5
15 changes: 11 additions & 4 deletions trunk/drivers/media/video/videobuf-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,15 @@ int videobuf_iolock(struct videobuf_queue *q, struct videobuf_buffer *vb,
MAGIC_CHECK(vb->magic, MAGIC_BUFFER);
MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);

/* FIXME: This is required to avoid OOPS on some cases,
/* This is required to avoid OOPS on some cases,
since mmap_mapper() method should be called before _iolock.
On some cases, the mmap_mapper() is called only after scheduling.
However, this way is just too dirty! Better to wait for some event.
*/
schedule_timeout(HZ);
wait_event_timeout(vb->done, q->is_mmapped, msecs_to_jiffies(100));
if (!q->is_mmapped) {
printk(KERN_ERR "Error: mmap_mapper() never called!\n");
return -EINVAL;
}

return CALL(q, iolock, q, vb, fbuf);
}
Expand Down Expand Up @@ -300,7 +302,11 @@ static int __videobuf_mmap_free(struct videobuf_queue *q)

MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS);


rc = CALL(q, mmap_free, q);

q->is_mmapped = 0;

if (rc < 0)
return rc;

Expand Down Expand Up @@ -1022,6 +1028,7 @@ int videobuf_mmap_mapper(struct videobuf_queue *q,

mutex_lock(&q->lock);
retval = CALL(q, mmap_mapper, q, vma);
q->is_mmapped = 1;
mutex_unlock(&q->lock);

return retval;
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/media/videobuf-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ struct videobuf_queue {

unsigned int streaming:1;
unsigned int reading:1;
unsigned int is_mmapped:1;

/* capture via mmap() + ioctl(QBUF/DQBUF) */
struct list_head stream;

Expand Down

0 comments on commit 38a1406

Please sign in to comment.