Does iMX6 support egl context sharing between multiple threads?

cancel
Showing results for 
Search instead for 
Did you mean: 

Does iMX6 support egl context sharing between multiple threads?

896 Views
andrechung
Contributor I

Hi all.

Currently I used Vivante OpenGLES 1.1 and EGL 1.4 library in i.MX6 platform, and I want to share egl context between two different threads.


Here is my implementation:

Thread 1:

mSharedContext = eglCreateContext( egl_display, egl_config, NULL, contextAttrbs);

... ...

Thread 2:

mContext = eglCreateContext( egl_display, egl_config, mSharedContext , contextAttrbs);

There was no error in Thread 1, but eglGetError() always returns EGL_BAD_MATCH when running eglCreateContext in Thread 2.

So I wonder Vivante OpenGLES 1.1 library in i.MX6 platform could support context sharing between multiple threads.

Any help is appreciated in advance.

Labels (4)
Tags (4)
0 Kudos
2 Replies

185 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Andre,

Check if the context are compatible, according to EGL documentation,

EGL_BAD_MATCH is generated if the current rendering API is EGL_NONE (this can only arise in an EGL implementation which does not support OpenGL ES, prior to the first call to eglBindAPI).

EGL_BAD_MATCH is generated if the server context state for share_context exists in an address space which cannot be shared with the newly created context, if share_context was created on a different display than the one referenced by config.

Also make sure that you are not calling eglInitialize every time you create a context.

Regards

185 Views
andrechung
Contributor I

Hi,

Thanks for your reply.

I checked my code and here are my conclusion:

1. I've tested eglQueryAPI, it returns EGL_OPENGL_ES_API, seems I bound API correctly.

2. I passed the same egl_display and egl_config into two different thread's eglCreateContext (checked by eglGetConfigAttrib, returns the same EGL_CONFIG_ID).

3. I called eglInitialize only one time after calling eglGetDisplay.

So I'm afraid that the shared_context was not in the same address space so eglGetError always returns EGL_BAD_MATCH when I call eglCreateContext in Thread2.

Is there any way to verify the address space between two threads? Or maybe I'm just missed some details?

Thanks.

0 Kudos