X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Fmedia%2Fvideo-buf.h;h=8ecfd78e00276abcc8567c9a5fed40c472f3bb68;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=fff3fd0fbf94056248c1921a0fc057512b7b7c26;hpb=9464c7cf61b9433057924c36e6e02f303a00e768;p=linux-2.6.git diff --git a/include/media/video-buf.h b/include/media/video-buf.h index fff3fd0fb..8ecfd78e0 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h @@ -1,20 +1,15 @@ /* * * generic helper functions for video4linux capture buffers, to handle - * memory management and PCI DMA. - * Right now, bttv, saa7134, saa7146 and cx88 use it. + * memory management and PCI DMA. Right now bttv + saa7134 use it. * * The functions expect the hardware being able to scatter gatter * (i.e. the buffers are not linear in physical memory, but fragmented * into PAGE_SIZE chunks). They also assume the driver does not need - * to touch the video data. - * - * device specific map/unmap/sync stuff now are mapped as file operations - * to allow its usage by USB and virtual devices. + * to touch the video data (thus it is probably not useful for USB as + * data often must be uncompressed by the drivers). * * (c) 2001,02 Gerd Knorr - * (c) 2006 Mauro Carvalho Chehab, - * (c) 2006 Ted Walther and John Sokol * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -43,9 +38,6 @@ struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, int offset); -struct videobuf_buffer; -struct videobuf_queue; - /* --------------------------------------------------------------------- */ /* @@ -57,7 +49,7 @@ struct videobuf_queue; * pointer + length. The kernel version just wants the size and * does memory allocation too using vmalloc_32(). * - * videobuf_dma_*() + * videobuf_dma_pci_*() * see Documentation/DMA-mapping.txt, these functions to * basically the same. The map function does also build a * scatterlist for the buffer (and unmap frees it ...) @@ -94,18 +86,12 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, int nr_pages); int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, dma_addr_t addr, int nr_pages); +int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma); +int videobuf_dma_pci_sync(struct pci_dev *dev, + struct videobuf_dmabuf *dma); +int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma); int videobuf_dma_free(struct videobuf_dmabuf *dma); -int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); -int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); - - /*FIXME: these variants are used only on *-alsa code, where videobuf is - * used without queue - */ -int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); -int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); - /* --------------------------------------------------------------------- */ /* @@ -129,6 +115,9 @@ int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); * */ +struct videobuf_buffer; +struct videobuf_queue; + struct videobuf_mapping { unsigned int count; unsigned long start; @@ -175,10 +164,6 @@ struct videobuf_buffer { struct timeval ts; }; -typedef int (vb_map_sg_t)(void *dev,struct scatterlist *sglist,int nr_pages, - int direction); - - struct videobuf_queue_ops { int (*buf_setup)(struct videobuf_queue *q, unsigned int *count, unsigned int *size); @@ -189,20 +174,12 @@ struct videobuf_queue_ops { struct videobuf_buffer *vb); void (*buf_release)(struct videobuf_queue *q, struct videobuf_buffer *vb); - - /* Helper operations - device dependent. - * If null, videobuf_init defaults all to PCI handling - */ - - vb_map_sg_t *vb_map_sg; - vb_map_sg_t *vb_dma_sync_sg; - vb_map_sg_t *vb_unmap_sg; }; struct videobuf_queue { - struct mutex lock; + struct semaphore lock; spinlock_t *irqlock; - void *dev; /* on pci, points to struct pci_dev */ + struct pci_dev *pci; enum v4l2_buf_type type; unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ @@ -227,15 +204,12 @@ struct videobuf_queue { void* videobuf_alloc(unsigned int size); int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); -int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, - struct v4l2_framebuffer *fbuf); - -/* Maps fops to PCI stuff */ -void videobuf_queue_pci(struct videobuf_queue* q); +int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, + struct v4l2_framebuffer *fbuf); void videobuf_queue_init(struct videobuf_queue *q, struct videobuf_queue_ops *ops, - void *dev, + struct pci_dev *pci, spinlock_t *irqlock, enum v4l2_buf_type type, enum v4l2_field field,