On 12/11/2017 10:15 PM, Emil Velikov wrote:
From: Emil Velikov <emil.veli...@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.

However I'm fine with this change, it should not change anything.

Cc: Ian Romanick <ian.d.roman...@intel.com>
Cc: Michel Dänzer <michel.daen...@amd.com>
Signed-off-by: Emil Velikov <emil.veli...@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@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit

Reply via email to