core: Drop OutputBackend::isReady()

OutputBackend has a concept of readiness. When the host compositor goes
down, the OutputBackend will be marked as not ready, and when it
reappears, the output backend will be marked ready again.

On the other hand, host compositor going down is a niche case, it's not
something that often happens and it's hard to justify adding more moving
parts to the startup code. It's easier to call initialize() and check
whether it fails rather than call initialize() and then monitor isReady.

Therefore, this change drops OutputBackend::isReady() to make startup
simpler.
This commit is contained in:
Vlad Zahorodnii 2022-11-11 10:46:19 +02:00
parent 6951d662d6
commit be3146873f
8 changed files with 2 additions and 36 deletions

View file

@ -218,7 +218,6 @@ bool DrmBackend::initialize()
m_udevMonitor->enable(); m_udevMonitor->enable();
} }
} }
setReady(true);
return true; return true;
} }

View file

@ -40,7 +40,6 @@ VirtualBackend::~VirtualBackend()
bool VirtualBackend::initialize() bool VirtualBackend::initialize()
{ {
setReady(true);
return true; return true;
} }

View file

@ -608,7 +608,6 @@ bool WaylandBackend::initialize()
m_waylandCursor->init(); m_waylandCursor->init();
}); });
setReady(true);
return true; return true;
} }

View file

@ -128,9 +128,7 @@ X11StandaloneBackend::~X11StandaloneBackend()
if (sceneEglDisplay() != EGL_NO_DISPLAY) { if (sceneEglDisplay() != EGL_NO_DISPLAY) {
eglTerminate(sceneEglDisplay()); eglTerminate(sceneEglDisplay());
} }
if (isReady()) { XRenderUtils::cleanup();
XRenderUtils::cleanup();
}
} }
bool X11StandaloneBackend::initialize() bool X11StandaloneBackend::initialize()
@ -139,7 +137,6 @@ bool X11StandaloneBackend::initialize()
return false; return false;
} }
XRenderUtils::init(kwinApp()->x11Connection(), kwinApp()->x11RootWindow()); XRenderUtils::init(kwinApp()->x11Connection(), kwinApp()->x11RootWindow());
setReady(true);
initOutputs(); initOutputs();
if (Xcb::Extensions::self()->isRandrAvailable()) { if (Xcb::Extensions::self()->isRandrAvailable()) {

View file

@ -206,7 +206,6 @@ bool X11WindowedBackend::initialize()
KWin::Cursor *c = KWin::Cursors::self()->currentCursor(); KWin::Cursor *c = KWin::Cursors::self()->currentCursor();
createCursor(c->image(), c->hotspot()); createCursor(c->image(), c->hotspot());
}); });
setReady(true);
m_pointerDevice = std::make_unique<X11WindowedInputDevice>(); m_pointerDevice = std::make_unique<X11WindowedInputDevice>();
m_pointerDevice->setPointer(true); m_pointerDevice->setPointer(true);
m_keyboardDevice = std::make_unique<X11WindowedInputDevice>(); m_keyboardDevice = std::make_unique<X11WindowedInputDevice>();

View file

@ -141,18 +141,7 @@ Compositor::Compositor(QObject *workspace)
// The ctor of this class is invoked from the Workspace ctor, that means before // The ctor of this class is invoked from the Workspace ctor, that means before
// Workspace is completely constructed, so calling Workspace::self() would result // Workspace is completely constructed, so calling Workspace::self() would result
// in undefined behavior. This is fixed by using a delayed invocation. // in undefined behavior. This is fixed by using a delayed invocation.
if (kwinApp()->outputBackend()->isReady()) { QTimer::singleShot(0, this, &Compositor::start);
QTimer::singleShot(0, this, &Compositor::start);
}
connect(
kwinApp()->outputBackend(), &OutputBackend::readyChanged, this, [this](bool ready) {
if (ready) {
start();
} else {
stop();
}
},
Qt::QueuedConnection);
connect(kwinApp(), &Application::x11ConnectionChanged, this, &Compositor::initializeX11); connect(kwinApp(), &Application::x11ConnectionChanged, this, &Compositor::initializeX11);
connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this, &Compositor::cleanupX11); connect(kwinApp(), &Application::x11ConnectionAboutToBeDestroyed, this, &Compositor::cleanupX11);

View file

@ -91,15 +91,6 @@ Output *OutputBackend::findOutput(const QString &name) const
return nullptr; return nullptr;
} }
void OutputBackend::setReady(bool ready)
{
if (m_ready == ready) {
return;
}
m_ready = ready;
Q_EMIT readyChanged(m_ready);
}
Output *OutputBackend::createVirtualOutput(const QString &name, const QSize &size, double scale) Output *OutputBackend::createVirtualOutput(const QString &name, const QSize &size, double scale)
{ {
return nullptr; return nullptr;

View file

@ -74,10 +74,6 @@ public:
*/ */
void setSceneEglGlobalShareContext(EGLContext context); void setSceneEglGlobalShareContext(EGLContext context);
bool isReady() const
{
return m_ready;
}
void setInitialWindowSize(const QSize &size) void setInitialWindowSize(const QSize &size)
{ {
m_initialWindowSize = size; m_initialWindowSize = size;
@ -135,7 +131,6 @@ public Q_SLOTS:
Q_SIGNALS: Q_SIGNALS:
void outputsQueried(); void outputsQueried();
void readyChanged(bool);
/** /**
* This signal is emitted when an output has been connected. The @a output is not ready * This signal is emitted when an output has been connected. The @a output is not ready
* for compositing yet. * for compositing yet.
@ -148,7 +143,6 @@ Q_SIGNALS:
protected: protected:
explicit OutputBackend(QObject *parent = nullptr); explicit OutputBackend(QObject *parent = nullptr);
void setReady(bool ready);
QSize initialWindowSize() const QSize initialWindowSize() const
{ {
return m_initialWindowSize; return m_initialWindowSize;
@ -159,7 +153,6 @@ protected:
} }
private: private:
bool m_ready = false;
QSize m_initialWindowSize; QSize m_initialWindowSize;
QByteArray m_deviceIdentifier; QByteArray m_deviceIdentifier;
int m_initialOutputCount = 1; int m_initialOutputCount = 1;