]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
MLK-10137:csi: Return physical address in querybuffer call
authorSandor Yu <R01008@freescale.com>
Fri, 23 Jan 2015 06:18:01 +0000 (14:18 +0800)
committerSandor Yu <R01008@freescale.com>
Fri, 30 Jan 2015 03:04:13 +0000 (11:04 +0800)
GST application want to use physical address even video buffer
allocated with type of V4L2_MEMORY_MMAP.
So add a trick in querybuffer function, if video buffer flags
is setting to V4L2_BUF_FLAG_MAPPED, overwirte m.offset with
physical address.

Signed-off-by: Sandor Yu <R01008@freescale.com>
drivers/media/platform/mxc/subdev/mx6s_capture.c

index 1f6d74d2a929df13aade6f5050b366693d069474..8cb1c1d14cf5dd0ba416a20de7d08973d0886e4a 100644 (file)
@@ -1210,10 +1210,19 @@ static int mx6s_vidioc_querybuf(struct file *file, void *priv,
                               struct v4l2_buffer *p)
 {
        struct mx6s_csi_dev *csi_dev = video_drvdata(file);
+       int ret;
 
        WARN_ON(priv != file->private_data);
 
-       return vb2_querybuf(&csi_dev->vb2_vidq, p);
+       ret = vb2_querybuf(&csi_dev->vb2_vidq, p);
+
+       if (!ret) {
+               /* return physical address */
+               struct vb2_buffer *vb = csi_dev->vb2_vidq.bufs[p->index];
+               if (p->flags & V4L2_BUF_FLAG_MAPPED)
+                       p->m.offset = vb2_dma_contig_plane_dma_addr(vb, 0);
+       }
+       return ret;
 }
 
 static int mx6s_vidioc_qbuf(struct file *file, void *priv,