Currently, drm devices go to whichever server can get them first. See https://bugzilla.redhat.com/show_bug.cgi?id=1183654
Signed-off-by: Jonathan Dieter <[email protected]> --- config/udev.c | 42 +++++++++++++++++++++++++++++- hw/xfree86/os-support/linux/lnx_platform.c | 9 +++++++ include/config-udev.h | 32 +++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 include/config-udev.h diff --git a/config/udev.c b/config/udev.c index 1d2140a..7f17bc7 100644 --- a/config/udev.c +++ b/config/udev.c @@ -514,5 +514,45 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback) udev_enumerate_unref(enumerate); return; } -#endif +BOOL +config_udev_check_assigned_to_this_seat(struct OdevAttributes *attribs, char *path) +{ + struct udev_device *udev_device; + const char *dev_seat; + char *syspath = NULL; + struct udev *udev; + + udev = udev_new(); + if (!udev) + return FALSE; + + syspath = config_odev_get_attribute(attribs, ODEV_ATTRIB_SYSPATH); + if (!syspath) { + udev_unref(udev); + return FALSE; + } + + udev_device = udev_device_new_from_syspath(udev, syspath); + if (!udev_device) { + udev_unref(udev); + return FALSE; + } + + 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, "config/udev: Not adding drm device (%s) as it's assigned to seat: %s\n", path, dev_seat); + udev_unref(udev); + udev_device_unref(udev_device); + return FALSE; + } + + udev_unref(udev); + udev_device_unref(udev_device); + return TRUE; +} +#endif diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c index 1d145b3..61601a5 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 "config-udev.h" +#endif + static Bool get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) { @@ -161,6 +165,11 @@ xf86PlatformDeviceProbe(struct OdevAttributes *attribs) if (i != xf86_num_platform_devices) goto out_free; +#ifdef CONFIG_UDEV_KMS + if(!config_udev_check_assigned_to_this_seat(attribs, path)) + goto out_free; +#endif + LogMessage(X_INFO, "xfree86: Adding drm device (%s)\n", path); if (!xf86VTOwner()) { diff --git a/include/config-udev.h b/include/config-udev.h new file mode 100644 index 0000000..a165415 --- /dev/null +++ b/include/config-udev.h @@ -0,0 +1,32 @@ +/* + * Copyright © 2015 Jonathan Dieter + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: Jonathan Dieter <[email protected]> + */ +#ifndef CONFIG_UDEV_H +#define CONFIG_UDEV_H + +#ifdef CONFIG_UDEV_KMS +BOOL config_udev_check_assigned_to_this_seat(struct OdevAttributes *attribs, char *path); +#endif + +#endif -- 2.1.0 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel
