Module: Demos Branch: master Commit: 2b304e765695d385fd3bf414e6e444020bedb0a8 URL: http://cgit.freedesktop.org/mesa/demos/commit/?id=2b304e765695d385fd3bf414e6e444020bedb0a8
Author: Awais Belal <[email protected]> Date: Mon Oct 12 07:32:37 2015 -0600 sharedtex_mt: fix rendering thread hang XNextEvent is a blocking call which locks up the display mutex. This causes the rendering threads to hang when they call glXSwapBuffers() as that tries to take the same mutex in underlying calls through XCopyArea(). So we only call XNextEvent when it has at least one event so we don't lock indefinitely. Patch slightly fixed by Brian to keep var declarations as-is and clean up the patch description. Signed-off-by: Awais Belal <[email protected]> Reviewed-by: Brian Paul <[email protected]> --- src/xdemos/sharedtex_mt.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/xdemos/sharedtex_mt.c b/src/xdemos/sharedtex_mt.c index a90903a..2068d4b 100644 --- a/src/xdemos/sharedtex_mt.c +++ b/src/xdemos/sharedtex_mt.c @@ -423,6 +423,13 @@ EventLoop(void) while (1) { int i; XEvent event; + + /* Do we have an event? */ + if (XPending(gDpy) == 0) { + usleep(10000); + continue; + } + XNextEvent(gDpy, &event); for (i = 0; i < NumWindows; i++) { struct window *h = &Windows[i]; _______________________________________________ mesa-commit mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/mesa-commit
