diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-10 10:29:15 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-03-24 14:26:49 -0500 |
commit | c7b0ac0546985fc6361a8d92cf808d46da797677 (patch) | |
tree | 2147eb2f6dd7b2b82e0d7b4b9a26e12ef5193252 /drivers/media/video/bttv-driver.c | |
parent | b2fd16b4ff2508ac16ae994f4bcd941f97754c00 (diff) |
V4L/DVB (3516): Make video_buf more generic
Video_buf were concerned to allow PCI devices to be used as
video capture devices. This patch extends video_buf features
by virtualizing pci-dependent functions and allowing other
type of devices to use it.
It is still DMA centric, although it may be used also by
devices that emulates scatter/gather behavior or a DMA device
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/bttv-driver.c')
-rw-r--r-- | drivers/media/video/bttv-driver.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index c0415d6e7fee..2505ae5a7b97 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1397,7 +1397,7 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, | |||
1397 | free_btres(btv,fh,RESOURCE_OVERLAY); | 1397 | free_btres(btv,fh,RESOURCE_OVERLAY); |
1398 | if (NULL != old) { | 1398 | if (NULL != old) { |
1399 | dprintk("switch_overlay: old=%p state is %d\n",old,old->vb.state); | 1399 | dprintk("switch_overlay: old=%p state is %d\n",old,old->vb.state); |
1400 | bttv_dma_free(btv, old); | 1400 | bttv_dma_free(&fh->cap,btv, old); |
1401 | kfree(old); | 1401 | kfree(old); |
1402 | } | 1402 | } |
1403 | dprintk("switch_overlay: done\n"); | 1403 | dprintk("switch_overlay: done\n"); |
@@ -1407,7 +1407,8 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, | |||
1407 | /* ----------------------------------------------------------------------- */ | 1407 | /* ----------------------------------------------------------------------- */ |
1408 | /* video4linux (1) interface */ | 1408 | /* video4linux (1) interface */ |
1409 | 1409 | ||
1410 | static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | 1410 | static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, |
1411 | struct bttv_buffer *buf, | ||
1411 | const struct bttv_format *fmt, | 1412 | const struct bttv_format *fmt, |
1412 | unsigned int width, unsigned int height, | 1413 | unsigned int width, unsigned int height, |
1413 | enum v4l2_field field) | 1414 | enum v4l2_field field) |
@@ -1450,7 +1451,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | |||
1450 | /* alloc risc memory */ | 1451 | /* alloc risc memory */ |
1451 | if (STATE_NEEDS_INIT == buf->vb.state) { | 1452 | if (STATE_NEEDS_INIT == buf->vb.state) { |
1452 | redo_dma_risc = 1; | 1453 | redo_dma_risc = 1; |
1453 | if (0 != (rc = videobuf_iolock(btv->c.pci,&buf->vb,&btv->fbuf))) | 1454 | if (0 != (rc = videobuf_iolock(q,&buf->vb,&btv->fbuf))) |
1454 | goto fail; | 1455 | goto fail; |
1455 | } | 1456 | } |
1456 | 1457 | ||
@@ -1462,7 +1463,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | |||
1462 | return 0; | 1463 | return 0; |
1463 | 1464 | ||
1464 | fail: | 1465 | fail: |
1465 | bttv_dma_free(btv,buf); | 1466 | bttv_dma_free(q,btv,buf); |
1466 | return rc; | 1467 | return rc; |
1467 | } | 1468 | } |
1468 | 1469 | ||
@@ -1486,7 +1487,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
1486 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 1487 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
1487 | struct bttv_fh *fh = q->priv_data; | 1488 | struct bttv_fh *fh = q->priv_data; |
1488 | 1489 | ||
1489 | return bttv_prepare_buffer(fh->btv, buf, fh->fmt, | 1490 | return bttv_prepare_buffer(q,fh->btv, buf, fh->fmt, |
1490 | fh->width, fh->height, field); | 1491 | fh->width, fh->height, field); |
1491 | } | 1492 | } |
1492 | 1493 | ||
@@ -1510,7 +1511,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1510 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 1511 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
1511 | struct bttv_fh *fh = q->priv_data; | 1512 | struct bttv_fh *fh = q->priv_data; |
1512 | 1513 | ||
1513 | bttv_dma_free(fh->btv,buf); | 1514 | bttv_dma_free(&fh->cap,fh->btv,buf); |
1514 | } | 1515 | } |
1515 | 1516 | ||
1516 | static struct videobuf_queue_ops bttv_video_qops = { | 1517 | static struct videobuf_queue_ops bttv_video_qops = { |
@@ -2496,7 +2497,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2496 | field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2) | 2497 | field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2) |
2497 | ? V4L2_FIELD_INTERLACED | 2498 | ? V4L2_FIELD_INTERLACED |
2498 | : V4L2_FIELD_BOTTOM; | 2499 | : V4L2_FIELD_BOTTOM; |
2499 | retval = bttv_prepare_buffer(btv,buf, | 2500 | retval = bttv_prepare_buffer(&fh->cap,btv,buf, |
2500 | format_by_palette(vm->format), | 2501 | format_by_palette(vm->format), |
2501 | vm->width,vm->height,field); | 2502 | vm->width,vm->height,field); |
2502 | if (0 != retval) | 2503 | if (0 != retval) |
@@ -2528,8 +2529,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2528 | retval = -EIO; | 2529 | retval = -EIO; |
2529 | /* fall through */ | 2530 | /* fall through */ |
2530 | case STATE_DONE: | 2531 | case STATE_DONE: |
2531 | videobuf_dma_pci_sync(btv->c.pci,&buf->vb.dma); | 2532 | videobuf_dma_sync(&fh->cap,&buf->vb.dma); |
2532 | bttv_dma_free(btv,buf); | 2533 | bttv_dma_free(&fh->cap,btv,buf); |
2533 | break; | 2534 | break; |
2534 | default: | 2535 | default: |
2535 | retval = -EINVAL; | 2536 | retval = -EINVAL; |