[Piglit] [PATCH 02/14] piglit-util-egl: check if EGL_EXT_client_extensions is supported
Marek Olšák
maraeo at gmail.com
Mon Apr 13 11:28:02 PDT 2015
From: Daniel Kurtz <djkurtz at chromium.org>
>From the EGL_EXT_client_extensions spec [0]
[0] https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_client_extensions.txt
1. How should clients detect if this extension is supported?
RESOLVED: If an EGL implementation supports this extension, then
`eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS)` returns
a well-formed extension string and generates no error. Otherwise, it
returns NULL and generates EGL_BAD_DISPLAY.
So, detect the case where EGL_EXT_client_extensions is not supported and
just return false indicating that the requested client extension is also
not supported.
This keeps piglit_is_extension_in_string() from crashing when it tries
to find a needle in a NULL haystack.
Signed-off-by: Daniel Kurtz <djkurtz at chromium.org>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
---
tests/util/piglit-util-egl.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/util/piglit-util-egl.c b/tests/util/piglit-util-egl.c
index 1754602..106c735 100644
--- a/tests/util/piglit-util-egl.c
+++ b/tests/util/piglit-util-egl.c
@@ -137,6 +137,16 @@ piglit_is_egl_extension_supported(EGLDisplay egl_dpy, const char *name)
const char *const egl_extension_list =
eglQueryString(egl_dpy, EGL_EXTENSIONS);
+ /*
+ * If EGL does not support EGL_EXT_client_extensions, then
+ * eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS) returns NULL and
+ * generates EGL_BAD_DISPLAY. In this case, just report that the
+ * requested (client) extension is not supported.
+ */
+ if (!egl_extension_list && egl_dpy == EGL_NO_DISPLAY &&
+ piglit_check_egl_error(EGL_BAD_DISPLAY))
+ return false;
+
return piglit_is_extension_in_string(egl_extension_list, name);
}
--
2.1.0
More information about the Piglit
mailing list