From 28d94ee2216c238fe27a6b3383c007575a5ac887 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Mar 12 2019 16:32:14 +0000 Subject: import xorg-x11-server-1.20.1-5.3.el7_6 --- diff --git a/SOURCES/0001-linux-Make-platform-device-probe-less-fragile.patch b/SOURCES/0001-linux-Make-platform-device-probe-less-fragile.patch index 7eaf5c3..222ecd9 100644 --- a/SOURCES/0001-linux-Make-platform-device-probe-less-fragile.patch +++ b/SOURCES/0001-linux-Make-platform-device-probe-less-fragile.patch @@ -1,47 +1,121 @@ -From b96e7972e90144a697401f393ae8e1e12b3e767c Mon Sep 17 00:00:00 2001 +From 0816e8fca6194dfb4cc94c3a7fcb2c7f2a921386 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 18 Sep 2018 14:37:51 -0400 -Subject: [PATCH] linux: Make platform device probe less fragile +Subject: [PATCH xserver] linux: Make platform device probe less fragile -If we have platform devices - and we usually do - we would really want -them to bind through the platform bus code not PCI. At the point where -get_drm_info runs, however, we haven't yet taken our own VT, which means -we can't perform drm "master" operations on the device. This is tragic, -because the operation we need to perform here is fishing the bus id out -of the kernel, which we can only do after drmSetInterfaceVersion, which -for some reason stores that knowledge on the device not the file handle -and thus needs master access. Since we fail, the probe logic gets very -confused. +At the point where xf86BusProbe runs we haven't yet taken our own VT, +which means we can't perform drm "master" operations on the device. This +is tragic, because we need master to fish the bus id string out of the +kernel, which we can only do after drmSetInterfaceVersion, which for +some reason stores that string on the device not the file handle and +thus needs master access. -Fortunately we know the format of the busid string (it's our own, drm -copied it from xfree86), so we can scrape that out of the sysfs path. We -do still potentially do the whole SetInterfaceVersion dance later on, -but it's harmless at that point because we've taken the VT by then. +Fortunately we know the format of the busid string, and it happens to +almost be the same as the ID_PATH variable from udev. Use that instead +and stop calling drmSetInterfaceVersion. -This should all be vastly simplified, but that is not the cat we're -skinning today. +Reviewed-by: Peter Hutterer +Signed-off-by: Adam Jackson --- - hw/xfree86/os-support/linux/lnx_platform.c | 22 ++++++++++++---------- - 1 file changed, 12 insertions(+), 10 deletions(-) + config/udev.c | 17 ++++++++++++----- + hw/xfree86/os-support/linux/lnx_platform.c | 20 ++------------------ + 2 files changed, 14 insertions(+), 23 deletions(-) +diff --git a/config/udev.c b/config/udev.c +index 3a73189e25..8c6c4b6665 100644 +--- a/config/udev.c ++++ b/config/udev.c +@@ -56,7 +56,7 @@ static struct udev_monitor *udev_monitor; + + #ifdef CONFIG_UDEV_KMS + static void +-config_udev_odev_setup_attribs(const char *path, const char *syspath, ++config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path, const char *syspath, + int major, int minor, + config_odev_probe_proc_ptr probe_callback); + #endif +@@ -128,7 +128,7 @@ device_added(struct udev_device *udev_device) + + LogMessage(X_INFO, "config/udev: Adding drm device (%s)\n", path); + +- config_udev_odev_setup_attribs(path, syspath, major(devnum), ++ config_udev_odev_setup_attribs(udev_device, path, syspath, major(devnum), + minor(devnum), NewGPUDeviceRequest); + return; + } +@@ -322,7 +322,7 @@ device_removed(struct udev_device *device) + + LogMessage(X_INFO, "config/udev: removing GPU device %s %s\n", + syspath, path); +- config_udev_odev_setup_attribs(path, syspath, major(devnum), ++ config_udev_odev_setup_attribs(device, path, syspath, major(devnum), + minor(devnum), DeleteGPUDeviceRequest); + /* Retry vtenter after a drm node removal */ + systemd_logind_vtenter(); +@@ -465,17 +465,24 @@ config_udev_fini(void) + #ifdef CONFIG_UDEV_KMS + + static void +-config_udev_odev_setup_attribs(const char *path, const char *syspath, ++config_udev_odev_setup_attribs(struct udev_device *udev_device, const char *path, const char *syspath, + int major, int minor, + config_odev_probe_proc_ptr probe_callback) + { + struct OdevAttributes *attribs = config_odev_allocate_attributes(); ++ const char *value; + + attribs->path = XNFstrdup(path); + attribs->syspath = XNFstrdup(syspath); + attribs->major = major; + attribs->minor = minor; + ++ value = udev_device_get_property_value(udev_device, "ID_PATH"); ++ if (value && !strncmp(value, "pci-", 4)) { ++ attribs->busid = XNFstrdup(value); ++ attribs->busid[3] = ':'; ++ } ++ + /* ownership of attribs is passed to probe layer */ + probe_callback(attribs); + } +@@ -516,7 +523,7 @@ config_udev_odev_probe(config_odev_probe_proc_ptr probe_callback) + else if (!check_seat(udev_device)) + goto no_probe; + +- config_udev_odev_setup_attribs(path, syspath, major(devnum), ++ config_udev_odev_setup_attribs(udev_device, path, syspath, major(devnum), + minor(devnum), probe_callback); + no_probe: + udev_device_unref(udev_device); diff --git a/hw/xfree86/os-support/linux/lnx_platform.c b/hw/xfree86/os-support/linux/lnx_platform.c -index 70374ac..cbf7dd2 100644 +index 70374ace88..e623062192 100644 --- a/hw/xfree86/os-support/linux/lnx_platform.c +++ b/hw/xfree86/os-support/linux/lnx_platform.c -@@ -29,6 +29,9 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) +@@ -23,13 +23,13 @@ + static Bool + get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) + { +- drmSetVersion sv; + drmVersionPtr v; +- char *buf; int fd; int err = 0; Bool paused, server_fd = FALSE; -+ const char pci_prefix[] = "/sys/devices/pci"; -+ -+ LogMessage(X_INFO, "Platform probe for %s\n", attribs->syspath); ++ LogMessage(X_INFO, "Platform probe for %s\n", attribs->syspath); ++ fd = systemd_logind_take_fd(attribs->major, attribs->minor, path, &paused); if (fd != -1) { -@@ -53,13 +56,6 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) - sv.drm_dd_major = -1; /* Don't care */ - sv.drm_dd_minor = -1; /* Don't care */ + if (paused) { +@@ -48,18 +48,6 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) + 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); - if (err) { - xf86Msg(X_ERROR, "%s: failed to set DRM interface version 1.4: %s\n", @@ -52,25 +126,17 @@ index 70374ac..cbf7dd2 100644 /* for a delayed probe we've already added the device */ if (delayed_index == -1) { xf86_add_platform_device(attribs, FALSE); -@@ -69,9 +65,15 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) +@@ -69,10 +57,6 @@ get_drm_info(struct OdevAttributes *attribs, char *path, int delayed_index) if (server_fd) xf86_platform_devices[delayed_index].flags |= XF86_PDEV_SERVER_FD; - buf = drmGetBusid(fd); - xf86_platform_odev_attributes(delayed_index)->busid = XNFstrdup(buf); - drmFreeBusid(buf); -+ /* parse out a bus id */ -+ if (!strncmp(attribs->syspath, pci_prefix, strlen(pci_prefix))) { -+ char *dbdf = attribs->syspath + strlen(pci_prefix) + strlen("XXXX:XX") + 1; -+ asprintf(&xf86_platform_odev_attributes(delayed_index)->busid, -+ "pci:%.12s", dbdf); -+ LogMessage(X_INFO, "Platform PCI device at %s\n", -+ xf86_platform_odev_attributes(delayed_index)->busid); -+ } -+ - +- v = drmGetVersion(fd); if (!v) { + xf86Msg(X_ERROR, "%s: failed to query DRM version\n", path); -- -2.17.1 +2.19.1 diff --git a/SPECS/xorg-x11-server.spec b/SPECS/xorg-x11-server.spec index d0fdeac..7bd0674 100644 --- a/SPECS/xorg-x11-server.spec +++ b/SPECS/xorg-x11-server.spec @@ -42,7 +42,7 @@ Summary: X.Org X11 X server Name: xorg-x11-server Version: 1.20.1 -Release: 5.2%{?gitdate:.%{gitdate}}%{?dist} +Release: 5.3%{?gitdate:.%{gitdate}}%{?dist} URL: http://www.x.org License: MIT Group: User Interface/X @@ -590,6 +590,9 @@ rm -rf $RPM_BUILD_ROOT %{xserver_source_dir} %changelog +* Tue Feb 12 2019 Adam Jackson - 1.20.1-5.3 +- Sync platform probe patch with upstream + * Fri Nov 23 2018 Olivier Fourdan - 1.20.1-5.2 - Move LeaveVT after resetting randr pointers in xf86CrtcCloseScreen