[PATCH] Respect seat assignments when assigning drm devices to server. Currently, drm devices go to whichever server can get them first.

Jonathan Dieter jdieter at lesbg.com
Wed Jan 21 09:21:49 PST 2015


See https://bugzilla.redhat.com/show_bug.cgi?id=1183654

Signed-off-by: Jonathan Dieter <jdieter at lesbg.com>
---
 hw/xfree86/os-support/linux/lnx_platform.c | 39 ++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c
index 1d145b3..59f1083 100644
--- a/hw/xfree86/os-support/linux/lnx_platform.c
+++ b/hw/xfree86/os-support/linux/lnx_platform.c
@@ -20,6 +20,10 @@
 #include "hotplug.h"
 #include "systemd-logind.h"
 
+#ifdef CONFIG_UDEV_KMS
+#include <libudev.h>
+#endif
+
 static Bool
 get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index)
 {
@@ -161,6 +165,41 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs)
     if (i != xf86_num_platform_devices)
         goto out_free;
 
+    #ifdef CONFIG_UDEV_KMS
+    {
+        struct udev_device *udev_device;
+        const char *dev_seat;
+        char *syspath = NULL;
+        struct udev *udev;
+
+        udev = udev_new();
+        if (!udev)
+            goto out_free;
+
+        syspath = config_odev_get_attribute(attribs, ODEV_ATTRIB_SYSPATH);
+
+        udev_device = udev_device_new_from_syspath(udev, syspath);
+        if (!udev_device) {
+            udev_unref(udev);
+            goto out_free;
+        }
+
+        dev_seat = udev_device_get_property_value(udev_device, "ID_SEAT");
+        if (!dev_seat)
+            dev_seat = "seat0";
+
+        if ((SeatId && strcmp(dev_seat, SeatId)) ||
+            (!SeatId && strcmp(dev_seat, "seat0"))) {
+            LogMessage(X_INFO, "xfree86: Not adding drm device (%s) as it's assigned to seat: %s\n", path, dev_seat);
+            udev_unref(udev);
+            udev_device_unref(udev_device);
+            goto out_free;
+        }
+
+        udev_unref(udev);
+        udev_device_unref(udev_device);
+    }
+    #endif
     LogMessage(X_INFO, "xfree86: Adding drm device (%s)\n", path);
 
     if (!xf86VTOwner()) {
-- 
2.1.0



More information about the xorg-devel mailing list