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

[PATCH] v4l: yet another video-buf interface update

This is one more interface fix for the video-buf.c module, the first
attempt on that wasn't that clever.  Instead of passing the driver private
data through all function calls I've just made that an element of the
videobuf_queue struct which is passed around everythere _anyway_.

That removes some reduncancy, should be less error prone and gain me some
points on rusty's interface design scala ;)

It also fixes the tvtime crashes which where caused by overviewing one
place to fixup in the first attempt.
Signed-off-by: default avatarGerd Knorr <kraxel@bytesex.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bb97b2d9
This diff is collapsed.
/* /*
* $Id: video-buf.h,v 1.8 2004/10/13 10:39:00 kraxel Exp $ * $Id: video-buf.h,v 1.9 2004/11/07 13:17:15 kraxel Exp $
* *
* generic helper functions for video4linux capture buffers, to handle * generic helper functions for video4linux capture buffers, to handle
* memory management and PCI DMA. Right now bttv + saa7134 use it. * memory management and PCI DMA. Right now bttv + saa7134 use it.
...@@ -121,7 +121,6 @@ struct videobuf_queue; ...@@ -121,7 +121,6 @@ struct videobuf_queue;
struct videobuf_mapping { struct videobuf_mapping {
unsigned int count; unsigned int count;
int highmem_ok;
unsigned long start; unsigned long start;
unsigned long end; unsigned long end;
struct videobuf_queue *q; struct videobuf_queue *q;
...@@ -167,12 +166,15 @@ struct videobuf_buffer { ...@@ -167,12 +166,15 @@ struct videobuf_buffer {
}; };
struct videobuf_queue_ops { struct videobuf_queue_ops {
int (*buf_setup)(void *priv, int (*buf_setup)(struct videobuf_queue *q,
unsigned int *count, unsigned int *size); unsigned int *count, unsigned int *size);
int (*buf_prepare)(void *priv,struct videobuf_buffer *vb, int (*buf_prepare)(struct videobuf_queue *q,
struct videobuf_buffer *vb,
enum v4l2_field field); enum v4l2_field field);
void (*buf_queue)(void *priv,struct videobuf_buffer *vb); void (*buf_queue)(struct videobuf_queue *q,
void (*buf_release)(void *priv,struct videobuf_buffer *vb); struct videobuf_buffer *vb);
void (*buf_release)(struct videobuf_queue *q,
struct videobuf_buffer *vb);
}; };
struct videobuf_queue { struct videobuf_queue {
...@@ -196,6 +198,9 @@ struct videobuf_queue { ...@@ -196,6 +198,9 @@ struct videobuf_queue {
unsigned int reading; unsigned int reading;
unsigned int read_off; unsigned int read_off;
struct videobuf_buffer *read_buf; struct videobuf_buffer *read_buf;
/* driver private data */
void *priv_data;
}; };
void* videobuf_alloc(unsigned int size); void* videobuf_alloc(unsigned int size);
...@@ -205,44 +210,46 @@ int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, ...@@ -205,44 +210,46 @@ int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb,
void videobuf_queue_init(struct videobuf_queue *q, void videobuf_queue_init(struct videobuf_queue *q,
struct videobuf_queue_ops *ops, struct videobuf_queue_ops *ops,
struct pci_dev *pci, spinlock_t *irqlock, struct pci_dev *pci,
spinlock_t *irqlock,
enum v4l2_buf_type type, enum v4l2_buf_type type,
enum v4l2_field field, enum v4l2_field field,
unsigned int msize); unsigned int msize,
void *priv);
int videobuf_queue_is_busy(struct videobuf_queue *q); int videobuf_queue_is_busy(struct videobuf_queue *q);
void videobuf_queue_cancel(void *priv, struct videobuf_queue *q); void videobuf_queue_cancel(struct videobuf_queue *q);
enum v4l2_field videobuf_next_field(struct videobuf_queue *q); enum v4l2_field videobuf_next_field(struct videobuf_queue *q);
void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb, void videobuf_status(struct v4l2_buffer *b, struct videobuf_buffer *vb,
enum v4l2_buf_type type); enum v4l2_buf_type type);
int videobuf_reqbufs(void *priv, struct videobuf_queue *q, int videobuf_reqbufs(struct videobuf_queue *q,
struct v4l2_requestbuffers *req); struct v4l2_requestbuffers *req);
int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b); int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b);
int videobuf_qbuf(void *priv, struct videobuf_queue *q, int videobuf_qbuf(struct videobuf_queue *q,
struct v4l2_buffer *b); struct v4l2_buffer *b);
int videobuf_dqbuf(void *priv, struct videobuf_queue *q, int videobuf_dqbuf(struct videobuf_queue *q,
struct v4l2_buffer *b, int nonblocking); struct v4l2_buffer *b, int nonblocking);
int videobuf_streamon(void *priv, struct videobuf_queue *q); int videobuf_streamon(struct videobuf_queue *q);
int videobuf_streamoff(void *priv, struct videobuf_queue *q); int videobuf_streamoff(struct videobuf_queue *q);
int videobuf_read_start(void *priv, struct videobuf_queue *q); int videobuf_read_start(struct videobuf_queue *q);
void videobuf_read_stop(void *priv, struct videobuf_queue *q); void videobuf_read_stop(struct videobuf_queue *q);
ssize_t videobuf_read_stream(void *priv, struct videobuf_queue *q, ssize_t videobuf_read_stream(struct videobuf_queue *q,
char __user *data, size_t count, loff_t *ppos, char __user *data, size_t count, loff_t *ppos,
int vbihack, int nonblocking); int vbihack, int nonblocking);
ssize_t videobuf_read_one(void *priv, struct videobuf_queue *q, ssize_t videobuf_read_one(struct videobuf_queue *q,
char __user *data, size_t count, loff_t *ppos, char __user *data, size_t count, loff_t *ppos,
int nonblocking); int nonblocking);
unsigned int videobuf_poll_stream(struct file *file, void *priv, unsigned int videobuf_poll_stream(struct file *file,
struct videobuf_queue *q, struct videobuf_queue *q,
poll_table *wait); poll_table *wait);
int videobuf_mmap_setup(void *priv, struct videobuf_queue *q, int videobuf_mmap_setup(struct videobuf_queue *q,
unsigned int bcount, unsigned int bsize, unsigned int bcount, unsigned int bsize,
enum v4l2_memory memory); enum v4l2_memory memory);
int videobuf_mmap_free(void *priv, struct videobuf_queue *q); int videobuf_mmap_free(struct videobuf_queue *q);
int videobuf_mmap_mapper(struct vm_area_struct *vma, int videobuf_mmap_mapper(struct videobuf_queue *q,
struct videobuf_queue *q); struct vm_area_struct *vma);
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
......
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