AnsweredAssumed Answered

imx-gpu-viv - Slow rendering with OpenGl Extension glTexDirectVIVMap()

Question asked by Chris Hollis-Locke on Oct 21, 2019
Latest reply on Oct 29, 2019 by Bio_TICFSL

imx8m-mini using imx-gpu-viv OpenGL framework.

Simple off-screen rendering using a opengl framebuffer object.

 

I want to be able to get direct access to the result of OpenGL rendering for further image processing by CPU and G2D GPU, without having to use glReadPixels() to copy the result to a G2D buffer.

 

Using the glTexDirectVIVMap OpenGL extension works but the rendering is slower than rendering to a default/internally allocated buffer, even though the memory is being allocated from the same CMA area.

 

If I change the texture allocation for the FBO from ..

 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);

To use a buffer allocated by libg2d ...

struct g2d_buf* b = g2d_alloc(4*w*h, /*cached*/ 0);
void    *vaddr = g2db->buf_vaddr;
uint32_t paddr = g2db->buf_paddr;

glTexDirectVIVMap(GL_TEXTURE_2D, w, h, GL_RGBA, &vaddr, &paddr);
glTexDirectInvalidateVIV(GL_TEXTURE_2D);

Then rendering is approx 20% slower.

 

Any ideas why this would be the case?

Any ideas on a better way of getting virtual and physical addresses of the OpenGL Texture / Surface backing store?

Outcomes