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

Emil Velikov emil.l.velikov at gmail.com
Mon Dec 11 20:15:19 UTC 2017


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.

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) ||
-- 
2.15.0



More information about the Piglit mailing list