From edcd3cf1834dc2a9f3e1f0975382c00b30448990239d33e8b4878f943f6bc567 Mon Sep 17 00:00:00 2001 From: Stefan Dirsch Date: Fri, 3 Dec 2021 16:28:10 +0000 Subject: [PATCH] Accepting request 935494 from home:tdz:branches:X11:XOrg [boo1193250] Add support for various platform devices * Fix SEGFAULT when parsing busid * Support configuration files under /run * Add udev rules for configuration of platform (e.g., simple-framebuffer) and HyperV devices * Remove current simpledrm hack from X server OBS-URL: https://build.opensuse.org/request/show/935494 OBS-URL: https://build.opensuse.org/package/show/X11:XOrg/xorg-x11-server?expand=0&rev=808 --- u_Add-udev-rule-for-HyperV-devices.patch | 33 ++++ ...-for-configuration-of-platform-devic.patch | 156 ++++++++++++++++++ ...pt-devices-with-the-simpledrm-driver.patch | 38 +++++ ...ation-files-under-run-X11-xorg.conf..patch | 86 ++++++++++ ...evice-detection-for-the-platfrom-bus.patch | 10 +- xorg-x11-server.changes | 15 ++ xorg-x11-server.spec | 17 +- 7 files changed, 349 insertions(+), 6 deletions(-) create mode 100644 u_Add-udev-rule-for-HyperV-devices.patch create mode 100644 u_Add-udev-scripts-for-configuration-of-platform-devic.patch create mode 100644 u_Revert-xf86-Accept-devices-with-the-simpledrm-driver.patch create mode 100644 u_Support-configuration-files-under-run-X11-xorg.conf..patch diff --git a/u_Add-udev-rule-for-HyperV-devices.patch b/u_Add-udev-rule-for-HyperV-devices.patch new file mode 100644 index 0000000..eb36c89 --- /dev/null +++ b/u_Add-udev-rule-for-HyperV-devices.patch @@ -0,0 +1,33 @@ +From ceb711ec1f98ba18bce1dc6ee6a091e304a0c883 Mon Sep 17 00:00:00 2001 +From: Thomas Zimmermann +Date: Fri, 3 Dec 2021 10:24:20 +0100 +Subject: Add udev rule for HyperV devices + +Add a udev rule to generate configuration files for HyperV-based +graphics output. + +Signed-off-by: Thomas Zimmermann +--- + hw/xfree86/os-support/linux/99-xorg-sysfs.rules | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/hw/xfree86/os-support/linux/99-xorg-sysfs.rules b/hw/xfree86/os-support/linux/99-xorg-sysfs.rules +index 940d18ef5..0cc9ad7b6 100644 +--- a/hw/xfree86/os-support/linux/99-xorg-sysfs.rules ++++ b/hw/xfree86/os-support/linux/99-xorg-sysfs.rules +@@ -27,3 +27,12 @@ ACTION=="add|remove", \ + SUBSYSTEM=="drm", \ + SUBSYSTEMS=="platform", \ + RUN+="/usr/sbin/x11sysfsconf $env{ACTION} $env{DEVPATH}" ++ ++# HyperV graphics devices ++ACTION=="add|remove", \ ++ KERNEL=="card[0-9]", \ ++ SUBSYSTEM=="drm", \ ++ SUBSYSTEMS=="vmbus", \ ++ KERNELS=="5620e0c7-8062-4dce-aeb7-520c7ef76171", \ ++ DRIVERS=="hyperv_drm", \ ++ RUN+="/usr/sbin/x11sysfsconf $env{ACTION} $env{DEVPATH}" +-- +2.34.0 + diff --git a/u_Add-udev-scripts-for-configuration-of-platform-devic.patch b/u_Add-udev-scripts-for-configuration-of-platform-devic.patch new file mode 100644 index 0000000..395e4cb --- /dev/null +++ b/u_Add-udev-scripts-for-configuration-of-platform-devic.patch @@ -0,0 +1,156 @@ +From edc3e2e465ff1423e7c6ba217bee78a0e0b60f0e Mon Sep 17 00:00:00 2001 +From: Thomas Zimmermann +Date: Tue, 2 Nov 2021 14:29:08 +0100 +Subject: Add udev scripts for configuration of platform devices + +Generate configuration files for platform devices from udev rules +as X does not support auto-configuration. Implement support for +platform devices, such as simple-frambuffer, on top. + +Signed-off-by: Thomas Zimmermann +--- + .../os-support/linux/99-xorg-sysfs.rules | 29 +++++++ + hw/xfree86/os-support/linux/Makefile.am | 5 ++ + hw/xfree86/os-support/linux/x11sysfsconf | 81 +++++++++++++++++++ + 3 files changed, 115 insertions(+) + create mode 100644 hw/xfree86/os-support/linux/99-xorg-sysfs.rules + create mode 100644 hw/xfree86/os-support/linux/x11sysfsconf + +diff --git a/hw/xfree86/os-support/linux/99-xorg-sysfs.rules b/hw/xfree86/os-support/linux/99-xorg-sysfs.rules +new file mode 100644 +index 000000000..940d18ef5 +--- /dev/null ++++ b/hw/xfree86/os-support/linux/99-xorg-sysfs.rules +@@ -0,0 +1,29 @@ ++# ++# Copyright © 2021 SUSE LINUX GmbH. ++# ++# 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. ++# ++ ++# DRM graphics devices on the platform bus. ++ACTION=="add|remove", \ ++ KERNEL=="card[0-9]", \ ++ SUBSYSTEM=="drm", \ ++ SUBSYSTEMS=="platform", \ ++ RUN+="/usr/sbin/x11sysfsconf $env{ACTION} $env{DEVPATH}" +diff --git a/hw/xfree86/os-support/linux/Makefile.am b/hw/xfree86/os-support/linux/Makefile.am +index 4392fe8d4..6c7b8aa09 100644 +--- a/hw/xfree86/os-support/linux/Makefile.am ++++ b/hw/xfree86/os-support/linux/Makefile.am +@@ -42,3 +42,8 @@ liblinux_la_SOURCES = linux.h lnx_init.c lnx_video.c \ + AM_CFLAGS = -DHAVE_SYSV_IPC $(DIX_CFLAGS) $(XORG_CFLAGS) $(PLATFORM_DEFINES) + + AM_CPPFLAGS = $(XORG_INCS) $(PLATFORM_INCLUDES) $(LIBDRM_CFLAGS) ++ ++dist_sbin_SCRIPTS = x11sysfsconf ++ ++udevrulesdir = @sysconfdir@/udev/rules.d ++dist_udevrules_DATA = 99-xorg-sysfs.rules +diff --git a/hw/xfree86/os-support/linux/x11sysfsconf b/hw/xfree86/os-support/linux/x11sysfsconf +new file mode 100644 +index 000000000..f5eabde6e +--- /dev/null ++++ b/hw/xfree86/os-support/linux/x11sysfsconf +@@ -0,0 +1,81 @@ ++#!/bin/sh ++ ++# ++# Copyright © 2021 SUSE LINUX GmbH. ++# ++# 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. ++# ++ ++# ++# x11sysfsconf - generate X11 configuration files from sysfs device paths ++# ++# x11sysfsconf adds or removes X11 configuration files from sysfs ++# device paths. The generated file contains a Device section with ++# the device's identifier and bus id. ++# ++# Kernel graphics drivers export system framebuffers as platform ++# devices, which cannot be configured by X automatically. Instead ++# X expects a configuration file with the device's identifier and ++# bus id. This script, plus a udev rule, automatically creates and ++# removes rsp configuration for each system framebuffer. ++# ++# Besides system framebuffers, several other kernel graphics drivers ++# operate on platform device. Examples are hyperv_drm and several ++# embedded ARM SoCs. x11sysfsconf can generate X11 configuration for ++# all such cases. ++# ++# The configuration file lives under /run, so that it's being removed ++# upon reboots. ++# ++# Copy this script to /usr/sbin and add the rsp udev rule to ++# /etc/udev/rules.d. ++# ++# TODO: ++# - Support non-platform devices, if any ++# - Improve error handling ++# ++ ++set -e ++ ++filename=`basename $2` ++ ++runconfpath="/run/X11/xorg.conf.d" ++confname="10-$filename.conf" ++tempname="$confname.$$" ++ ++abs_runconfpath="$runconfpath/$confname" ++abs_temppath="$runconfpath/$tempname" ++ ++case $1 in ++"add") ++ mkdir -p $runconfpath ++ echo -e "Section \"Device\"\n"\ ++ "\tIdentifier \"Device-$filename\"\n"\ ++ "\tBusID \"platform:/sys$2\"\n"\ ++ "EndSection" > $abs_temppath ++ mv $abs_temppath $abs_runconfpath ++ ;; ++"remove") ++ rm -f $abs_runconfpath ++ ;; ++*) ++ echo "Usage: $0 [add|remove] DEVPATH" ++ ;; ++esac +-- +2.34.0 + diff --git a/u_Revert-xf86-Accept-devices-with-the-simpledrm-driver.patch b/u_Revert-xf86-Accept-devices-with-the-simpledrm-driver.patch new file mode 100644 index 0000000..c3cd352 --- /dev/null +++ b/u_Revert-xf86-Accept-devices-with-the-simpledrm-driver.patch @@ -0,0 +1,38 @@ +From f28005325922c47d59f9735acd5aa87a3e14a53d Mon Sep 17 00:00:00 2001 +From: Thomas Zimmermann +Date: Tue, 30 Nov 2021 14:12:55 +0100 +Subject: Revert "xf86: Accept devices with the 'simpledrm' + driver." + +This reverts commit b89fdd523e2c9e9b0cdf37b263833c4b0a8868b8. Using +simpledrm, or any other platform driver, can now be achieved via udev- +generated configuration files. A driver-specific workaround is no +longer needed. + +Signed-off-by: Thomas Zimmermann +--- + hw/xfree86/common/xf86platformBus.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/hw/xfree86/common/xf86platformBus.c b/hw/xfree86/common/xf86platformBus.c +index 45028f7a6..0e0a995ac 100644 +--- a/hw/xfree86/common/xf86platformBus.c ++++ b/hw/xfree86/common/xf86platformBus.c +@@ -557,13 +557,8 @@ xf86platformProbeDev(DriverPtr drvp) + } + else { + /* for non-seat0 servers assume first device is the master */ +- if (ServerIsNotSeat0()) { ++ if (ServerIsNotSeat0()) + break; +- } else { +- /* Accept the device if the driver is simpledrm */ +- if (strcmp(xf86_platform_devices[j].attribs->driver, "simpledrm") == 0) +- break; +- } + + if (xf86IsPrimaryPlatform(&xf86_platform_devices[j])) + break; +-- +2.34.0 + diff --git a/u_Support-configuration-files-under-run-X11-xorg.conf..patch b/u_Support-configuration-files-under-run-X11-xorg.conf..patch new file mode 100644 index 0000000..8f73ad5 --- /dev/null +++ b/u_Support-configuration-files-under-run-X11-xorg.conf..patch @@ -0,0 +1,86 @@ +From cc166e8ba0d282399b3f00f34b89d6c3f8aa7394 Mon Sep 17 00:00:00 2001 +From: Thomas Zimmermann +Date: Tue, 2 Nov 2021 14:29:08 +0100 +Subject: Support configuration files under /run/X11/xorg.conf.d + +Make the X server look for runtime-generated configuration files +under /run/X11/xorg.conf.d. This is useful for dynamically setting +up platform devices during boot (e.g., via udev). + +By the rules for /run, all configuration files are cleared on +reboots. So even hard resets won't populate the system with old, +obsolete configuration files. + +Signed-off-by: Thomas Zimmermann +--- + hw/xfree86/common/xf86Config.c | 8 ++++---- + hw/xfree86/man/xorg.conf.man | 6 ++++++ + 2 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/hw/xfree86/common/xf86Config.c b/hw/xfree86/common/xf86Config.c +index 5d814c148..939db755e 100644 +--- a/hw/xfree86/common/xf86Config.c ++++ b/hw/xfree86/common/xf86Config.c +@@ -95,12 +95,12 @@ + #endif + #ifndef ALL_CONFIGDIRPATH + #define ALL_CONFIGDIRPATH "%A," "%R," \ +- "/etc/X11/%R," "%C/X11/%R," \ +- "/etc/X11/%X," "%C/X11/%X" ++ "/run/X11/%R," "/etc/X11/%R," "%C/X11/%R," \ ++ "/run/X11/%X," "/etc/X11/%X," "%C/X11/%X" + #endif + #ifndef RESTRICTED_CONFIGDIRPATH +-#define RESTRICTED_CONFIGDIRPATH "/etc/X11/%R," "%C/X11/%R," \ +- "/etc/X11/%X," "%C/X11/%X" ++#define RESTRICTED_CONFIGDIRPATH "/run/X11/%R," "/etc/X11/%R," "%C/X11/%R," \ ++ "/run/X11/%X," "/etc/X11/%X," "%C/X11/%X" + #endif + #ifndef SYS_CONFIGDIRPATH + #define SYS_CONFIGDIRPATH "%D/X11/%X" +diff --git a/hw/xfree86/man/xorg.conf.man b/hw/xfree86/man/xorg.conf.man +index ac88d7e7a..31ff1f0fd 100644 +--- a/hw/xfree86/man/xorg.conf.man ++++ b/hw/xfree86/man/xorg.conf.man +@@ -35,8 +35,10 @@ server is started as a normal user: + .PP + .RS 4 + .nf ++.IR /run/X11/ + .IR /etc/X11/ + .IR @projectroot@/etc/X11/ ++.IB /run/X11/ $XORGCONFIG + .IB /etc/X11/ $XORGCONFIG + .IB @projectroot@/etc/X11/ $XORGCONFIG + .I /etc/X11/xorg.conf +@@ -66,9 +68,11 @@ search locations are as follows: + .RS 4 + .nf + ++.IR /run/X11/ + .IR /etc/X11/ + .IR @projectroot@/etc/X11/ + .B $XORGCONFIG ++.IB /run/X11/ $XORGCONFIG + .IB /etc/X11/ $XORGCONFIG + .IB @projectroot@/etc/X11/ $XORGCONFIG + .I /etc/X11/xorg.conf +@@ -102,6 +106,7 @@ directories when the server is started as a normal user: + .nf + .IR /etc/X11/ + .IR @sysconfdir@/X11/ ++.I /run/X11/@xconfigdir@ + .I /etc/X11/@xconfigdir@ + .I @sysconfdir@/X11/@xconfigdir@ + .fi +@@ -121,6 +126,7 @@ config directory search locations are as follows: + + .IR /etc/X11/ + .IR @sysconfdir@/X11/ ++.I /run/X11/@xconfigdir@ + .I /etc/X11/@xconfigdir@ + .I @sysconfdir@/X11/@xconfigdir@ + .fi +-- +2.34.0 + diff --git a/u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch b/u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch index 68def16..b25af8a 100644 --- a/u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch +++ b/u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch @@ -25,11 +25,11 @@ Signed-off-by: Egbert Eich hw/xfree86/common/xf86platformBus.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) -Index: xorg-server-1.20.5/hw/xfree86/common/xf86platformBus.c +Index: xorg-server-21.1.1/hw/xfree86/common/xf86platformBus.c =================================================================== ---- xorg-server-1.20.5.orig/hw/xfree86/common/xf86platformBus.c -+++ xorg-server-1.20.5/hw/xfree86/common/xf86platformBus.c -@@ -744,6 +744,35 @@ void xf86platformPrimary(void) +--- xorg-server-21.1.1.orig/hw/xfree86/common/xf86platformBus.c ++++ xorg-server-21.1.1/hw/xfree86/common/xf86platformBus.c +@@ -766,6 +766,35 @@ void xf86platformPrimary(void) xf86Msg(X_NONE, "\tfalling back to %s\n", primaryBus.id.plat->attribs->syspath); } @@ -46,7 +46,7 @@ Index: xorg-server-1.20.5/hw/xfree86/common/xf86platformBus.c + int domain, bus, dev, func; + int ret; + -+ if (strncmp(busid, "pci:", 4) != 0) ++ if (!busid || (strncmp(busid, "pci:", 4) != 0)) + continue; + + ret = sscanf(busid, "pci:%04x:%02x:%02x.%u", diff --git a/xorg-x11-server.changes b/xorg-x11-server.changes index c45c911..0628e2a 100644 --- a/xorg-x11-server.changes +++ b/xorg-x11-server.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Fri Dec 3 14:41:55 UTC 2021 - Thomas Zimmermann + +- u_pci-primary-Fix-up-primary-PCI-device-detection-for-the-platfrom-bus.patch + * Fix SEGFAULT when parsing bus IDs of NULL +- u_Support-configuration-files-under-run-X11-xorg.conf..patch + * Support configuration files under /run. Required for generating + configuration files via udev. +- u_Add-udev-scripts-for-configuration-of-platform-devic.patch + * Generate configuration files for platform devices +- u_Revert-xf86-Accept-devices-with-the-simpledrm-driver.patch + * Code has been obsoleted by udev patchset +- u_Add-udev-rule-for-HyperV-devices.patch + * Same as for platform devices, but on HyperV + ------------------------------------------------------------------- Fri Nov 19 15:49:28 UTC 2021 - Stefan Dirsch diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec index 43e65f6..a52caf1 100644 --- a/xorg-x11-server.spec +++ b/xorg-x11-server.spec @@ -239,6 +239,11 @@ Patch1900: u_no-lto-for-tests.patch Patch1910: u_modesetting-Fix-dirty-updates-for-sw-rotation.patch +Patch1920: u_Support-configuration-files-under-run-X11-xorg.conf..patch +Patch1921: u_Add-udev-scripts-for-configuration-of-platform-devic.patch +Patch1922: u_Revert-xf86-Accept-devices-with-the-simpledrm-driver.patch +Patch1923: u_Add-udev-rule-for-HyperV-devices.patch + %description This package contains the X.Org Server. @@ -375,7 +380,7 @@ sh %{SOURCE92} --verify . %{SOURCE91} ### not applicable anymore #%patch210 -p1 %patch215 -p1 -### apparently supersed by upstream +### apparently supersed by upstream ### commit 078277e4d92f05a90c4715d61b89b9d9d38d68ea ### Author: Dave Airlie ### Date: Fri Aug 17 09:49:24 2012 +1000 @@ -393,6 +398,10 @@ sh %{SOURCE92} --verify . %{SOURCE91} %patch1503 -p1 %patch1900 -p1 %patch1910 -p1 +%patch1920 -p1 +%patch1921 -p1 +%patch1922 -p1 +%patch1923 -p1 %build %global _lto_cflags %{?_lto_cflags} -ffat-lto-objects @@ -594,6 +603,12 @@ fi %endif %{_bindir}/xorg-backtrace +# sysfb support +%{_sbindir}/x11sysfsconf +%dir %{_sysconfdir}/udev +%dir %{_sysconfdir}/udev/rules.d +%{_sysconfdir}/udev/rules.d/99-xorg-sysfs.rules + %if 0%{?have_wayland} == 1 %files wayland %{_bindir}/Xwayland