Commit b1f96ef1 authored by Marti Raudsepp's avatar Marti Raudsepp

Add gdm-CanGraphical-wait.patch for FS#64985

parent 04bce313
......@@ -4,7 +4,7 @@
pkgbase=gdm
pkgname=(gdm libgdm)
pkgver=3.34.1
pkgrel=1
pkgrel=2
pkgdesc="Display manager and login screen"
url="https://wiki.gnome.org/Projects/GDM"
arch=(x86_64)
......@@ -16,7 +16,8 @@ _commit=80e010198217284d3cf52e8b334862a80b00cbd1 # tags/3.34.1^0
source=("git+https://gitlab.gnome.org/GNOME/gdm.git#commit=$_commit"
0001-Xsession-Don-t-start-ssh-agent-by-default.patch
0002-pam-arch-Don-t-check-greeter-account-for-expiry.patch
0003-pam-arch-Restrict-greeter-service-to-the-gdm-user.patch)
0003-pam-arch-Restrict-greeter-service-to-the-gdm-user.patch
gdm-CanGraphical-wait.patch)
sha256sums=('SKIP'
'098ffb1cdc0232f014e5fe5fb8d268b752afc54d6ee661664036879acd075b22'
'2e2b12d4609004a010245de51a8c017b164e84f249cd19706d020cb599d2d7e7'
......@@ -35,6 +36,7 @@ prepare() {
# https://bugs.archlinux.org/task/63706
patch -Np1 -i ../0002-pam-arch-Don-t-check-greeter-account-for-expiry.patch
patch -Np1 -i ../0003-pam-arch-Restrict-greeter-service-to-the-gdm-user.patch
patch -Np1 -i ../gdm-CanGraphical-wait.patch
NOCONFIGURE=1 ./autogen.sh
}
......@@ -92,3 +94,8 @@ package_libgdm() {
depends=(systemd glib2 dconf)
mv libgdm "$pkgdir/usr"
}
sha256sums=('SKIP'
'098ffb1cdc0232f014e5fe5fb8d268b752afc54d6ee661664036879acd075b22'
'2e2b12d4609004a010245de51a8c017b164e84f249cd19706d020cb599d2d7e7'
'3fa02eb7bbbe1586eae4ae98221a284251ca2869dc731c80b753e7effc443379'
'994cf07307b5aba5f60cb46bfa09a5d213b2f9d4f9f2c6aa31943ca789472e29')
From 198d6392ff595f330430d92d5c380cd993be73d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= <[email protected]>
Date: Tue, 16 Oct 2018 20:59:23 +0200
Subject: [PATCH] gdm3.service: wait for drm device before trying to start it
Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gdm3/+bug/1794280
Forwarded: not-needed
---
configure.ac | 1 +
data/Makefile.am | 1 +
data/gdm.service.in | 1 +
utils/Makefile.am | 9 ++++
utils/gdm-wait-for-drm.c | 101 +++++++++++++++++++++++++++++++++++++++
5 files changed, 113 insertions(+)
create mode 100644 utils/gdm-wait-for-drm.c
diff --git a/configure.ac b/configure.ac
index a8dcfbef..2755c100 100644
--- a/configure.ac
+++ b/configure.ac
@@ -76,6 +76,7 @@ PKG_CHECK_MODULES(COMMON,
gobject-2.0 >= $GLIB_REQUIRED_VERSION
gio-2.0 >= $GLIB_REQUIRED_VERSION
gio-unix-2.0 >= $GLIB_REQUIRED_VERSION
+ gudev-1.0
)
AC_SUBST(COMMON_CFLAGS)
AC_SUBST(COMMON_LIBS)
diff --git a/data/Makefile.am b/data/Makefile.am
index 162074f1..5f426fea 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -204,6 +204,7 @@ systemdsystemunit =
gdm.service: $(srcdir)/gdm.service.in
$(AM_V_GEN)sed \
-e 's,[@]sbindir[@],$(sbindir),g' \
+ -e 's,[@]libexecdir[@],$(libexecdir),g' \
-e 's,[@]GDM_INITIAL_VT[@],$(GDM_INITIAL_VT),g' \
-e 's,[@]LANG_CONFIG_FILE[@],$(LANG_CONFIG_FILE),g' \
-e 's,[@]PLYMOUTH_QUIT_SERVICE[@],$(PLYMOUTH_QUIT_SERVICE),g' \
diff --git a/data/gdm.service.in b/data/gdm.service.in
index 57d60ada..f7630ec4 100644
--- a/data/gdm.service.in
+++ b/data/gdm.service.in
@@ -30,6 +30,7 @@ StandardError=inherit
[email protected][email protected]
ExecReload=/bin/kill -SIGHUP $MAINPID
KeyringMode=shared
[email protected]@/gdm-wait-for-drm
[Install]
Alias=display-manager.service
diff --git a/utils/Makefile.am b/utils/Makefile.am
index babe890b..3eb43c30 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -35,6 +35,7 @@ bin_PROGRAMS = \
libexec_PROGRAMS = \
gdm-disable-wayland \
+ gdm-wait-for-drm \
$(NULL)
gdmflexiserver_LDADD = \
@@ -63,6 +64,14 @@ gdm_disable_wayland_SOURCES = \
gdm-disable-wayland.c \
$(NULL)
+gdm_wait_for_drm_LDADD = \
+ $(COMMON_LIBS) \
+ $(NULL)
+
+gdm_wait_for_drm_SOURCES = \
+ gdm-wait-for-drm.c \
+ $(NULL)
+
CLEANFILES = \
$(NULL)
diff --git a/utils/gdm-wait-for-drm.c b/utils/gdm-wait-for-drm.c
new file mode 100644
index 00000000..aeffb3c0
--- /dev/null
+++ b/utils/gdm-wait-for-drm.c
@@ -0,0 +1,101 @@
+#include <glib.h>
+#include <gudev/gudev.h>
+
+/*
+ * Workaround for LP: #1794280.
+ *
+ * That bug is because the DRM device isn't ready by the time GDM tries to
+ * start wayland/X.
+ * This is a script to add to ExecStartPre of gdm.service. It does the
+ * following:
+ *
+ * 1. Enumerate drm devices from udev, looking for a DRM master. If found,
+ * exit.
+ * 2. Connect to the 'uevent' signal of gudev, watching for the same to be
+ * added. Again exit if any are found.
+ * 3. If, after 10 seconds, we haven't seen anything, try to proceed anyway as
+ * a failsafe.
+ */
+
+static gboolean
+handle_device (GUdevDevice *device)
+{
+ const gchar * const * tags;
+ tags = g_udev_device_get_tags (device);
+ g_debug ("%s\n", g_udev_device_get_name (device));
+ if (g_strv_contains (tags, "master-of-seat"))
+ {
+ g_debug (" is seat master\n");
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void
+uevent_cb (GUdevClient *client G_GNUC_UNUSED,
+ gchar *action,
+ GUdevDevice *device,
+ gpointer user_data)
+{
+ GMainLoop *loop;
+
+ g_debug ("uevent action: %s\n", action);
+
+ loop = (GMainLoop *) user_data;
+
+ if (g_strcmp0 (action, "add") == 0)
+ {
+ if (handle_device (device))
+ {
+ g_debug (" this is good\n");
+ g_main_loop_quit (loop);
+ }
+ else
+ {
+ g_debug (" this is bad\n");
+ }
+ }
+}
+
+int
+main()
+{
+ const gchar * const subsystems[] = { "drm", NULL };
+
+ g_autoptr(GList) devices = NULL;
+ g_autoptr(GMainLoop) loop = NULL;
+ g_autoptr(GUdevClient) udev_client = NULL;
+ g_autoptr(GUdevEnumerator) enumerator = NULL;
+
+ loop = g_main_loop_new (NULL, FALSE);
+
+ udev_client = g_udev_client_new (subsystems);
+ enumerator = g_udev_enumerator_new (udev_client);
+ g_udev_enumerator_add_match_is_initialized (enumerator);
+ g_udev_enumerator_add_match_subsystem (enumerator, "drm");
+
+ devices = g_udev_enumerator_execute (enumerator);
+
+ g_debug ("enumerating devices...\n");
+
+ for (GList *l = devices; l != NULL; l = l->next)
+ {
+ g_autoptr(GUdevDevice) device = G_UDEV_DEVICE (l->data);
+
+ if (handle_device (device))
+ {
+ g_debug (" good enough for gdm\n");
+ return EXIT_SUCCESS;
+ }
+ }
+
+ g_signal_connect (udev_client, "uevent", G_CALLBACK (uevent_cb), loop);
+
+ /* after 10 seconds we try anyway */
+ g_timeout_add_seconds (10, (GSourceFunc) g_main_loop_quit, loop);
+
+ g_main_loop_run (loop);
+
+ return EXIT_SUCCESS;
+}
--
2.17.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment