]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/omapdrmtest.git/blobdiff - util/vpe-common.c
VPE: util: Add NV12 support to VPE library
[glsdk/omapdrmtest.git] / util / vpe-common.c
index 164f7a28d5a88138143f63235f045f3b3d281185..c3f6e4eb48ebee09f9c58fed670f17c6e93cb15a 100755 (executable)
@@ -109,6 +109,7 @@ struct vpe {
        int input_buf_dmafd[NUMBUF];
        int input_buf_dmafd_uv[NUMBUF];
        int output_buf_dmafd[NUMBUF];
        int input_buf_dmafd[NUMBUF];
        int input_buf_dmafd_uv[NUMBUF];
        int output_buf_dmafd[NUMBUF];
+       int output_buf_dmafd_uv[NUMBUF];
        struct display *disp;
        struct buffer **disp_bufs;
 };
        struct display *disp;
        struct buffer **disp_bufs;
 };
@@ -443,6 +444,11 @@ int vpe_output_init(struct vpe *vpe)
        for (i = 0; i < NUMBUF; i++) {
                vpe->output_buf_dmafd[i] = omap_bo_dmabuf(vpe->disp_bufs[i]->bo[0]);
                vpe->disp_bufs[i]->fd[0] = vpe->output_buf_dmafd[i];
        for (i = 0; i < NUMBUF; i++) {
                vpe->output_buf_dmafd[i] = omap_bo_dmabuf(vpe->disp_bufs[i]->bo[0]);
                vpe->disp_bufs[i]->fd[0] = vpe->output_buf_dmafd[i];
+
+               if(vpe->dst.coplanar) {
+                       vpe->output_buf_dmafd_uv[i] = omap_bo_dmabuf(vpe->disp_bufs[i]->bo[1]);
+                       vpe->disp_bufs[i]->fd[1] = vpe->output_buf_dmafd_uv[i];
+               }
                /* display only image widthxheight, no full screen */
                vpe->disp_bufs[i]->noScale = true;
                dprintf("vpe->disp_bufs_fd[%d] = %d\n", i, vpe->output_buf_dmafd[i]);
                /* display only image widthxheight, no full screen */
                vpe->disp_bufs[i]->noScale = true;
                dprintf("vpe->disp_bufs_fd[%d] = %d\n", i, vpe->output_buf_dmafd[i]);
@@ -526,10 +532,16 @@ int vpe_output_qbuf(struct vpe *vpe, int index)
        buf.memory = V4L2_MEMORY_DMABUF;
        buf.index = index;
        buf.m.planes = &planes;
        buf.memory = V4L2_MEMORY_DMABUF;
        buf.index = index;
        buf.m.planes = &planes;
-       buf.length = 2;
+       if(vpe->dst.coplanar)
+               buf.length = 2;
+       else
+               buf.length = 1;
 
        buf.m.planes[0].m.fd = vpe->output_buf_dmafd[index];
 
 
        buf.m.planes[0].m.fd = vpe->output_buf_dmafd[index];
 
+       if(vpe->dst.coplanar)
+               buf.m.planes[1].m.fd = vpe->output_buf_dmafd_uv[index];
+
        ret = ioctl(vpe->fd, VIDIOC_QBUF, &buf);
        if (ret < 0)
                pexit( "vpe o/p: QBUF failed: %s, index = %d\n",
        ret = ioctl(vpe->fd, VIDIOC_QBUF, &buf);
        if (ret < 0)
                pexit( "vpe o/p: QBUF failed: %s, index = %d\n",
@@ -607,9 +619,9 @@ int vpe_input_dqbuf(struct vpe *vpe)
        buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
        buf.memory = V4L2_MEMORY_DMABUF;
         buf.m.planes = &planes;
        buf.type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
        buf.memory = V4L2_MEMORY_DMABUF;
         buf.m.planes = &planes;
-        if(vpe->src.coplanar)
+       if(vpe->src.coplanar)
                buf.length = 2;
                buf.length = 2;
-       else 
+       else
                buf.length = 1;
        ret = ioctl(vpe->fd, VIDIOC_DQBUF, &buf);
        if (ret < 0)
                buf.length = 1;
        ret = ioctl(vpe->fd, VIDIOC_DQBUF, &buf);
        if (ret < 0)
@@ -643,7 +655,10 @@ int vpe_output_dqbuf(struct vpe *vpe)
        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
        buf.memory = V4L2_MEMORY_DMABUF;
         buf.m.planes = &planes;
        buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
        buf.memory = V4L2_MEMORY_DMABUF;
         buf.m.planes = &planes;
-        buf.length = 1;
+       if(vpe->dst.coplanar)
+               buf.length = 2;
+       else
+               buf.length = 1;
        ret = ioctl(vpe->fd, VIDIOC_DQBUF, &buf);
        if (ret < 0)
                pexit("vpe o/p: DQBUF failed: %s\n", strerror(errno));
        ret = ioctl(vpe->fd, VIDIOC_DQBUF, &buf);
        if (ret < 0)
                pexit("vpe o/p: DQBUF failed: %s\n", strerror(errno));