[Piglit] [PATCH 07/13] util/egl: Add EGLDisplay parameter to piglit_require_egl_extension()

Chad Versace chad.versace at linux.intel.com
Wed Mar 26 10:40:23 PDT 2014


Without an explicit EGLDisplay parameter, it's not possible to call
piglit_require_egl_extension() without first binding the display to
a context with eglMakeCurrent(). Some EGL tests, though, will never need
to or want to create a context.

Also, this makes the signature of piglit_require_egl_extension()
match that of piglit_is_egl_extension_supported().

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c    | 5 +++--
 .../ext_image_dma_buf_import/intel_external_sampler_with_dma_only.c  | 5 +++--
 tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c       | 5 +++--
 tests/spec/ext_image_dma_buf_import/invalid_attributes.c             | 3 ++-
 tests/spec/ext_image_dma_buf_import/invalid_hints.c                  | 3 ++-
 tests/spec/ext_image_dma_buf_import/missing_attributes.c             | 3 ++-
 tests/spec/ext_image_dma_buf_import/ownership_transfer.c             | 3 ++-
 tests/spec/ext_image_dma_buf_import/sample_rgb.c                     | 3 ++-
 tests/util/piglit-util-egl.c                                         | 4 ++--
 tests/util/piglit-util-egl.h                                         | 2 +-
 10 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c
index ee23b7f..8e989e5 100644
--- a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c
+++ b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_only.c
@@ -135,9 +135,10 @@ piglit_init(int argc, char **argv)
 {
 	static const char intel_id[] = "Intel Open Source Technology Center";
 	const char *vendor_str;
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
 
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
-	piglit_require_egl_extension("EGL_KHR_image_base");
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
+	piglit_require_egl_extension(egl_dpy, "EGL_KHR_image_base");
 
 	vendor_str = (const char *)glGetString(GL_VENDOR);
 	if (strncmp(vendor_str, intel_id, sizeof(intel_id) - 1) != 0) {
diff --git a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_dma_only.c b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_dma_only.c
index 414a082..6b5c7a1 100644
--- a/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_dma_only.c
+++ b/tests/spec/ext_image_dma_buf_import/intel_external_sampler_with_dma_only.c
@@ -91,9 +91,10 @@ piglit_init(int argc, char **argv)
 {
 	static const char intel_id[] = "Intel Open Source Technology Center";
 	const char *vendor_str;
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
 
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
-	piglit_require_egl_extension("EGL_KHR_image_base");
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
+	piglit_require_egl_extension(egl_dpy, "EGL_KHR_image_base");
 
 	vendor_str = (const char *)glGetString(GL_VENDOR);
 	if (strncmp(vendor_str, intel_id, sizeof(intel_id) - 1) != 0) {
diff --git a/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c b/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c
index 67fda9b..836a7fe 100644
--- a/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c
+++ b/tests/spec/ext_image_dma_buf_import/intel_unsupported_format.c
@@ -98,9 +98,10 @@ piglit_init(int argc, char **argv)
 {
 	static const char intel_id[] = "Intel Open Source Technology Center";
 	const char *vendor_str;
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
 
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
-	piglit_require_egl_extension("EGL_KHR_image_base");
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
+	piglit_require_egl_extension(egl_dpy, "EGL_KHR_image_base");
 
 	vendor_str = (const char *)glGetString(GL_VENDOR);
 
diff --git a/tests/spec/ext_image_dma_buf_import/invalid_attributes.c b/tests/spec/ext_image_dma_buf_import/invalid_attributes.c
index e484056..8c44298 100644
--- a/tests/spec/ext_image_dma_buf_import/invalid_attributes.c
+++ b/tests/spec/ext_image_dma_buf_import/invalid_attributes.c
@@ -254,5 +254,6 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
 }
diff --git a/tests/spec/ext_image_dma_buf_import/invalid_hints.c b/tests/spec/ext_image_dma_buf_import/invalid_hints.c
index 462e6c7..c1c9be3 100644
--- a/tests/spec/ext_image_dma_buf_import/invalid_hints.c
+++ b/tests/spec/ext_image_dma_buf_import/invalid_hints.c
@@ -134,5 +134,6 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
 }
diff --git a/tests/spec/ext_image_dma_buf_import/missing_attributes.c b/tests/spec/ext_image_dma_buf_import/missing_attributes.c
index 5b4f670..a0309d6 100644
--- a/tests/spec/ext_image_dma_buf_import/missing_attributes.c
+++ b/tests/spec/ext_image_dma_buf_import/missing_attributes.c
@@ -155,5 +155,6 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
 }
diff --git a/tests/spec/ext_image_dma_buf_import/ownership_transfer.c b/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
index fcd1951..ff51810 100644
--- a/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
+++ b/tests/spec/ext_image_dma_buf_import/ownership_transfer.c
@@ -127,5 +127,6 @@ piglit_display(void)
 void
 piglit_init(int argc, char **argv)
 {
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
 }
diff --git a/tests/spec/ext_image_dma_buf_import/sample_rgb.c b/tests/spec/ext_image_dma_buf_import/sample_rgb.c
index df04192..f279730 100644
--- a/tests/spec/ext_image_dma_buf_import/sample_rgb.c
+++ b/tests/spec/ext_image_dma_buf_import/sample_rgb.c
@@ -77,8 +77,9 @@ void
 piglit_init(int argc, char **argv)
 {
 	unsigned i;
+	EGLDisplay egl_dpy = eglGetCurrentDisplay();
 
-	piglit_require_egl_extension("EGL_EXT_image_dma_buf_import");
+	piglit_require_egl_extension(egl_dpy, "EGL_EXT_image_dma_buf_import");
 	piglit_require_extension("GL_OES_EGL_image_external");
 
 	for (i = 1; i < argc; i++) {
diff --git a/tests/util/piglit-util-egl.c b/tests/util/piglit-util-egl.c
index 624b8be..5ce09d9 100644
--- a/tests/util/piglit-util-egl.c
+++ b/tests/util/piglit-util-egl.c
@@ -85,9 +85,9 @@ piglit_is_egl_extension_supported(EGLDisplay egl_dpy, const char *name)
 	return piglit_is_extension_in_string(egl_extension_list, name);
 }
 
-void piglit_require_egl_extension(const char *name)
+void piglit_require_egl_extension(EGLDisplay dpy, const char *name)
 {
-	if (!piglit_is_egl_extension_supported(eglGetCurrentDisplay(), name)) {
+	if (!piglit_is_egl_extension_supported(dpy, name)) {
 		printf("Test requires %s\n", name);
 		piglit_report_result(PIGLIT_SKIP);
 	}
diff --git a/tests/util/piglit-util-egl.h b/tests/util/piglit-util-egl.h
index 62ce749..d8fa0d2 100644
--- a/tests/util/piglit-util-egl.h
+++ b/tests/util/piglit-util-egl.h
@@ -62,7 +62,7 @@ bool piglit_is_egl_extension_supported(EGLDisplay egl_dpy, const char *name);
 /**
  * \brief Checks for EGL extension and skips if not supported
  */
-void piglit_require_egl_extension(const char *name);
+void piglit_require_egl_extension(EGLDisplay dpy, const char *name);
 
 /**
  * \brief Wrapper for eglBindAPI().
-- 
1.8.5.3



More information about the Piglit mailing list