Only 3.19 will have O_NONBLOCK for drm_read(), so the
current ddx will still "stutter" in ZaphodHead mode on
current kernels. Fix the problem by adding a poll() on
the drm fd before potentially blocking on read().

The logic is directly transplanted from the uxa backend
intel_mode_read_drm_events() function.

Fixes fdo bug #84744 on older kernels.

Signed-off-by: Mario Kleiner <mario.kleiner...@gmail.com>
---
 src/sna/sna_display.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 1633333..a7ad6cc 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -7390,7 +7390,16 @@ fixup_flip:
 void sna_mode_wakeup(struct sna *sna)
 {
        char buffer[1024];
-       int len, i;
+       int len, i, r;
+       struct pollfd p = { .fd = sna->kgem.fd, .events = POLLIN };
+
+       /* DRM read is blocking on old kernels, so poll first to avoid it. */
+       do {
+               r = poll(&p, 1, 0);
+       } while (r == -1 && (errno == EINTR || errno == EAGAIN));
+
+       if (r <= 0)
+               return;
 
        /* The DRM read semantics guarantees that we always get only
         * complete events.
-- 
1.9.1

_______________________________________________
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to