parent
24dbe5b7fa
commit
00cef37f82
@ -0,0 +1,118 @@
|
|||||||
|
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 eef26da..838c222 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 bf22566..f9fe733 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 e60c022..5f40fe8 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);
|
||||||
|
|
||||||
|
--
|
||||||
|
2.31.1
|
||||||
|
|
@ -0,0 +1,216 @@
|
|||||||
|
From 308fd0df2583b02251f0d80c397ccbf9fa7a9e04 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Pier Luigi Fiorini <pierluigi.fiorini@liri.io>
|
||||||
|
Date: Sun, 28 Feb 2021 12:07:33 +0100
|
||||||
|
Subject: [PATCH] Allocate VT for the display
|
||||||
|
|
||||||
|
Replace the old crude algorithm to find the next available VT with a
|
||||||
|
more reliable method using the VT_OPENQRY ioctl.
|
||||||
|
|
||||||
|
General.MinimumVT setting is now obsolete and it's no longer used.
|
||||||
|
---
|
||||||
|
CMakeLists.txt | 4 ----
|
||||||
|
data/man/sddm.conf.rst.in | 2 +-
|
||||||
|
src/common/Configuration.h | 1 -
|
||||||
|
src/common/Constants.h.in | 1 -
|
||||||
|
src/daemon/Display.cpp | 8 +++++---
|
||||||
|
src/daemon/Display.h | 2 +-
|
||||||
|
src/daemon/Seat.cpp | 38 +++-----------------------------------
|
||||||
|
src/daemon/Seat.h | 3 +--
|
||||||
|
8 files changed, 11 insertions(+), 48 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
index e52e0e90..9614b4e1 100644
|
||||||
|
--- a/CMakeLists.txt
|
||||||
|
+++ b/CMakeLists.txt
|
||||||
|
@@ -141,7 +141,6 @@ if(SYSTEMD_FOUND)
|
||||||
|
string(REGEX REPLACE "[ \t\n]+" "" SYSTEMD_SYSTEM_UNIT_DIR ${SYSTEMD_SYSTEM_UNIT_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
- set(MINIMUM_VT 1)
|
||||||
|
set(HALT_COMMAND "/usr/bin/systemctl poweroff")
|
||||||
|
set(REBOOT_COMMAND "/usr/bin/systemctl reboot")
|
||||||
|
else()
|
||||||
|
@@ -159,7 +158,6 @@ if(ELOGIND_FOUND)
|
||||||
|
add_definitions(-DHAVE_ELOGIND)
|
||||||
|
set(CMAKE_AUTOMOC_MOC_OPTIONS -DHAVE_ELOGIND)
|
||||||
|
|
||||||
|
- set(MINIMUM_VT 7)
|
||||||
|
set(HALT_COMMAND "/usr/bin/loginctl poweroff")
|
||||||
|
set(REBOOT_COMMAND "/usr/bin/loginctl reboot")
|
||||||
|
endif()
|
||||||
|
@@ -171,10 +169,8 @@ if (NOT ELOGIND_FOUND AND NOT SYSTEMD_FOUND)
|
||||||
|
# commands for shutdown and reboot. On FreeBSD, there are
|
||||||
|
# normally more getty's running than on Linux.
|
||||||
|
if("${CMAKE_SYSTEM_NAME}" STREQUAL "FreeBSD")
|
||||||
|
- set(MINIMUM_VT 9)
|
||||||
|
set(HALT_COMMAND "/sbin/shutdown -p now")
|
||||||
|
else()
|
||||||
|
- set(MINIMUM_VT 7)
|
||||||
|
set(HALT_COMMAND "/sbin/shutdown -h -P now")
|
||||||
|
endif()
|
||||||
|
set(REBOOT_COMMAND "/sbin/shutdown -r now")
|
||||||
|
diff --git a/data/man/sddm.conf.rst.in b/data/man/sddm.conf.rst.in
|
||||||
|
index bee07681..1061540c 100644
|
||||||
|
--- a/data/man/sddm.conf.rst.in
|
||||||
|
+++ b/data/man/sddm.conf.rst.in
|
||||||
|
@@ -144,7 +144,7 @@ OPTIONS
|
||||||
|
Minimum virtual terminal number that will be used
|
||||||
|
by the first display. Virtual terminal number will
|
||||||
|
increase as new displays added.
|
||||||
|
- Default value is @MINIMUM_VT@.
|
||||||
|
+ This setting is no longer available since SDDM v0.20.
|
||||||
|
|
||||||
|
`EnableHiDPI=`
|
||||||
|
Enables Qt's automatic HiDPI scaling.
|
||||||
|
diff --git a/src/common/Configuration.h b/src/common/Configuration.h
|
||||||
|
index cf44a629..b7987198 100644
|
||||||
|
--- a/src/common/Configuration.h
|
||||||
|
+++ b/src/common/Configuration.h
|
||||||
|
@@ -70,7 +70,6 @@ namespace SDDM {
|
||||||
|
Entry(UserAuthFile, QString, _S(".Xauthority"), _S("Path to the Xauthority file"));
|
||||||
|
Entry(DisplayCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xsetup"), _S("Path to a script to execute when starting the display server"));
|
||||||
|
Entry(DisplayStopCommand, QString, _S(DATA_INSTALL_DIR "/scripts/Xstop"), _S("Path to a script to execute when stopping the display server"));
|
||||||
|
- Entry(MinimumVT, int, MINIMUM_VT, _S("The lowest virtual terminal number that will be used."));
|
||||||
|
Entry(EnableHiDPI, bool, false, _S("Enable Qt's automatic high-DPI scaling"));
|
||||||
|
);
|
||||||
|
|
||||||
|
diff --git a/src/common/Constants.h.in b/src/common/Constants.h.in
|
||||||
|
index e174b5bf..48051288 100644
|
||||||
|
--- a/src/common/Constants.h.in
|
||||||
|
+++ b/src/common/Constants.h.in
|
||||||
|
@@ -37,7 +37,6 @@
|
||||||
|
#define SYSTEM_CONFIG_DIR "@SYSTEM_CONFIG_DIR@"
|
||||||
|
|
||||||
|
#define LOG_FILE "@LOG_FILE@"
|
||||||
|
-#define MINIMUM_VT @MINIMUM_VT@
|
||||||
|
|
||||||
|
#define UID_MIN @UID_MIN@
|
||||||
|
#define UID_MAX @UID_MAX@
|
||||||
|
diff --git a/src/daemon/Display.cpp b/src/daemon/Display.cpp
|
||||||
|
index a65df3f0..dbef510d 100644
|
||||||
|
--- a/src/daemon/Display.cpp
|
||||||
|
+++ b/src/daemon/Display.cpp
|
||||||
|
@@ -45,17 +45,19 @@
|
||||||
|
|
||||||
|
#include "Login1Manager.h"
|
||||||
|
#include "Login1Session.h"
|
||||||
|
-
|
||||||
|
+#include "VirtualTerminal.h"
|
||||||
|
|
||||||
|
namespace SDDM {
|
||||||
|
- Display::Display(const int terminalId, Seat *parent) : QObject(parent),
|
||||||
|
- m_terminalId(terminalId),
|
||||||
|
+ Display::Display(Seat *parent) : QObject(parent),
|
||||||
|
m_auth(new Auth(this)),
|
||||||
|
m_displayServer(new XorgDisplayServer(this)),
|
||||||
|
m_seat(parent),
|
||||||
|
m_socketServer(new SocketServer(this)),
|
||||||
|
m_greeter(new Greeter(this)) {
|
||||||
|
|
||||||
|
+ // Allocate vt
|
||||||
|
+ m_terminalId = VirtualTerminal::setUpNewVt();
|
||||||
|
+
|
||||||
|
// respond to authentication requests
|
||||||
|
m_auth->setVerbose(true);
|
||||||
|
connect(m_auth, &Auth::requestChanged, this, &Display::slotRequestChanged);
|
||||||
|
diff --git a/src/daemon/Display.h b/src/daemon/Display.h
|
||||||
|
index e68bc128..9db954d1 100644
|
||||||
|
--- a/src/daemon/Display.h
|
||||||
|
+++ b/src/daemon/Display.h
|
||||||
|
@@ -41,7 +41,7 @@ namespace SDDM {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_DISABLE_COPY(Display)
|
||||||
|
public:
|
||||||
|
- explicit Display(int terminalId, Seat *parent);
|
||||||
|
+ explicit Display(Seat *parent);
|
||||||
|
~Display();
|
||||||
|
|
||||||
|
QString displayId() const;
|
||||||
|
diff --git a/src/daemon/Seat.cpp b/src/daemon/Seat.cpp
|
||||||
|
index 838c2221..a2f3d0c3 100644
|
||||||
|
--- a/src/daemon/Seat.cpp
|
||||||
|
+++ b/src/daemon/Seat.cpp
|
||||||
|
@@ -33,18 +33,6 @@
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
namespace SDDM {
|
||||||
|
- int findUnused(int minimum, std::function<bool(const int)> used) {
|
||||||
|
- // initialize with minimum
|
||||||
|
- int number = minimum;
|
||||||
|
-
|
||||||
|
- // find unused
|
||||||
|
- while (used(number))
|
||||||
|
- number++;
|
||||||
|
-
|
||||||
|
- // return number;
|
||||||
|
- return number;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
Seat::Seat(const QString &name, QObject *parent) : QObject(parent), m_name(name) {
|
||||||
|
createDisplay();
|
||||||
|
}
|
||||||
|
@@ -53,30 +41,13 @@ namespace SDDM {
|
||||||
|
return m_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
- void Seat::createDisplay(int terminalId) {
|
||||||
|
+ void Seat::createDisplay() {
|
||||||
|
//reload config if needed
|
||||||
|
mainConfig.load();
|
||||||
|
|
||||||
|
- if (m_name == QLatin1String("seat0")) {
|
||||||
|
- if (terminalId == -1) {
|
||||||
|
- // find unused terminal
|
||||||
|
- terminalId = findUnused(mainConfig.X11.MinimumVT.get(), [&](const int number) {
|
||||||
|
- return m_terminalIds.contains(number);
|
||||||
|
- });
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- // mark terminal as used
|
||||||
|
- m_terminalIds << terminalId;
|
||||||
|
-
|
||||||
|
- // log message
|
||||||
|
- qDebug() << "Adding new display" << "on vt" << terminalId << "...";
|
||||||
|
- }
|
||||||
|
- else {
|
||||||
|
- qDebug() << "Adding new VT-less display...";
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
// create a new display
|
||||||
|
- Display *display = new Display(terminalId, this);
|
||||||
|
+ qDebug() << "Adding new display...";
|
||||||
|
+ Display *display = new Display(this);
|
||||||
|
|
||||||
|
// restart display on stop
|
||||||
|
connect(display, &Display::stopped, this, &Seat::displayStopped);
|
||||||
|
@@ -112,9 +83,6 @@ namespace SDDM {
|
||||||
|
// remove display from list
|
||||||
|
m_displays.removeAll(display);
|
||||||
|
|
||||||
|
- // mark display and terminal ids as unused
|
||||||
|
- m_terminalIds.removeAll(display->terminalId());
|
||||||
|
-
|
||||||
|
// stop the display
|
||||||
|
display->blockSignals(true);
|
||||||
|
display->stop();
|
||||||
|
diff --git a/src/daemon/Seat.h b/src/daemon/Seat.h
|
||||||
|
index f9fe7331..685eaedd 100644
|
||||||
|
--- a/src/daemon/Seat.h
|
||||||
|
+++ b/src/daemon/Seat.h
|
||||||
|
@@ -35,7 +35,7 @@ namespace SDDM {
|
||||||
|
const QString &name() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
- void createDisplay(int terminalId = -1);
|
||||||
|
+ void createDisplay();
|
||||||
|
void removeDisplay(SDDM::Display* display);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
@@ -47,7 +47,6 @@ namespace SDDM {
|
||||||
|
QString m_name;
|
||||||
|
|
||||||
|
QVector<Display *> m_displays;
|
||||||
|
- QVector<int> m_terminalIds;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in new issue