tw68-video.c (9938b04472d5c59f8bd8152a548533a8599596a2) tw68-video.c (2bc46b3ad3c15165f91459b07ff8682478683194)
1/*
2 * tw68 functions to handle video data
3 *
4 * Much of this code is derived from the cx88 and sa7134 drivers, which
5 * were in turn derived from the bt87x driver. The original work was by
6 * Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab,
7 * Hans Verkuil, Andy Walls and many others. Their work is gratefully
8 * acknowledged. Full credit goes to them - any problems within this code

--- 374 unchanged lines hidden (view full) ---

383 struct tw68_dev *dev = vb2_get_drv_priv(q);
384 unsigned tot_bufs = q->num_buffers + *num_buffers;
385 unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3;
386
387 if (tot_bufs < 2)
388 tot_bufs = 2;
389 tot_bufs = tw68_buffer_count(size, tot_bufs);
390 *num_buffers = tot_bufs - q->num_buffers;
1/*
2 * tw68 functions to handle video data
3 *
4 * Much of this code is derived from the cx88 and sa7134 drivers, which
5 * were in turn derived from the bt87x driver. The original work was by
6 * Gerd Knorr; more recently the code was enhanced by Mauro Carvalho Chehab,
7 * Hans Verkuil, Andy Walls and many others. Their work is gratefully
8 * acknowledged. Full credit goes to them - any problems within this code

--- 374 unchanged lines hidden (view full) ---

383 struct tw68_dev *dev = vb2_get_drv_priv(q);
384 unsigned tot_bufs = q->num_buffers + *num_buffers;
385 unsigned size = (dev->fmt->depth * dev->width * dev->height) >> 3;
386
387 if (tot_bufs < 2)
388 tot_bufs = 2;
389 tot_bufs = tw68_buffer_count(size, tot_bufs);
390 *num_buffers = tot_bufs - q->num_buffers;
391 alloc_ctxs[0] = dev->alloc_ctx;
392 /*
393 * We allow create_bufs, but only if the sizeimage is >= as the
394 * current sizeimage. The tw68_buffer_count calculation becomes quite
395 * difficult otherwise.
396 */
397 if (*num_planes)
398 return sizes[0] < size ? -EINVAL : 0;
399 *num_planes = 1;

--- 578 unchanged lines hidden (view full) ---

978 dev->vidq.io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ | VB2_DMABUF;
979 dev->vidq.ops = &tw68_video_qops;
980 dev->vidq.mem_ops = &vb2_dma_sg_memops;
981 dev->vidq.drv_priv = dev;
982 dev->vidq.gfp_flags = __GFP_DMA32 | __GFP_KSWAPD_RECLAIM;
983 dev->vidq.buf_struct_size = sizeof(struct tw68_buf);
984 dev->vidq.lock = &dev->lock;
985 dev->vidq.min_buffers_needed = 2;
391 /*
392 * We allow create_bufs, but only if the sizeimage is >= as the
393 * current sizeimage. The tw68_buffer_count calculation becomes quite
394 * difficult otherwise.
395 */
396 if (*num_planes)
397 return sizes[0] < size ? -EINVAL : 0;
398 *num_planes = 1;

--- 578 unchanged lines hidden (view full) ---

977 dev->vidq.io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ | VB2_DMABUF;
978 dev->vidq.ops = &tw68_video_qops;
979 dev->vidq.mem_ops = &vb2_dma_sg_memops;
980 dev->vidq.drv_priv = dev;
981 dev->vidq.gfp_flags = __GFP_DMA32 | __GFP_KSWAPD_RECLAIM;
982 dev->vidq.buf_struct_size = sizeof(struct tw68_buf);
983 dev->vidq.lock = &dev->lock;
984 dev->vidq.min_buffers_needed = 2;
985 dev->vidq.dev = &dev->pci->dev;
986 ret = vb2_queue_init(&dev->vidq);
987 if (ret)
988 return ret;
989 dev->vdev = tw68_video_template;
990 dev->vdev.v4l2_dev = &dev->v4l2_dev;
991 dev->vdev.lock = &dev->lock;
992 dev->vdev.queue = &dev->vidq;
993 video_set_drvdata(&dev->vdev, dev);

--- 55 unchanged lines hidden ---
986 ret = vb2_queue_init(&dev->vidq);
987 if (ret)
988 return ret;
989 dev->vdev = tw68_video_template;
990 dev->vdev.v4l2_dev = &dev->v4l2_dev;
991 dev->vdev.lock = &dev->lock;
992 dev->vdev.queue = &dev->vidq;
993 video_set_drvdata(&dev->vdev, dev);

--- 55 unchanged lines hidden ---