[Piglit] [PATCH 1/5] egl: Call eglBindAPI after eglInitialize

Tapani Pälli tapani.palli at intel.com
Tue Dec 12 09:08:08 UTC 2017



On 12/12/2017 10:23 AM, Tapani Pälli wrote:
> 
> On 12/11/2017 10:15 PM, Emil Velikov wrote:
>> From: Emil Velikov <emil.velikov at collabora.com>
>>
>> A couple of tests were calling eglBindAPI before eglInitialize.
>> Some versions of Mesa had problem with such invocation order and the
>> seeming consensus was that apps should not do that.
>>
>> This is likely a copy/paste mistake, that was also present in Xserver.
>> Yet the latter was fixed ~1 year ago, while the piglit tests remained in
>> iffy state.
> 
> Nope, it is just fine to call eglBindAPI before eglInitialize. It would 
> be a Mesa bug to not allow that.

I realized I did not state any rationale for this :) Main thing is that 
EGL spec says that eglBindAPI is per thread (not per display) and there 
is no text indicating in the spec that would prevent eglBindAPI to not 
be called before eglInitialize (which is to initialize display).

> However I'm fine with this change, it should not change anything.
> 
>> Cc: Ian Romanick <ian.d.romanick at intel.com>
>> Cc: Michel Dänzer <michel.daenzer at amd.com>
>> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
>> ---
>>   tests/egl/egl-configless-context.c |  4 ++--
>>   tests/egl/egl-util.c               | 16 ++++++++--------
>>   2 files changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/tests/egl/egl-configless-context.c 
>> b/tests/egl/egl-configless-context.c
>> index ce98465ef..9443e7503 100644
>> --- a/tests/egl/egl-configless-context.c
>> +++ b/tests/egl/egl-configless-context.c
>> @@ -343,8 +343,6 @@ main(int argc, char **argv)
>>           piglit_report_result(PIGLIT_SKIP);
>>       }
>> -    eglBindAPI(EGL_OPENGL_API);
>> -
>>       state.egl_dpy = eglGetDisplay(state.dpy);
>>       if (state.egl_dpy == EGL_NO_DISPLAY) {
>>           fprintf(stderr, "eglGetDisplay() failed\n");
>> @@ -356,6 +354,8 @@ main(int argc, char **argv)
>>           piglit_report_result(PIGLIT_FAIL);
>>       }
>> +    eglBindAPI(EGL_OPENGL_API);
>> +
>>       if (!piglit_is_egl_extension_supported(state.egl_dpy,
>>                              "EGL_MESA_configless_context")) {
>>           fprintf(stderr,
>> diff --git a/tests/egl/egl-util.c b/tests/egl/egl-util.c
>> index 1676cc740..8af1a4cbd 100644
>> --- a/tests/egl/egl-util.c
>> +++ b/tests/egl/egl-util.c
>> @@ -217,14 +217,6 @@ egl_util_run(const struct egl_test *test, int 
>> argc, char *argv[])
>>           }
>>       }
>> -    /* bind chosen API and set ctxattribs if using ES */
>> -    if (api_bit == EGL_OPENGL_BIT)
>> -        eglBindAPI(EGL_OPENGL_API);
>> -    else {
>> -        eglBindAPI(EGL_OPENGL_ES_API);
>> -        ctxAttribs = ctxAttribsES;
>> -    }
>> -
>>       /* choose dispatch_api and set ctx version to ctxAttribs if 
>> using ES */
>>       switch (api_bit) {
>>       case EGL_OPENGL_ES_BIT:
>> @@ -254,6 +246,14 @@ egl_util_run(const struct egl_test *test, int 
>> argc, char *argv[])
>>           goto fail;
>>       }
>> +    /* bind chosen API and set ctxattribs if using ES */
>> +    if (api_bit == EGL_OPENGL_BIT)
>> +        eglBindAPI(EGL_OPENGL_API);
>> +    else {
>> +        eglBindAPI(EGL_OPENGL_ES_API);
>> +        ctxAttribs = ctxAttribsES;
>> +    }
>> +
>>       check_extensions(&state, test);
>>       if (!eglChooseConfig(state.egl_dpy, test->config_attribs, 
>> &state.cfg, 1, &count) ||
>>
> _______________________________________________
> Piglit mailing list
> Piglit at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/piglit


More information about the Piglit mailing list