glTexDirectVIVMap() need example application

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

glTexDirectVIVMap() need example application

4,555 Views
vikaspatil
Senior Contributor I

Hi All,

Could anyone point me to some sample application which uses the glTexDirectVIVMap()? I am trying to use it for camera capture and display application using V4L2 capture/X11/GLES2.0 APIs but it is not working. While I could manage to make it work with glTexDirectVIV() but it also required to do memcpy() which eventually increases the CPU load. So I think I can avoid the CPU load by using glTexDirectVIVMap() but not sure why it is not working.

Below is the code I am trying to use:

unsigned int physical = ~0U;

buffers[i].length = buf.length;

buffers[i].offset = buf.m.offset;

buffers[i].start = mmap (NULL ,buf.length, PROT_READ | PROT_WRITE, MAP_SHARED, *fd, buf.m.offset);

(*pFNglTexDirectVIVMap)(GL_TEXTURE_2D, width, height, GL_VIV_YUY2, (GLvoid**) &buffers[buf.index].start, &physical);

(*pFNglTexDirectInvalidateVIV)(GL_TEXTURE_2D);

Am I doing anything wrong or missing something here? Does glTexDirectVIVMap()works with mmaped memory?

Thanks in advance.

Regards,

Vikas

Labels (3)
Tags (1)
0 Kudos
4 Replies

1,735 Views
vikaspatil
Senior Contributor I

Dear All,

Could someone confirms if I can use the memory pointer returned by mmap() and pass it to glTexDirectVIVMap() as I shown in my original post? This doesn't seem to be working for me. I am getting GL_INVALID_OPERATION (0x502) error.

or How can I achieve "i.MX6 zero copy camera capture and dsiplay" using X11/GLES2/V4L2?

Regards,

Vikash

0 Kudos

1,735 Views
philbot999
Contributor I

Hi Vikash,

Did you ever figure this out? Do you have any simple example application of using V4L2 buffers iwth glTexDirectVIVMap()?

Thank you very much,

Phil

0 Kudos

1,735 Views
igorpadykov
NXP Employee
NXP Employee

Hi vikash

please look below examples

i.MX6: async behavior of glTexDirectVIVMap

glTexDirectVIV documentation

Best regards

igor

-----------------------------------------------------------------------------------------------------------------------

Note: If this post answers your question, please click the Correct Answer button. Thank you!

-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,735 Views
vikaspatil
Senior Contributor I

Hi Igor,

I went through the doc i.MX_6_EGL-OGL_Extension_Support.pdf. and above post. But not getting what is going wrong in my case? Some time it gives segmatation fault and sometime glTexDirectVIVMap() fails with error 0.

I also tried to align as follows but glTexDirectVIVMap() fails but gl error code is 0.

buffers[i].start = (GLuint)(buffers[i].start + 8) & (~7);

Regards,

Vikash

0 Kudos