xserver: Branch 'master' - 6 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Apr 8 09:15:51 PDT 2013


 hw/xfree86/os-support/linux/lnx_platform.c |   40 +++++++++++++++++++++++------
 1 file changed, 32 insertions(+), 8 deletions(-)

New commits:
commit e13f29984251dbbe6076264ed710c2922312eed1
Author: Bryce Harrington <bryce at canonical.com>
Date:   Tue Mar 19 12:12:46 2013 -0700

    xfree86: Be verbose if waiting on opening the drm device
    
    Signed-off-by: Bryce Harrington <bryce at canonical.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 977d590..444f8f5 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -43,7 +43,10 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
 	    if (tries > 1)
 		LogMessage(X_INFO, "setversion 1.4 succeeded on try #%d\n", tries);
 	    break;
-	} else if (err != -EACCES) {
+	} if (err == -EACCES) {
+	    if (tries % 500 == 0)
+		LogMessage(X_INFO, "waiting on drm device...\n");
+	} else {
 	    break;
 	}
 
commit 70739e817b2d64bc020ea491f23a3574bdb6155e
Author: Bryce Harrington <bryce at canonical.com>
Date:   Tue Mar 19 12:12:45 2013 -0700

    xfree86: Fix race condition failure opening drm.
    
    If other processes have had drm open previously, xserver may attempt to
    open the device too early and fail, with xserver error exit "Cannot
    run in framebuffer mode" or Xorg.0.log messages about "setversion 1.4
    failed".
    
    In this situation, we're receiving back -EACCES from libdrm.  To address
    this we need to re-set ourselves as the drm master, and keep trying to
    set the interface until it works (or until we give up).
    
    See https://bugs.launchpad.net/ubuntu/+source/libdrm/+bug/982889
    
    Signed-off-by: Bryce Harrington <bryce at canonical.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 10c8ecf..977d590 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -43,8 +43,14 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
 	    if (tries > 1)
 		LogMessage(X_INFO, "setversion 1.4 succeeded on try #%d\n", tries);
 	    break;
+	} else if (err != -EACCES) {
+	    break;
 	}
+
 	usleep(10000);
+
+	if (!drmSetMaster(fd))
+	    LogMessage(X_INFO, "drmSetMaster succeeded\n");
     }
     if (err) {
         ErrorF("setversion 1.4 failed: %s\n", strerror(-err));
commit c31eac647a9ecf0fb20dc98266cadf0ba923ba14
Author: Bryce Harrington <bryce at canonical.com>
Date:   Tue Mar 19 12:12:44 2013 -0700

    xfree86: Keep trying to set interface on drm for 2 seconds.
    
    And if we've had to delay booting due to not being able to set the
    interface, fess up.
    
    Signed-off-by: Bryce Harrington <bryce at canonical.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 3ae2db1..10c8ecf 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -26,16 +26,26 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
     char *buf;
     int fd;
     int err = 0;
+    int tries = 0;
 
     fd = open(path, O_RDWR, O_CLOEXEC);
     if (fd == -1)
         return FALSE;
 
-    sv.drm_di_major = 1;
-    sv.drm_di_minor = 4;
-    sv.drm_dd_major = -1;       /* Don't care */
-    sv.drm_dd_minor = -1;       /* Don't care */
-    err = drmSetInterfaceVersion(fd, &sv);
+    while (tries++ < 200) {
+	sv.drm_di_major = 1;
+	sv.drm_di_minor = 4;
+	sv.drm_dd_major = -1;       /* Don't care */
+	sv.drm_dd_minor = -1;       /* Don't care */
+
+	err = drmSetInterfaceVersion(fd, &sv);
+	if (!err) {
+	    if (tries > 1)
+		LogMessage(X_INFO, "setversion 1.4 succeeded on try #%d\n", tries);
+	    break;
+	}
+	usleep(10000);
+    }
     if (err) {
         ErrorF("setversion 1.4 failed: %s\n", strerror(-err));
 	goto out;
commit d1cc210de8c13f2db9f6f284ecc652305c28801e
Author: Bryce Harrington <bryce at canonical.com>
Date:   Tue Mar 19 12:12:43 2013 -0700

    xfree86: Provide more details on failure
    
    Signed-off-by: Bryce Harrington <bryce at canonical.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 6ee219a..3ae2db1 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -7,6 +7,8 @@
 #include <xf86drm.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <errno.h>
+#include <string.h>
 
 /* Linux platform device support */
 #include "xf86_OSproc.h"
@@ -35,7 +37,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
     sv.drm_dd_minor = -1;       /* Don't care */
     err = drmSetInterfaceVersion(fd, &sv);
     if (err) {
-        ErrorF("setversion 1.4 failed\n");
+        ErrorF("setversion 1.4 failed: %s\n", strerror(-err));
 	goto out;
     }
 
commit f059d0dabc553a5f748d86de9115da00be5997d5
Author: Bryce Harrington <bryce at canonical.com>
Date:   Tue Mar 19 12:12:42 2013 -0700

    xfree86: Track error code and add label for error handling.
    
    Signed-off-by: Bryce Harrington <bryce at canonical.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 69a5b8c..6ee219a 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -23,6 +23,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
     drmSetVersion sv;
     char *buf;
     int fd;
+    int err = 0;
 
     fd = open(path, O_RDWR, O_CLOEXEC);
     if (fd == -1)
@@ -32,10 +33,10 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
     sv.drm_di_minor = 4;
     sv.drm_dd_major = -1;       /* Don't care */
     sv.drm_dd_minor = -1;       /* Don't care */
-    if (drmSetInterfaceVersion(fd, &sv)) {
+    err = drmSetInterfaceVersion(fd, &sv);
+    if (err) {
         ErrorF("setversion 1.4 failed\n");
-	close(fd);
-        return FALSE;
+	goto out;
     }
 
     xf86_add_platform_device(attribs);
@@ -44,8 +45,9 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
     xf86_add_platform_device_attrib(xf86_num_platform_devices - 1,
                                     ODEV_ATTRIB_BUSID, buf);
     drmFreeBusid(buf);
+out:
     close(fd);
-    return TRUE;
+    return (err == 0);
 }
 
 Bool
commit 4d7052bd7bbf49b573dc4d34ad14e7f058a0d884
Author: Bryce Harrington <bryce at canonical.com>
Date:   Tue Mar 19 12:12:41 2013 -0700

    xfree86: (Cleanup) Close fd if drm interface 1.4 could not be set.
    
    Signed-off-by: Bryce Harrington <bryce at canonical.com>
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 76f5583..69a5b8c 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -34,6 +34,7 @@ get_drm_info(struct OdevAttributes *attribs, char *path)
     sv.drm_dd_minor = -1;       /* Don't care */
     if (drmSetInterfaceVersion(fd, &sv)) {
         ErrorF("setversion 1.4 failed\n");
+	close(fd);
         return FALSE;
     }
 


More information about the xorg-commit mailing list