xf86-video-intel: src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Oct 4 01:09:04 PDT 2013


 src/sna/sna_display.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

New commits:
commit aa439ffee4ea0926b382c0f0fb5d41feae9d0f8f
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Oct 4 09:07:30 2013 +0100

    sna: The device fd is marked as non-blocking so beware the busy-wait
    
    During redisplay we wait for the pageflip result. If the fd is marked as
    non-blocking this results in a busy-wait, so insert a poll first to
    remove the busy-wait.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_display.c b/src/sna/sna_display.c
index 1379605..95ce1b0 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -155,6 +155,14 @@ static bool sna_mode_has_pending_events(struct sna *sna)
 	return poll(&pfd, 1, 0) == 1;
 }
 
+static bool sna_mode_wait_for_event(struct sna *sna)
+{
+	struct pollfd pfd;
+	pfd.fd = sna->kgem.fd;
+	pfd.events = POLLIN;
+	return poll(&pfd, 1, -1) == 1;
+}
+
 #define BACKLIGHT_CLASS "/sys/class/backlight"
 
 /* Enough for 10 digits of backlight + '\n' + '\0' */
@@ -4228,7 +4236,8 @@ disable:
 		}
 
 		if (sna->mode.shadow) {
-			while (sna->mode.shadow_flip)
+			while (sna->mode.shadow_flip &&
+			       sna_mode_wait_for_event(sna))
 				sna_mode_wakeup(sna);
 			(void)sna->render.copy_boxes(sna, GXcopy,
 						     sna->front, new, 0, 0,


More information about the xorg-commit mailing list