xserver: Branch 'master' - 5 commits

Keith Packard keithp at kemper.freedesktop.org
Mon Mar 10 08:46:46 PDT 2014


 config/config.c                              |   31 ++++++++++++++++++---------
 hw/xfree86/common/xf86platformBus.c          |   28 +++++++++++++++---------
 hw/xfree86/common/xf86str.h                  |    3 +-
 hw/xfree86/os-support/linux/systemd-logind.c |    3 +-
 test/hashtabletest.c                         |    2 -
 5 files changed, 44 insertions(+), 23 deletions(-)

New commits:
commit 7f15e5aed79803fa6057fbfda7dfbacacc2e019d
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Mon Mar 3 16:58:54 2014 +0100

    Require video drivers to report that they support server managed fds
    
    This makes how we handle video drivers identical to what we do for input
    drivers, and this should make live easier for old non kms drivers.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 564567e..4e80f9e 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -38,6 +38,7 @@
 #include <unistd.h>
 #include "os.h"
 #include "hotplug.h"
+#include "systemd-logind.h"
 
 #include "xf86.h"
 #include "xf86_OSproc.h"
@@ -310,7 +311,7 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
                             GDevPtr gdev, int flags, intptr_t match_data)
 {
     Bool foundScreen = FALSE;
-    int entity;
+    int entity, fd, major, minor;
 
     if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev))
         return FALSE;
@@ -334,6 +335,17 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
         }
     }
     if (entity != -1) {
+        if ((dev->flags & XF86_PDEV_SERVER_FD) && (!drvp->driverFunc ||
+                !drvp->driverFunc(NULL, SUPPORTS_SERVER_FDS, NULL))) {
+            fd = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_FD, -1);
+            major = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MAJOR, 0);
+            minor = xf86_get_platform_device_int_attrib(dev, ODEV_ATTRIB_MINOR, 0);
+            systemd_logind_release_fd(major, minor);
+            close(fd);
+            config_odev_add_int_attribute(dev->attribs, ODEV_ATTRIB_FD, -1);
+            dev->flags &= ~XF86_PDEV_SERVER_FD;
+        }
+
         if (drvp->platformProbe(drvp, entity, flags, dev, match_data))
             foundScreen = TRUE;
         else
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h
index b164b7f..a81e886 100644
--- a/hw/xfree86/common/xf86str.h
+++ b/hw/xfree86/common/xf86str.h
@@ -256,7 +256,8 @@ typedef enum {
     RR_GET_INFO,
     RR_SET_CONFIG,
     RR_GET_MODE_MM,
-    GET_REQUIRED_HW_INTERFACES = 10
+    GET_REQUIRED_HW_INTERFACES = 10,
+    SUPPORTS_SERVER_FDS = 11,
 } xorgDriverFuncOp;
 
 typedef Bool xorgDriverFuncProc(ScrnInfoPtr, xorgDriverFuncOp, void *);
commit 76af81bdf8ade158d7cef718ff6cf31cbf641a9a
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Mon Mar 3 16:07:16 2014 +0100

    xf86platformBus: Make doPlatformProbe accept a NULL gdev argument
    
    And use it from xf86platformAddDevice too, instead of directly calling
    drvp->platformProbe.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Dave Airlie <airlied at redhat.com>

diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c
index 4447e19..564567e 100644
--- a/hw/xfree86/common/xf86platformBus.c
+++ b/hw/xfree86/common/xf86platformBus.c
@@ -312,13 +312,13 @@ static Bool doPlatformProbe(struct xf86_platform_device *dev, DriverPtr drvp,
     Bool foundScreen = FALSE;
     int entity;
 
-    if (gdev->screen == 0 && !xf86_check_platform_slot(dev))
+    if (gdev && gdev->screen == 0 && !xf86_check_platform_slot(dev))
         return FALSE;
 
     entity = xf86ClaimPlatformSlot(dev, drvp, 0,
-                                   gdev, gdev->active);
+                                   gdev, gdev ? gdev->active : 0);
 
-    if ((entity == -1) && (gdev->screen > 0)) {
+    if ((entity == -1) && gdev && (gdev->screen > 0)) {
         unsigned nent;
 
         for (nent = 0; nent < xf86NumEntities; nent++) {
@@ -420,7 +420,6 @@ xf86platformAddDevice(int index)
 {
     int i, old_screens, scr_index;
     DriverPtr drvp = NULL;
-    int entity;
     screenLayoutPtr layout;
     static const char *hotplug_driver_name = "modesetting";
 
@@ -440,11 +439,8 @@ xf86platformAddDevice(int index)
         return -1;
 
     old_screens = xf86NumGPUScreens;
-    entity = xf86ClaimPlatformSlot(&xf86_platform_devices[index],
-                                   drvp, 0, 0, 0);
-    if (!drvp->platformProbe(drvp, entity, PLATFORM_PROBE_GPU_SCREEN, &xf86_platform_devices[index], 0)) {
-        xf86UnclaimPlatformSlot(&xf86_platform_devices[index], NULL);
-    }
+    doPlatformProbe(&xf86_platform_devices[index], drvp, NULL,
+                    PLATFORM_PROBE_GPU_SCREEN, 0);
     if (old_screens == xf86NumGPUScreens)
         return -1;
     i = old_screens;
commit 749d25f6f0faed00a4cd906171ea6f96d76591e7
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Fri Mar 7 04:59:47 2014 -0500

    systemd-logind: Fix vt-enter not working when using a legacy video driver
    
    If there is only a single non kms video device (tested with the vesa driver),
    then we will never get a resume signal for a drm node, so also call vtenter
    when we get a resume for an input device.
    
    Notes:
    1) vtenter checks if it is ok to do the vtenter, so if there are kms video
    devices the calls for input device resumes are a nop
    2) This assumes that there will always be at least one server event fd
    supporting input device. Since all non legacy input-drivers will be patched
    to supported server fds this seems a safe assumption.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/hw/xfree86/os-support/linux/systemd-logind.c b/hw/xfree86/os-support/linux/systemd-logind.c
index abb8e44..a8406d8 100644
--- a/hw/xfree86/os-support/linux/systemd-logind.c
+++ b/hw/xfree86/os-support/linux/systemd-logind.c
@@ -347,7 +347,6 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
 
         if (pdev) {
             pdev->flags &= ~XF86_PDEV_PAUSED;
-            systemd_logind_vtenter();
         }
         else {
             pInfo->fd = fd;
@@ -355,6 +354,8 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data)
             if (info->vt_active)
                 xf86EnableInputDeviceForVTSwitch(pInfo);
         }
+        /* Always call vtenter(), in case there are only legacy video devs */
+        systemd_logind_vtenter();
     }
     return DBUS_HANDLER_RESULT_HANDLED;
 }
commit c6dea929a4951c3c048554a1ef54cf8143d9577a
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Mon Mar 3 17:00:57 2014 +0100

    config_odev_add*_attribute: Don't add the attribute to the list twice
    
    Don't do the xorg_list_append a 2nd time when updating existing attributes,
    while at it add a helper function for this to avoid code duplication.
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/config/config.c b/config/config.c
index 7971b87..530f21d 100644
--- a/config/config.c
+++ b/config/config.c
@@ -159,23 +159,38 @@ config_odev_find_attribute(struct OdevAttributes *attribs, int attrib_id)
     return NULL;
 }
 
+static struct OdevAttribute *
+config_odev_find_or_add_attribute(struct OdevAttributes *attribs, int attrib)
+{
+    struct OdevAttribute *oa;
+
+    oa = config_odev_find_attribute(attribs, attrib);
+    if (oa)
+        return oa;
+
+    oa = calloc(1, sizeof(struct OdevAttribute));
+    if (!oa)
+        return oa;
+
+    oa->attrib_id = attrib;
+    xorg_list_append(&oa->member, &attribs->list);
+
+    return oa;
+}
+
 Bool
 config_odev_add_attribute(struct OdevAttributes *attribs, int attrib,
                           const char *attrib_name)
 {
     struct OdevAttribute *oa;
 
-    oa = config_odev_find_attribute(attribs, attrib);
-    if (!oa)
-        oa = calloc(1, sizeof(struct OdevAttribute));
+    oa = config_odev_find_or_add_attribute(attribs, attrib);
     if (!oa)
         return FALSE;
 
-    oa->attrib_id = attrib;
     free(oa->attrib_name);
     oa->attrib_name = strdup(attrib_name);
     oa->attrib_type = ODEV_ATTRIB_STRING;
-    xorg_list_append(&oa->member, &attribs->list);
     return TRUE;
 }
 
@@ -185,16 +200,12 @@ config_odev_add_int_attribute(struct OdevAttributes *attribs, int attrib,
 {
     struct OdevAttribute *oa;
 
-    oa = config_odev_find_attribute(attribs, attrib);
-    if (!oa)
-        oa = calloc(1, sizeof(struct OdevAttribute));
+    oa = config_odev_find_or_add_attribute(attribs, attrib);
     if (!oa)
         return FALSE;
 
-    oa->attrib_id = attrib;
     oa->attrib_value = attrib_value;
     oa->attrib_type = ODEV_ATTRIB_INT;
-    xorg_list_append(&oa->member, &attribs->list);
     return TRUE;
 }
 
commit 2f2967173ba0b0a4f7ab013edeaaf11e7c181beb
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Mon Mar 3 09:51:36 2014 +0100

    hashtabletest: Fix warning: format ‘%ld’ expects argument of type ...
    
    This fixes the following compiler warning:
    
    hashtabletest.c: In function ‘print_xid’:
    hashtabletest.c:15:5: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘XID’ [-Wformat=]
         printf("%ld", *x);
         ^
    
    Signed-off-by: Hans de Goede <hdegoede at redhat.com>
    Reviewed-by: Eric Anholt <eric at anholt.net>

diff --git a/test/hashtabletest.c b/test/hashtabletest.c
index ceadfa7..86a0c58 100644
--- a/test/hashtabletest.c
+++ b/test/hashtabletest.c
@@ -12,7 +12,7 @@ static void
 print_xid(void* ptr, void* v)
 {
     XID *x = v;
-    printf("%ld", *x);
+    printf("%ld", (long)(*x));
 }
 
 static void


More information about the xorg-commit mailing list