[PATCH weston] gl-renderer: fix EGL initialization steps

Manuel Bachmann manuel.bachmann at open.eurogiciel.org
Thu Apr 2 22:05:23 PDT 2015


From: Manuel Bachmann <manuel.bachmann at open.eurogiciel.org>

Some DRI drivers, including VMware vmwgfx, do not support
calling eglQueryString() with a EGL_NO_DISPLAY parameter.
Just as we do in gl_renderer_supports(), which returns 0
but does not fail in this case, do not fail in
gl_renderer_setup_egl_extensions().

With some versions of Mesa, EGL client extensions may
very well be defined without the corresponding platform
extensions ("EGL_EXT_platform_x11/wayland/gbm"). Do not
fail in this case, but report lack of information.

Signed-off-by: Manuel Bachmann <manuel.bachmann at open.eurogiciel.org>
---
 src/gl-renderer.c | 33 ++++++++++++++++++---------------
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/src/gl-renderer.c b/src/gl-renderer.c
index b3b2364..d9b6a66 100644
--- a/src/gl-renderer.c
+++ b/src/gl-renderer.c
@@ -2136,7 +2136,7 @@ gl_renderer_setup_egl_extensions(struct weston_compositor *ec)
 		(const char *) eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS);
 	if (!extensions) {
 		weston_log("Retrieving EGL client extension string failed.\n");
-		return -1;
+		return 0;
 	}
 
 	if (strstr(extensions, "EGL_EXT_platform_base"))
@@ -2213,23 +2213,26 @@ gl_renderer_supports(struct weston_compositor *ec,
 			       extensions);
 	}
 
-	snprintf(s, sizeof s, "EGL_KHR_platform_%s", extension_suffix);
-	if (strstr(extensions, s))
-		return 1;
+	if (strstr(extensions, "EGL_EXT_client_extensions")) {
+		snprintf(s, sizeof s, "EGL_KHR_platform_%s", extension_suffix);
+		if (strstr(extensions, s))
+			return 1;
 
-	snprintf(s, sizeof s, "EGL_EXT_platform_%s", extension_suffix);
-	if (strstr(extensions, s))
-		return 1;
+		snprintf(s, sizeof s, "EGL_EXT_platform_%s", extension_suffix);
+		if (strstr(extensions, s))
+			return 1;
 
-	snprintf(s, sizeof s, "EGL_MESA_platform_%s", extension_suffix);
-	if (strstr(extensions, s))
-		return 1;
+		snprintf(s, sizeof s, "EGL_MESA_platform_%s", extension_suffix);
+		if (strstr(extensions, s))
+			return 1;
 
-	/* at this point we definitely have some client extensions but
-	 * haven't found the supplied client extension, so chances are it's
-	 * not supported. */
-
-	return -1;
+		/* at this point we definitely have some client extensions but
+		 * haven't found the supplied client extension, so it may be
+		 * supported or not. */
+		return 0;
+	} else {
+		return -1;
+	}
 }
 
 static const char *
-- 
1.8.3.1



More information about the wayland-devel mailing list