1
0

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
This commit is contained in:
Stefan Dirsch 2021-12-03 16:28:10 +00:00 committed by Git OBS Bridge
parent cb4c2f97d4
commit edcd3cf183
7 changed files with 349 additions and 6 deletions

View File

@ -0,0 +1,33 @@
From ceb711ec1f98ba18bce1dc6ee6a091e304a0c883 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <tzimmermann@suse.de>
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 <tzimmermann@suse.de>
---
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

View File

@ -0,0 +1,156 @@
From edc3e2e465ff1423e7c6ba217bee78a0e0b60f0e Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <tzimmermann@suse.de>
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 <tzimmermann@suse.de>
---
.../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

View File

@ -0,0 +1,38 @@
From f28005325922c47d59f9735acd5aa87a3e14a53d Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <tzimmermann@suse.de>
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 <tzimmermann@suse.de>
---
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

View File

@ -0,0 +1,86 @@
From cc166e8ba0d282399b3f00f34b89d6c3f8aa7394 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <tzimmermann@suse.de>
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 <tzimmermann@suse.de>
---
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/ <cmdline>
.IR /etc/X11/ <cmdline>
.IR @projectroot@/etc/X11/ <cmdline>
+.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
<cmdline>
+.IR /run/X11/ <cmdline>
.IR /etc/X11/ <cmdline>
.IR @projectroot@/etc/X11/ <cmdline>
.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/ <cmdline>
.IR @sysconfdir@/X11/ <cmdline>
+.I /run/X11/@xconfigdir@
.I /etc/X11/@xconfigdir@
.I @sysconfdir@/X11/@xconfigdir@
.fi
@@ -121,6 +126,7 @@ config directory search locations are as follows:
<cmdline>
.IR /etc/X11/ <cmdline>
.IR @sysconfdir@/X11/ <cmdline>
+.I /run/X11/@xconfigdir@
.I /etc/X11/@xconfigdir@
.I @sysconfdir@/X11/@xconfigdir@
.fi
--
2.34.0

View File

@ -25,11 +25,11 @@ Signed-off-by: Egbert Eich <eich@suse.de>
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",

View File

@ -1,3 +1,18 @@
-------------------------------------------------------------------
Fri Dec 3 14:41:55 UTC 2021 - Thomas Zimmermann <tzimmermann@suse.com>
- 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 <sndirsch@suse.com>

View File

@ -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 <airlied@redhat.com>
### 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