Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Linux/AM5728: CMEM display issue

$
0
0

Part Number:AM5728

Tool/software: Linux

Hi,

I try to use CMEM storage imagebuff from VPE and than display it.

I reference the dual-camera demo and take alloc_cmem_buffer() in capturevpedisplay demo.

Below is what I changed in vpe_common.c in Pro capturevpedisplay .

int vpe_output_init(struct vpe *vpe)
{
	int ret, i;
	struct v4l2_format fmt;
	struct v4l2_requestbuffers rqbufs;
	bool saved_multiplanar;

	memset(&fmt, 0, sizeof fmt);
	fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
	fmt.fmt.pix_mp.width = vpe->dst.width;
	fmt.fmt.pix_mp.height = vpe->dst.height;
	fmt.fmt.pix_mp.pixelformat = vpe->dst.fourcc;
	fmt.fmt.pix_mp.field = V4L2_FIELD_ANY;
	fmt.fmt.pix_mp.colorspace = vpe->dst.colorspace;
	fmt.fmt.pix_mp.num_planes = vpe->dst.coplanar ? 2 : 1;

	ret = ioctl(vpe->fd, VIDIOC_S_FMT, &fmt);
	if (ret < 0)
		pexit( "vpe o/p: S_FMT failed: %s\n", strerror(errno));

	ret = ioctl(vpe->fd, VIDIOC_G_FMT, &fmt);
	if (ret < 0)
		pexit( "vpe o/p: G_FMT_2 failed: %s\n", strerror(errno));



	printf("vpe o/p: G_FMT: width = %u, height = %u, 4cc = %.4s\n",
			fmt.fmt.pix_mp.width, fmt.fmt.pix_mp.height,
			(char*)&fmt.fmt.pix_mp.pixelformat);



	memset(&rqbufs, 0, sizeof(rqbufs));
	rqbufs.count = NUMBUF;
	rqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
	rqbufs.memory = V4L2_MEMORY_DMABUF;


	ret = ioctl(vpe->fd, VIDIOC_REQBUFS, &rqbufs);
	if (ret < 0)
		pexit( "vpe o/p: REQBUFS failed: %s\n", strerror(errno));

	vpe->dst.numbuf = rqbufs.count;
	dprintf("vpe o/p: allocated buffers = %d\n", rqbufs.count);

	/*
	 * disp->multiplanar is used when allocating buffers to enable
	 * allocating multiplane buffer in separate buffers.
	 * VPE does handle mulitplane NV12 buffer correctly
	 * but VIP can only handle single plane buffers
	 * So by default we are setup to use single plane and only overwrite
	 * it when allocating strictly VPE buffers.
	 * Here we saved to current value and restore it after we are done
	 * allocating the buffers VPE will use for output.
	 */

	saved_multiplanar = vpe->disp->multiplanar;
	vpe->disp->multiplanar = false;

	//vpe->disp_bufs = disp_get_vid_buffers(vpe->disp, NUMBUF, vpe->dst.fourcc,
	//				      vpe->dst.width, vpe->dst.height);	

	vpe->disp_bufs = get_cmem_buffers(vpe->disp, NUMBUF, vpe->dst.fourcc,
					      vpe->dst.width, vpe->dst.height);


	vpe->disp->multiplanar = saved_multiplanar;
	if (!vpe->disp_bufs)
		pexit("allocating display buffer failed\n");

	/* SetCrtc with an RGB buffer first */
	//disp_get_fb(vpe->disp);


	for (i = 0; i < NUMBUF; i++) {
		//vpe->output_buf_dmafd[i] = vpe->disp_bufs[i]->fd[0];
		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];
			
		}
		/* Scale back to display resolution */
		vpe->disp_bufs[i]->noScale = false;
		dprintf("vpe->disp_bufs_fd[%d] = %d\n", i, vpe->output_buf_dmafd[i]);
	}

	dprintf("allocating display buffer success\n");
	return 0;
}

If I use another image cover in (with memcpy) the cmem_buf ,it will display some stripes on top picture .

I try to save the picture and display it.And than I check the picture I saved is fine.

I think this issue happen in display_buffer(vpe, index);


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>