i.MX8MP - Performance issue when sharing G2D buffers between V4L2 and OpenGL

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX8MP - Performance issue when sharing G2D buffers between V4L2 and OpenGL

215 Views
gaelp
Contributor II

Hello, 

I am facing an issue when sharing a G2D buffer from V4L2 directly to OpenGL (GPU GC7000UL) with a high resolution (4048 x 3040 : 12 MP).

Here is the pseudo-code of my application.

I am allocating g2d_buffers (4048x3040 in YUYV) and saving the file descriptor.

struct g2d_buf *_srcBuf = g2d_alloc(4048 * 3040 * 2, true); // cacheable
int g2d_src_buf_fds = g2d_buf_export_fd(&_srcBuf);


Then I use this g2d filedescriptor to get the video frame from a camera device using V4L2.

struct v4l2_buffer buf;
buf.memory = V4L2_MEMORY_DMABUF;
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.m.fd = g2d_src_buf_fds;

[...]
ioctl(cam->fd, VIDIOC_QBUF, &buf);
[...]
ioctl(cam->fd, VIDIOC_DQBUF, &buf);

// DMA sync operations
struct dma_buf_sync sync = { 0 };
sync.flags = DMA_BUF_SYNC_START; ioctl(buf_fd, DMA_BUF_IOCTL_SYNC, &sync);
sync.flags = DMA_BUF_SYNC_END ; ioctl(buf_fd, DMA_BUF_IOCTL_SYNC, &sync);

 

On the OpenGL side, we use the Vivante extension to connect to the G2D buffer.

p_glTexDirectVIVMap( GL_TEXTURE_2D,
4048,
3040,
GL_VIV_YUY2,
&_srcBuf->buf_vaddr, // virtual address
(void **)&_srcBuf->buf_paddr // physical address );

 

The workflow works fine since we are able to display the image at the output of OpenGL and with a correct framerate (30FPS, which is the camera framerate) but only with low resolution (for example 800x600).

If we increase the resolution up to 12MP, then we are slowly seeing the framerate dropping (it drops to 19FPS when we use the full resolution of 4048 x 3040 : 12MP).

Would you have any suggestion on how to share the g2d buffer with high resolution or would you have any idea what my issue can be ?

Thanks for your help.

0 Kudos
Reply
4 Replies

184 Views
gaelp
Contributor II

Thank you for your answer. I am using an i.MX8MP.

If there are no limitation, would you have some suggestion on how to do it correctly ? We thought that the resolution of 4048x3040 (12MP) might be a bit too high, and some internal transfer (DMA or not) could cause the framerate drop that we notice.

0 Kudos
Reply

203 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello,

Which device are you using? 

With i.MX6 there are some issue regarding applications like your but with i.MX8 there is none.

Regards

0 Kudos
Reply

163 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi,

For 2D 32K x 32K coordinate system, but the buffers depend of RAM, so there should not be an issue there. so send us your application code to reproduce it here and check it.

Regards

0 Kudos
Reply

107 Views
gaelp
Contributor II

Sorry for the late answer.

Our performance issue seems to be related to the process of getting the image off the GPU to the CPU with the glReadPixels function that we are using.

We might improve this process by using the eglSwapBuffers which should solve our performance issue.

Any information about that or special way of doing that on iMX8MP ? 

0 Kudos
Reply