[Piglit] [PATCH 1/2] util/gl: Add test config option 'requires_displayed_window'

Chad Versace chad.versace at linux.intel.com
Mon Oct 15 16:06:37 PDT 2012


When running tests in -auto mode using waffle, piglit does not display the
window on the screen. The nice benefit of this is that test runs are
visually silent except for the rare glean and glx tests.

However, not displaying the window breaks tests that read from the front
buffer. After glXSwapBuffers, the content of the front buffer is undefined
if the window is not displayed.

Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/util/piglit-framework-gl.h                         | 7 +++++++
 tests/util/piglit-framework-gl/piglit_winsys_framework.c | 9 +++++++++
 2 files changed, 16 insertions(+)

diff --git a/tests/util/piglit-framework-gl.h b/tests/util/piglit-framework-gl.h
index 326bdbf..d1b8e67 100644
--- a/tests/util/piglit-framework-gl.h
+++ b/tests/util/piglit-framework-gl.h
@@ -160,6 +160,13 @@ struct piglit_gl_test_config {
 	int window_visual;
 
 	/**
+	 * The test requires the window to be displayed in order to run
+	 * correctly. Tests that read from the front buffer must enable
+	 * this.
+	 */
+	bool requires_displayed_window;
+
+	/**
 	 * This is called once per test, after the GL context has been created
 	 * and made current but before display() is called.
 	 */
diff --git a/tests/util/piglit-framework-gl/piglit_winsys_framework.c b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
index 020321b..ff869b6 100644
--- a/tests/util/piglit-framework-gl/piglit_winsys_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_winsys_framework.c
@@ -51,13 +51,22 @@ run_test(struct piglit_gl_framework *gl_fw,
 	struct piglit_winsys_framework *winsys_fw = piglit_winsys_framework(gl_fw);
 	enum piglit_result result = PIGLIT_PASS;
 
+	if (gl_fw->test_config->requires_displayed_window) {
+		/* Display the window before running the actual test. */
+		winsys_fw->show_window(winsys_fw);
+	}
+
 	if (gl_fw->test_config->init)
 		gl_fw->test_config->init(argc, argv);
 	if (gl_fw->test_config->display)
 		result = gl_fw->test_config->display();
+
 	if (piglit_automatic)
 		piglit_report_result(result);
 
+	/* In non-auto mode, the user wishes to see the window regardless
+	 * of the value of piglit_gl_test_config::require_displayed_window.
+	 */
 	winsys_fw->show_window(winsys_fw);
 	winsys_fw->enter_event_loop(winsys_fw);
 	abort();
-- 
1.7.11.7



More information about the Piglit mailing list