From: Nikhil Devshatwar Date: Wed, 30 Jul 2014 14:51:19 +0000 (+0530) Subject: VPE: util: Add NV12 support to VPE library X-Git-Url: https://git.ti.com/gitweb?p=glsdk%2Fomapdrmtest.git;a=commitdiff_plain;h=c5fe8453c1a383f54a5813d9c349118446f6c0e7 VPE: util: Add NV12 support to VPE library Current VPE library doesn't support NV12 as output format App fails with Seg fault when trying to convert to NV12 format Add this support Signed-off-by: Nikhil Devshatwar --- diff --git a/util/vpe-common.c b/util/vpe-common.c index 164f7a2..c3f6e4e 100755 --- a/util/vpe-common.c +++ b/util/vpe-common.c @@ -109,6 +109,7 @@ struct vpe { 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; }; @@ -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]; + + 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]); @@ -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.length = 2; + if(vpe->dst.coplanar) + buf.length = 2; + else + buf.length = 1; 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", @@ -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; - if(vpe->src.coplanar) + if(vpe->src.coplanar) buf.length = 2; - else + else 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.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));