]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ENGR00161607 mxc v4l2 output: return real phys offset after mmap
authorJason Chen <b02280@freescale.com>
Tue, 8 Nov 2011 06:07:14 +0000 (14:07 +0800)
committerOliver Wendt <ow@karo-electronics.de>
Mon, 30 Sep 2013 12:09:58 +0000 (14:09 +0200)
vpu unit test failed because it need phys offset of each buffer allocated by
v4l2 output driver.
videobuf dma contig method only allocate real dma buffer when user call mmap.
Fix this issue by adding code to querybuf ioctl, return real phys after
buffer mmaped.

Signed-off-by: Jason Chen <b02280@freescale.com>
drivers/media/video/mxc/output/mxc_vout.c

index 8596b42d6ca5285bf78e28fb74ac0db25c5cbc8e..6c7e42f14814f3c20ef9310bd7c8bc06693acb76 100644 (file)
@@ -1106,9 +1106,18 @@ static int mxc_vidioc_reqbufs(struct file *file, void *fh,
 static int mxc_vidioc_querybuf(struct file *file, void *fh,
                        struct v4l2_buffer *b)
 {
+       int ret;
        struct mxc_vout_output *vout = fh;
 
-       return videobuf_querybuf(&vout->vbq, b);
+       ret = videobuf_querybuf(&vout->vbq, b);
+       if (!ret) {
+               /* return physical address */
+               struct videobuf_buffer *vb = vout->vbq.bufs[b->index];
+               if (b->flags & V4L2_BUF_FLAG_MAPPED)
+                       b->m.offset = videobuf_to_dma_contig(vb);
+       }
+
+       return ret;
 }
 
 static int mxc_vidioc_qbuf(struct file *file, void *fh,