[Piglit] [PATCH] util/x11: Don't spin when waiting for X events

Chad Versace chad.versace at linux.intel.com
Thu May 30 15:57:36 PDT 2013


The nasty spin consumed 100% cpu when tests were ran in non-auto mode.
No behavioral change when running tests in auto mode.

This patch is semantically equivalent to:
    while (true) {
-       if (!XPending(dpy))
-           continue;
        XNextEvent(dpy, &event);
        handle_event(event);
    }

CC: Eric Anholt <eric at anholt.net>
CC: Paul Berry <stereotype441 at gmail.com>
Signed-off-by: Chad Versace <chad.versace at linux.intel.com>
---
 tests/util/piglit-framework-gl/piglit_x11_framework.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/tests/util/piglit-framework-gl/piglit_x11_framework.c b/tests/util/piglit-framework-gl/piglit_x11_framework.c
index dafd370..e4bf9b9 100644
--- a/tests/util/piglit-framework-gl/piglit_x11_framework.c
+++ b/tests/util/piglit-framework-gl/piglit_x11_framework.c
@@ -80,9 +80,6 @@ process_next_event(struct piglit_x11_framework *x11_fw)
 	Display *dpy = x11_fw->display;
 	XEvent event;
 
-	if (!XPending(dpy))
-		return;
-
 	XNextEvent(dpy, &event);
 
 	switch (event.type) {
-- 
1.8.1.4



More information about the Piglit mailing list