V4L/DVB: OMAP_VOUT: fix: Replaced dma-sg with dma-contig
Actually OMAP doesn't support scatter-gather DMA for Display subsystem but due to legacy coding it has been overlooked till now. Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com> Signed-off-by: Muralidharan Karicheri <mkaricheri@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
committed by
Mauro Carvalho Chehab
parent
5ba9bb0ef6
commit
dd880dd477
@@ -2,7 +2,7 @@ config VIDEO_OMAP2_VOUT
|
|||||||
tristate "OMAP2/OMAP3 V4L2-Display driver"
|
tristate "OMAP2/OMAP3 V4L2-Display driver"
|
||||||
depends on ARCH_OMAP2 || ARCH_OMAP3
|
depends on ARCH_OMAP2 || ARCH_OMAP3
|
||||||
select VIDEOBUF_GEN
|
select VIDEOBUF_GEN
|
||||||
select VIDEOBUF_DMA_SG
|
select VIDEOBUF_DMA_CONTIG
|
||||||
select OMAP2_DSS
|
select OMAP2_DSS
|
||||||
select OMAP2_VRAM
|
select OMAP2_VRAM
|
||||||
select OMAP2_VRFB
|
select OMAP2_VRFB
|
||||||
|
@@ -40,7 +40,7 @@
|
|||||||
#include <linux/videodev2.h>
|
#include <linux/videodev2.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
|
||||||
#include <media/videobuf-dma-sg.h>
|
#include <media/videobuf-dma-contig.h>
|
||||||
#include <media/v4l2-device.h>
|
#include <media/v4l2-device.h>
|
||||||
#include <media/v4l2-ioctl.h>
|
#include <media/v4l2-ioctl.h>
|
||||||
|
|
||||||
@@ -1054,9 +1054,9 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
|
|||||||
struct videobuf_buffer *vb,
|
struct videobuf_buffer *vb,
|
||||||
enum v4l2_field field)
|
enum v4l2_field field)
|
||||||
{
|
{
|
||||||
|
dma_addr_t dmabuf;
|
||||||
struct vid_vrfb_dma *tx;
|
struct vid_vrfb_dma *tx;
|
||||||
enum dss_rotation rotation;
|
enum dss_rotation rotation;
|
||||||
struct videobuf_dmabuf *dmabuf = NULL;
|
|
||||||
struct omap_vout_device *vout = q->priv_data;
|
struct omap_vout_device *vout = q->priv_data;
|
||||||
u32 dest_frame_index = 0, src_element_index = 0;
|
u32 dest_frame_index = 0, src_element_index = 0;
|
||||||
u32 dest_element_index = 0, src_frame_index = 0;
|
u32 dest_element_index = 0, src_frame_index = 0;
|
||||||
@@ -1075,24 +1075,17 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
|
|||||||
if (V4L2_MEMORY_USERPTR == vb->memory) {
|
if (V4L2_MEMORY_USERPTR == vb->memory) {
|
||||||
if (0 == vb->baddr)
|
if (0 == vb->baddr)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
/* Virtual address */
|
|
||||||
/* priv points to struct videobuf_pci_sg_memory. But we went
|
|
||||||
* pointer to videobuf_dmabuf, which is member of
|
|
||||||
* videobuf_pci_sg_memory */
|
|
||||||
dmabuf = videobuf_to_dma(q->bufs[vb->i]);
|
|
||||||
dmabuf->vmalloc = (void *) vb->baddr;
|
|
||||||
|
|
||||||
/* Physical address */
|
/* Physical address */
|
||||||
dmabuf->bus_addr =
|
vout->queued_buf_addr[vb->i] = (u8 *)
|
||||||
(dma_addr_t) omap_vout_uservirt_to_phys(vb->baddr);
|
omap_vout_uservirt_to_phys(vb->baddr);
|
||||||
|
} else {
|
||||||
|
vout->queued_buf_addr[vb->i] = (u8 *)vout->buf_phy_addr[vb->i];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rotation_enabled(vout)) {
|
if (!rotation_enabled(vout))
|
||||||
dmabuf = videobuf_to_dma(q->bufs[vb->i]);
|
|
||||||
vout->queued_buf_addr[vb->i] = (u8 *) dmabuf->bus_addr;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
dmabuf = videobuf_to_dma(q->bufs[vb->i]);
|
dmabuf = vout->buf_phy_addr[vb->i];
|
||||||
/* If rotation is enabled, copy input buffer into VRFB
|
/* If rotation is enabled, copy input buffer into VRFB
|
||||||
* memory space using DMA. We are copying input buffer
|
* memory space using DMA. We are copying input buffer
|
||||||
* into VRFB memory space of desired angle and DSS will
|
* into VRFB memory space of desired angle and DSS will
|
||||||
@@ -1121,7 +1114,7 @@ static int omap_vout_buffer_prepare(struct videobuf_queue *q,
|
|||||||
tx->dev_id, 0x0);
|
tx->dev_id, 0x0);
|
||||||
/* src_port required only for OMAP1 */
|
/* src_port required only for OMAP1 */
|
||||||
omap_set_dma_src_params(tx->dma_ch, 0, OMAP_DMA_AMODE_POST_INC,
|
omap_set_dma_src_params(tx->dma_ch, 0, OMAP_DMA_AMODE_POST_INC,
|
||||||
dmabuf->bus_addr, src_element_index, src_frame_index);
|
dmabuf, src_element_index, src_frame_index);
|
||||||
/*set dma source burst mode for VRFB */
|
/*set dma source burst mode for VRFB */
|
||||||
omap_set_dma_src_burst_mode(tx->dma_ch, OMAP_DMA_DATA_BURST_16);
|
omap_set_dma_src_burst_mode(tx->dma_ch, OMAP_DMA_DATA_BURST_16);
|
||||||
rotation = calc_rotation(vout);
|
rotation = calc_rotation(vout);
|
||||||
@@ -1212,7 +1205,6 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
void *pos;
|
void *pos;
|
||||||
unsigned long start = vma->vm_start;
|
unsigned long start = vma->vm_start;
|
||||||
unsigned long size = (vma->vm_end - vma->vm_start);
|
unsigned long size = (vma->vm_end - vma->vm_start);
|
||||||
struct videobuf_dmabuf *dmabuf = NULL;
|
|
||||||
struct omap_vout_device *vout = file->private_data;
|
struct omap_vout_device *vout = file->private_data;
|
||||||
struct videobuf_queue *q = &vout->vbq;
|
struct videobuf_queue *q = &vout->vbq;
|
||||||
|
|
||||||
@@ -1242,8 +1234,7 @@ static int omap_vout_mmap(struct file *file, struct vm_area_struct *vma)
|
|||||||
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
|
vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
|
||||||
vma->vm_ops = &omap_vout_vm_ops;
|
vma->vm_ops = &omap_vout_vm_ops;
|
||||||
vma->vm_private_data = (void *) vout;
|
vma->vm_private_data = (void *) vout;
|
||||||
dmabuf = videobuf_to_dma(q->bufs[i]);
|
pos = (void *)vout->buf_virt_addr[i];
|
||||||
pos = dmabuf->vmalloc;
|
|
||||||
vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT;
|
vma->vm_pgoff = virt_to_phys((void *)pos) >> PAGE_SHIFT;
|
||||||
while (size > 0) {
|
while (size > 0) {
|
||||||
unsigned long pfn;
|
unsigned long pfn;
|
||||||
@@ -1348,8 +1339,8 @@ static int omap_vout_open(struct file *file)
|
|||||||
video_vbq_ops.buf_queue = omap_vout_buffer_queue;
|
video_vbq_ops.buf_queue = omap_vout_buffer_queue;
|
||||||
spin_lock_init(&vout->vbq_lock);
|
spin_lock_init(&vout->vbq_lock);
|
||||||
|
|
||||||
videobuf_queue_sg_init(q, &video_vbq_ops, NULL, &vout->vbq_lock,
|
videobuf_queue_dma_contig_init(q, &video_vbq_ops, q->dev,
|
||||||
vout->type, V4L2_FIELD_NONE,
|
&vout->vbq_lock, vout->type, V4L2_FIELD_NONE,
|
||||||
sizeof(struct videobuf_buffer), vout);
|
sizeof(struct videobuf_buffer), vout);
|
||||||
|
|
||||||
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Exiting %s\n", __func__);
|
v4l2_dbg(1, debug, &vout->vid_dev->v4l2_dev, "Exiting %s\n", __func__);
|
||||||
@@ -1800,7 +1791,6 @@ static int vidioc_reqbufs(struct file *file, void *fh,
|
|||||||
unsigned int i, num_buffers = 0;
|
unsigned int i, num_buffers = 0;
|
||||||
struct omap_vout_device *vout = fh;
|
struct omap_vout_device *vout = fh;
|
||||||
struct videobuf_queue *q = &vout->vbq;
|
struct videobuf_queue *q = &vout->vbq;
|
||||||
struct videobuf_dmabuf *dmabuf = NULL;
|
|
||||||
|
|
||||||
if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0))
|
if ((req->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) || (req->count < 0))
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@@ -1826,8 +1816,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
|
|||||||
num_buffers = (vout->vid == OMAP_VIDEO1) ?
|
num_buffers = (vout->vid == OMAP_VIDEO1) ?
|
||||||
video1_numbuffers : video2_numbuffers;
|
video1_numbuffers : video2_numbuffers;
|
||||||
for (i = num_buffers; i < vout->buffer_allocated; i++) {
|
for (i = num_buffers; i < vout->buffer_allocated; i++) {
|
||||||
dmabuf = videobuf_to_dma(q->bufs[i]);
|
omap_vout_free_buffer(vout->buf_virt_addr[i],
|
||||||
omap_vout_free_buffer((u32)dmabuf->vmalloc,
|
|
||||||
vout->buffer_size);
|
vout->buffer_size);
|
||||||
vout->buf_virt_addr[i] = 0;
|
vout->buf_virt_addr[i] = 0;
|
||||||
vout->buf_phy_addr[i] = 0;
|
vout->buf_phy_addr[i] = 0;
|
||||||
@@ -1856,12 +1845,7 @@ static int vidioc_reqbufs(struct file *file, void *fh,
|
|||||||
goto reqbuf_err;
|
goto reqbuf_err;
|
||||||
|
|
||||||
vout->buffer_allocated = req->count;
|
vout->buffer_allocated = req->count;
|
||||||
for (i = 0; i < req->count; i++) {
|
|
||||||
dmabuf = videobuf_to_dma(q->bufs[i]);
|
|
||||||
dmabuf->vmalloc = (void *) vout->buf_virt_addr[i];
|
|
||||||
dmabuf->bus_addr = (dma_addr_t) vout->buf_phy_addr[i];
|
|
||||||
dmabuf->sglen = 1;
|
|
||||||
}
|
|
||||||
reqbuf_err:
|
reqbuf_err:
|
||||||
mutex_unlock(&vout->lock);
|
mutex_unlock(&vout->lock);
|
||||||
return ret;
|
return ret;
|
||||||
|
Reference in New Issue
Block a user