1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
From 42c51761cc82edbaa50d702a4614e179ad4bcd63 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Thu, 12 Nov 2020 20:30:55 +0100
Subject: [PATCH] Retry starting the display server
Even if the CanGraphical property of a Seat is true, it's possible that it's
still too early for X to start, as it might need some driver or device which
isn't present yet.
Fixes #1316
---
src/daemon/Seat.cpp | 23 ++++++++++++++++++-----
src/daemon/Seat.h | 4 +++-
src/daemon/XorgDisplayServer.cpp | 10 ++++++----
3 files changed, 27 insertions(+), 10 deletions(-)
diff --git a/src/daemon/Seat.cpp b/src/daemon/Seat.cpp
index eef26da45..838c2221d 100644
--- a/src/daemon/Seat.cpp
+++ b/src/daemon/Seat.cpp
@@ -28,6 +28,7 @@
#include <QDebug>
#include <QFile>
+#include <QTimer>
#include <functional>
@@ -52,7 +53,7 @@ namespace SDDM {
return m_name;
}
- bool Seat::createDisplay(int terminalId) {
+ void Seat::createDisplay(int terminalId) {
//reload config if needed
mainConfig.load();
@@ -84,12 +85,24 @@ namespace SDDM {
m_displays << display;
// start the display
- if (!display->start()) {
- qCritical() << "Could not start Display server on vt" << terminalId;
- return false;
+ startDisplay(display);
+ }
+
+ void Seat::startDisplay(Display *display, int tryNr) {
+ if (display->start())
+ return;
+
+ // It's possible that the system isn't ready yet (driver not loaded,
+ // device not enumerated, ...). It's not possible to tell when that changes,
+ // so try a few times with a delay in between.
+ qWarning() << "Attempt" << tryNr << "starting the Display server on vt" << display->terminalId() << "failed";
+
+ if(tryNr >= 3) {
+ qCritical() << "Could not start Display server on vt" << display->terminalId();
+ return;
}
- return true;
+ QTimer::singleShot(2000, display, [=] { startDisplay(display, tryNr + 1); });
}
void Seat::removeDisplay(Display* display) {
diff --git a/src/daemon/Seat.h b/src/daemon/Seat.h
index bf22566b7..f9fe7331f 100644
--- a/src/daemon/Seat.h
+++ b/src/daemon/Seat.h
@@ -35,13 +35,15 @@ namespace SDDM {
const QString &name() const;
public slots:
- bool createDisplay(int terminalId = -1);
+ void createDisplay(int terminalId = -1);
void removeDisplay(SDDM::Display* display);
private slots:
void displayStopped();
private:
+ void startDisplay(SDDM::Display *display, int tryNr = 1);
+
QString m_name;
QVector<Display *> m_displays;
diff --git a/src/daemon/XorgDisplayServer.cpp b/src/daemon/XorgDisplayServer.cpp
index e60c02210..5f40fe8c3 100644
--- a/src/daemon/XorgDisplayServer.cpp
+++ b/src/daemon/XorgDisplayServer.cpp
@@ -248,6 +248,12 @@ namespace SDDM {
}
void XorgDisplayServer::finished() {
+ // clean up
+ if (process) {
+ process->deleteLater();
+ process = nullptr;
+ }
+
// check flag
if (!m_started)
return;
@@ -283,10 +289,6 @@ namespace SDDM {
displayStopScript->deleteLater();
displayStopScript = nullptr;
- // clean up
- process->deleteLater();
- process = nullptr;
-
// remove authority file
QFile::remove(m_authPath);
|