Vivante eglCreateImageKHR Linux

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Vivante eglCreateImageKHR Linux

ソリューションへジャンプ
5,648件の閲覧回数
sebastient
Contributor V

I'm trying to make use of eglCreateImageKHR on the i.MX6 in Linux (normal framebuffer drivers) but it is not clear what EGLClientBuffer should be.  I've tried using both physical and virtual addresses from both IPU allocated memory as well as from framebuffer (/dev/fb) devices.  In all cases the call returns EGL_BAD_PARAMETER.  I am trying to create an EGLImage for use as a texture in GLES 1.1 (possibly also a VGImage in the future) whose data comes from IPU allocated memory or a framebuffer (which the IPU can access directly).

image = eglCreateImageKHR(egl_display, EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR, buffer, NULL);

eglGetError() always returns EGL_BAD_PARAMETER

For buffer I've tried using a EGLNativePixmapType returned from fbCreatePixmap, the physical address of the underlying /dev/fb device, the mmap'ed memory of the same /dev/fb device.  I've also tried using /dev/mxc_ipu to allocate memory and using either the physical or mmap'ed memory from there as well.

ラベル(2)
タグ(3)
0 件の賞賛
返信
1 解決策
3,585件の閲覧回数
juangutierrez
NXP Employee
NXP Employee

Hi

I'm not an expert in Graphics, but if what you are trying to do is to create a texture from an IPU memory buffer, you can use the glTexDirectVIVMap API to map a virtual memory address buffer (texture_data) to the current bind texture (GL_TEXTURE_2D).

To indicate that physical address is unknown ~0U should be passed as the last argument.

Also you should call this API for each new frame rendered.

==================== Pseudo code =======================

GLuint physical = ~0U;

GLuint texture_id = 0;

void* texture_data = GetBuffer();   // virtual buffer addr

_texture = glGenTextures (1, &texture_id);

glTexParameterf (GL_TEXTURE_2D, <pname>, <pvalue>);

glBindTexture(GL_TEXTURE_2D, _texture);

glTexDirectVIVMap (GL_TEXTURE_2D, width, height, GL_VIV_NV12, (GLvoid**)(&texture_data), &physical);

glTexDirectInvalidateVIV (GL_TEXTURE_2D);

元の投稿で解決策を見る

0 件の賞賛
返信
4 返答(返信)
3,585件の閲覧回数
sebastient
Contributor V

I made an error in this report, I was specifying a context instead of EGL_NO_CONTEXT which was the cause of the EGL_BAD_PARAMETER (why this happens isn't clear).  Using EGL_NO_CONTEXT does allow the image to be created but the texture renders all white though inspecting the memory of the image shows that it does indeed have the correct data.  I've set the clear colour to be green, disabling the texture does show a green canvas as expected.

0 件の賞賛
返信
3,586件の閲覧回数
juangutierrez
NXP Employee
NXP Employee

Hi

I'm not an expert in Graphics, but if what you are trying to do is to create a texture from an IPU memory buffer, you can use the glTexDirectVIVMap API to map a virtual memory address buffer (texture_data) to the current bind texture (GL_TEXTURE_2D).

To indicate that physical address is unknown ~0U should be passed as the last argument.

Also you should call this API for each new frame rendered.

==================== Pseudo code =======================

GLuint physical = ~0U;

GLuint texture_id = 0;

void* texture_data = GetBuffer();   // virtual buffer addr

_texture = glGenTextures (1, &texture_id);

glTexParameterf (GL_TEXTURE_2D, <pname>, <pvalue>);

glBindTexture(GL_TEXTURE_2D, _texture);

glTexDirectVIVMap (GL_TEXTURE_2D, width, height, GL_VIV_NV12, (GLvoid**)(&texture_data), &physical);

glTexDirectInvalidateVIV (GL_TEXTURE_2D);

0 件の賞賛
返信
3,585件の閲覧回数
sebastient
Contributor V

If using the IPU we specifically want to use the physical address so we both use IPU_ALLOC and mmap the buffer to get a virtual address.  I have been using glTexDirectVIVMap in this way successfully.  I haven't had the time to come back and look at the issue with eglCreateImageKHR but I believe it might be able to use a framebuffer pixmap created with the fbCreatePixmap.

0 件の賞賛
返信
3,585件の閲覧回数
karina_valencia
NXP Apps Support
NXP Apps Support
Re: Vivante eglCreateImageKHR Linux

Juan Antonio Gutierrez RosasEmployee

Hi

I'm not an expert in Graphics, but if what you are trying to do is to create a texture from an IPU memory buffer, you can use the glTexDirectVIVMap API to map a virtual memory address buffer (texture_data) to the current bind texture (GL_TEXTURE_2D).

To indicate that physical address is unknown ~0U should be passed as the last argument.

Also you should call this API for each new frame rendered.

==================== Pseudo code =======================

GLuint physical = ~0U;

GLuint texture_id = 0;

void* texture_data = GetBuffer();   // virtual buffer addr

_texture = glGenTextures (1, &texture_id);

glTexParameterf (GL_TEXTURE_2D, <pname>, <pvalue>);

glBindTexture(GL_TEXTURE_2D, _texture);

glTexDirectVIVMap (GL_TEXTURE_2D, width, height, GL_VIV_NV12, (GLvoid**)(&texture_data), &physical);

glTexDirectInvalidateVIV (GL_TEXTURE_2D);

0 件の賞賛
返信