[Mesa-dev] EGL_BAD_CONTEXT error when creating shared context

Brian Paul brianp at vmware.com
Wed May 29 07:17:41 PDT 2013


On 05/29/2013 12:56 AM, Divick Kishore wrote:
> Hi Brian,
>              thanks for your reply.
>
> On Tue, May 28, 2013 at 9:33 PM, Brian Paul <brianp at vmware.com> wrote:
>> I took at look at eglCreateContext().  It's basically:
>>
>> EGLContext
>> eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_list,
>>                   const EGLint *attrib_list)
>> {
>>     _EGLContext *share = _eglLookupContext(share_list, disp);
>>     ...
>>
>>     if (!share && share_list != EGL_NO_CONTEXT)
>>        RETURN_EGL_ERROR(disp, EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
>>     ...
>> }
>>
>> If the error is coming from there, it means that the share_list context
>> you're passing in isn't recognized by EGL as a valid context.
>
> I did have a look at the source but couldn't understand really why
>
> _EGLContext *share = _eglLookupContext(share_list, disp);
>
> returns a NULL value for share. Had a look a bit more deeper and I saw
> that the display values for both the contexts were different. I then
> modified my code then not to open a new display for the new context
> instead share the display with the older one and then everything
> worked like a charm.

That may be a bug in our EGL.  We only allow sharing of contexts created 
with the same display.  But I took a quick look at the EGL spec and I 
didn't see such a restriction.  Maybe someone else can dig into that a 
bit more.


> Thanks for your help. First step is usually the hardest step, so thank
> for pointing in the right direction.
>
> Another thing that I wanted to check was that I have ported some of
> the performance demos from mesa demos to use EGL and GLES2.0. If it is
> useful in general to community then how can I get the sources reviewed
> and commit to mesa demos repository?

You can post patches for review to the mesa-dev list.

-Brian




More information about the mesa-dev mailing list