diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-02-20 17:41:37 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2022-02-20 17:41:37 +0000 |
commit | c259179a37a495b4e22c6787185a50171358d838 (patch) | |
tree | d6bea7165f184d9d1d0dedd3c6e1d78935655de0 /xserver/hw | |
parent | 8e9a1d1ad7c4069aa127b34a72800fbc48c8c994 (diff) |
Sync with xorg-server 21.1.3.
This does *not* include the commit that reverts the new computation
of the screen resolution from dimensions returned by the screen since
many of you told they prefer the new behaviour from 21.1.1.
This is going to be discussed again before 7.1
Diffstat (limited to 'xserver/hw')
-rw-r--r-- | xserver/hw/xfree86/common/xf86Events.c | 4 | ||||
-rw-r--r-- | xserver/hw/xfree86/common/xf86Init.c | 31 | ||||
-rw-r--r-- | xserver/hw/xfree86/common/xf86Priv.h | 2 | ||||
-rw-r--r-- | xserver/hw/xfree86/drivers/modesetting/dri2.c | 3 | ||||
-rw-r--r-- | xserver/hw/xfree86/os-support/linux/systemd-logind.c | 44 |
5 files changed, 63 insertions, 21 deletions
diff --git a/xserver/hw/xfree86/common/xf86Events.c b/xserver/hw/xfree86/common/xf86Events.c index 05fa2bb90..395bbc7b3 100644 --- a/xserver/hw/xfree86/common/xf86Events.c +++ b/xserver/hw/xfree86/common/xf86Events.c @@ -382,6 +382,10 @@ xf86VTLeave(void) for (i = 0; i < xf86NumGPUScreens; i++) xf86GPUScreens[i]->LeaveVT(xf86GPUScreens[i]); + if (systemd_logind_controls_session()) { + systemd_logind_drop_master(); + } + if (!xf86VTSwitchAway()) goto switch_failed; diff --git a/xserver/hw/xfree86/common/xf86Init.c b/xserver/hw/xfree86/common/xf86Init.c index cda9e037a..4f28f1dba 100644 --- a/xserver/hw/xfree86/common/xf86Init.c +++ b/xserver/hw/xfree86/common/xf86Init.c @@ -85,6 +85,11 @@ #include <X11/extensions/dpmsconst.h> #include "dpmsproc.h" #endif + +#ifdef __linux__ +#include <linux/major.h> +#include <sys/sysmacros.h> +#endif #include <hotplug.h> void (*xf86OSPMClose) (void) = NULL; @@ -109,23 +114,10 @@ static Bool formatsDone = FALSE; static Bool xf86KeepPriv = FALSE; #endif -#ifndef PRE_RELEASE -#define PRE_RELEASE XORG_VERSION_SNAP -#endif static void xf86PrintBanner(void) { -#if PRE_RELEASE - xf86ErrorFVerb(0, "\n" - "This is a pre-release version of the X server from " - XVENDORNAME ".\n" "It is not supported in any way.\n" - "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" - "Select the \"xorg\" product for bugs you find in this release.\n" - "Before reporting bugs in pre-release versions please check the\n" - "latest version in the X.Org Foundation git repository.\n" - "See http://wiki.x.org/wiki/GitPage for git access instructions.\n"); -#endif xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d", XORG_VERSION_MAJOR, XORG_VERSION_MINOR, XORG_VERSION_PATCH); #if XORG_VERSION_SNAP > 0 @@ -205,6 +197,17 @@ xf86PrivsElevated(void) return PrivsElevated(); } +Bool +xf86HasTTYs(void) +{ +#ifdef __linux__ + struct stat tty0devAttributes; + return (stat("/dev/tty0", &tty0devAttributes) == 0 && major(tty0devAttributes.st_rdev) == TTY_MAJOR); +#else + return TRUE; +#endif +} + static void xf86AutoConfigOutputDevices(void) { @@ -450,7 +453,7 @@ InitOutput(ScreenInfo * pScreenInfo, int argc, char **argv) want_hw_access = TRUE; /* Non-seat0 X servers should not open console */ - if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0()) + if (!(flags & HW_SKIP_CONSOLE) && !ServerIsNotSeat0() && xf86HasTTYs()) xorgHWOpenConsole = TRUE; } diff --git a/xserver/hw/xfree86/common/xf86Priv.h b/xserver/hw/xfree86/common/xf86Priv.h index dde458327..d5185d8df 100644 --- a/xserver/hw/xfree86/common/xf86Priv.h +++ b/xserver/hw/xfree86/common/xf86Priv.h @@ -158,6 +158,8 @@ extern _X_EXPORT Bool xf86CallDriverProbe(struct _DriverRec *drv, Bool detect_only); extern _X_EXPORT Bool xf86PrivsElevated(void); +extern _X_EXPORT Bool +xf86HasTTYs(void); #endif /* _NO_XF86_PROTOTYPES */ diff --git a/xserver/hw/xfree86/drivers/modesetting/dri2.c b/xserver/hw/xfree86/drivers/modesetting/dri2.c index 7ff52be6d..8d1b742ef 100644 --- a/xserver/hw/xfree86/drivers/modesetting/dri2.c +++ b/xserver/hw/xfree86/drivers/modesetting/dri2.c @@ -1086,7 +1086,8 @@ ms_dri2_screen_init(ScreenPtr screen) * guess that the DRI and VDPAU drivers have the same name. */ if (strcmp(driver_names[0], "i965") == 0 || - strcmp(driver_names[0], "iris") == 0) { + strcmp(driver_names[0], "iris") == 0 || + strcmp(driver_names[0], "crocus") == 0) { driver_names[1] = "va_gl"; } else { driver_names[1] = driver_names[0]; diff --git a/xserver/hw/xfree86/os-support/linux/systemd-logind.c b/xserver/hw/xfree86/os-support/linux/systemd-logind.c index 93428ba73..dbb00cd85 100644 --- a/xserver/hw/xfree86/os-support/linux/systemd-logind.c +++ b/xserver/hw/xfree86/os-support/linux/systemd-logind.c @@ -38,6 +38,7 @@ #include "xf86.h" #include "xf86platformBus.h" #include "xf86Xinput.h" +#include "xf86Priv.h" #include "globals.h" #include "systemd-logind.h" @@ -302,6 +303,37 @@ cleanup: dbus_error_free(&error); } +/* + * Send a message to logind, to pause the drm device + * and ensure the drm_drop_master is done before + * VT_RELDISP when switching VT + */ +void systemd_logind_drop_master(void) +{ + int i; + for (i = 0; i < xf86_num_platform_devices; i++) { + if (xf86_platform_devices[i].flags & XF86_PDEV_SERVER_FD) { + dbus_int32_t major, minor; + struct systemd_logind_info *info = &logind_info; + + xf86_platform_devices[i].flags |= XF86_PDEV_PAUSED; + major = xf86_platform_odev_attributes(i)->major; + minor = xf86_platform_odev_attributes(i)->minor; + systemd_logind_ack_pause(info, minor, major); + } + } +} + +static Bool are_platform_devices_resumed(void) { + int i; + for (i = 0; i < xf86_num_platform_devices; i++) { + if (xf86_platform_devices[i].flags & XF86_PDEV_PAUSED) { + return FALSE; + } + } + return TRUE; +} + static DBusHandlerResult message_filter(DBusConnection * connection, DBusMessage * message, void *data) { @@ -393,14 +425,14 @@ message_filter(DBusConnection * connection, DBusMessage * message, void *data) /* info->vt_active gets set by systemd_logind_vtenter() */ info->active = TRUE; - if (pdev) + if (pdev) { pdev->flags &= ~XF86_PDEV_PAUSED; - else + } else systemd_logind_set_input_fd_for_all_devs(major, minor, fd, info->vt_active); - - /* Always call vtenter(), in case there are only legacy video devs */ - systemd_logind_vtenter(); + /* Call vtenter if all platform devices are resumed, or if there are no platform device */ + if (are_platform_devices_resumed()) + systemd_logind_vtenter(); } return DBUS_HANDLER_RESULT_HANDLED; } @@ -583,7 +615,7 @@ static struct dbus_core_hook core_hook = { int systemd_logind_init(void) { - if (!ServerIsNotSeat0() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) { + if (!ServerIsNotSeat0() && xf86HasTTYs() && linux_parse_vt_settings(TRUE) && !linux_get_keeptty()) { LogMessage(X_INFO, "systemd-logind: logind integration requires -keeptty and " "-keeptty was not provided, disabling logind integration\n"); |