xf86-video-intel: 2 commits - src/backlight.c src/sna/sna_display.c

Chris Wilson ickle at kemper.freedesktop.org
Fri Nov 18 16:33:18 UTC 2016


 src/backlight.c       |   28 ++++++++++++++++++++++------
 src/sna/sna_display.c |   18 +++++++++++++++++-
 2 files changed, 39 insertions(+), 7 deletions(-)

New commits:
commit bde946054efbc1c7ae1483b84c3b4fa3c2c7e2ec
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Nov 17 19:22:02 2016 +0000

    backlight: Protect iface writes against signal interruptions
    
    Handle EINTR (and EAGAIN) by repeating until the write is complete.
    
    References: https://bugs.freedesktop.org/show_bug.cgi?id=98759
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/backlight.c b/src/backlight.c
index d020a7c..3cba577 100644
--- a/src/backlight.c
+++ b/src/backlight.c
@@ -48,6 +48,7 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <dirent.h>
+#include <errno.h>
 
 #include <xorg-server.h>
 #include <xf86.h>
@@ -216,6 +217,24 @@ __backlight_read(const char *iface, const char *file)
 }
 
 static int
+writen(int fd, const char *value, int len)
+{
+	int ret;
+
+	do {
+		ret = write(fd, value, len);
+		if (ret < 0) {
+			if (errno == EAGAIN || errno == EINTR)
+				continue;
+
+			return ret;
+		}
+	} while (value += ret, len -= ret);
+
+	return 0;
+}
+
+static int
 __backlight_write(const char *iface, const char *file, const char *value)
 {
 	int fd, ret;
@@ -224,7 +243,7 @@ __backlight_write(const char *iface, const char *file, const char *value)
 	if (fd < 0)
 		return -1;
 
-	ret = write(fd, value, strlen(value)+1);
+	ret = writen(fd, value, strlen(value)+1);
 	close(fd);
 
 	return ret;
@@ -458,7 +477,7 @@ err:
 int backlight_set(struct backlight *b, int level)
 {
 	char val[BACKLIGHT_VALUE_LEN];
-	int len, ret = 0;
+	int len;
 
 	if (b->iface == NULL)
 		return 0;
@@ -467,10 +486,7 @@ int backlight_set(struct backlight *b, int level)
 		level = b->max;
 
 	len = snprintf(val, BACKLIGHT_VALUE_LEN, "%d\n", level);
-	if (write(b->fd, val, len) != len)
-		ret = -1;
-
-	return ret;
+	return writen(b->fd, val, len);
 }
 
 int backlight_get(struct backlight *b)
commit 04491bbdaa461aff1a6734a4c2cda093a8ce3482
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Fri Nov 18 16:31:44 2016 +0000

    sna: Set reprobe flag on attached connectors after setcrtc failure
    
    The most common cause of SETCRTC failure is if the connectors disappear.
    Force the reprobe on these after a failure.
    
    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 9f8f862..1b89cfd 100644
--- a/src/sna/sna_display.c
+++ b/src/sna/sna_display.c
@@ -3011,6 +3011,21 @@ static const char *reflection_to_str(Rotation rotation)
 	}
 }
 
+static void reprobe_connectors(xf86CrtcPtr crtc)
+{
+	xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(crtc->scrn);
+	struct sna *sna = to_sna(crtc->scrn);
+	int i;
+
+	for (i = 0; i < sna->mode.num_real_output; i++) {
+		xf86OutputPtr output = config->output[i];
+		if (output->crtc == crtc)
+			to_sna_output(output)->reprobe = true;
+	}
+
+	sna_mode_discover(sna, true);
+}
+
 static Bool
 __sna_crtc_set_mode(xf86CrtcPtr crtc)
 {
@@ -3105,7 +3120,8 @@ error:
 	sna_crtc->cursor_transform = saved_cursor_transform;
 	sna_crtc->hwcursor = saved_hwcursor;
 	sna_crtc->bo = saved_bo;
-	sna_mode_discover(sna, true);
+
+	reprobe_connectors(crtc);
 	return FALSE;
 }
 


More information about the xorg-commit mailing list