[Piglit] [PATCH 2/5] egl: split out a piglit_egl_get_display helper

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


From: Emil Velikov <emil.velikov at collabora.com>

Some places (like the next patch) want to pass non-default dpy.

Cc: Ian Romanick <ian.d.romanick at intel.com>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
 tests/util/piglit-util-egl.c | 10 ++++++++--
 tests/util/piglit-util-egl.h | 11 ++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/tests/util/piglit-util-egl.c b/tests/util/piglit-util-egl.c
index 389fe1202..0f08f8cfd 100644
--- a/tests/util/piglit-util-egl.c
+++ b/tests/util/piglit-util-egl.c
@@ -78,6 +78,12 @@ piglit_check_egl_error(EGLint expected_error)
 
 EGLDisplay
 piglit_egl_get_default_display(EGLenum platform)
+{
+	return piglit_egl_get_display(platform, EGL_DEFAULT_DISPLAY);
+}
+
+EGLDisplay
+piglit_egl_get_display(EGLenum platform, void *native_display)
 {
 	static bool once = true;
 
@@ -90,7 +96,7 @@ piglit_egl_get_default_display(EGLenum platform)
 	static EGLDisplay (*peglGetPlatformDisplayEXT)(EGLenum platform, void *native_display, const EGLint *attrib_list);
 
 	if (platform == EGL_NONE) {
-		return eglGetDisplay(EGL_DEFAULT_DISPLAY);
+		return eglGetDisplay(native_display);
 	}
 
 	if (once) {
@@ -135,7 +141,7 @@ piglit_egl_get_default_display(EGLenum platform)
 		return EGL_NO_DISPLAY;
 	}
 
-	return peglGetPlatformDisplayEXT(platform, EGL_DEFAULT_DISPLAY, NULL);
+	return peglGetPlatformDisplayEXT(platform, native_display, NULL);
 }
 
 bool
diff --git a/tests/util/piglit-util-egl.h b/tests/util/piglit-util-egl.h
index d85eb607d..9f8e10822 100644
--- a/tests/util/piglit-util-egl.h
+++ b/tests/util/piglit-util-egl.h
@@ -71,6 +71,15 @@ piglit_check_egl_error(EGLint expected_error);
 /**
  * \brief Get default display for given platform.
  *
+ * This function wraps piglit_egl_get_display, providing \c EGL_DEFAULT_DISPLAY
+ * for the native_display.
+ */
+EGLDisplay
+piglit_egl_get_default_display(EGLenum platform);
+
+/**
+ * \brief Get display for given platform with native_display.
+ *
  * If \a platform is EGL_NONE, the this function wraps eglGetDisplay().
  * Otherwise, it wraps eglGetPlatformDisplayEXT().
  *
@@ -80,7 +89,7 @@ piglit_check_egl_error(EGLint expected_error);
  * then return EGL_NO_DISPLAY.
  */
 EGLDisplay
-piglit_egl_get_default_display(EGLenum platform);
+piglit_egl_get_display(EGLenum platform, void *native_display);
 
 /**
  * \brief Checks whether an EGL extension is supported.
-- 
2.15.0



More information about the Piglit mailing list