[Mesa-dev] [mesa-dev, mesa-demos][PATCH] sharedtex_mt: fix rendering thread hang

Belal, Awais Awais_Belal at mentor.com
Mon Oct 12 04:25:07 PDT 2015


Hi,

Is there are a reservation against the below patch?

BR,
Awais

________________________________________
From: mesa-dev [mesa-dev-bounces at lists.freedesktop.org] on behalf of Belal, Awais
Sent: Thursday, October 08, 2015 2:00 PM
To: mesa-dev at lists.freedesktop.org
Subject: [Mesa-dev] [mesa-dev,  mesa-demos][PATCH] 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 try call
glXSwapBuffers() as that tries to take the same mutex in
underlying calls through XCopyArea().
So we only go to XNextEvent when it has at least one event
and we wouldn't lock indefinitely.

Signed-off-by: Awais Belal <awais_belal at mentor.com>
---
 src/xdemos/sharedtex_mt.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/xdemos/sharedtex_mt.c b/src/xdemos/sharedtex_mt.c
index a90903a..1d503c4 100644
--- a/src/xdemos/sharedtex_mt.c
+++ b/src/xdemos/sharedtex_mt.c
@@ -420,9 +420,14 @@ Resize(struct window *h, unsigned int width, unsigned int height)
 static void
 EventLoop(void)
 {
+   int i;
+   XEvent event;
    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];
--
1.9.1

_______________________________________________
mesa-dev mailing list
mesa-dev at lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list