Rearrange wayland startup sequence
The backend can now optionally wait for the scene to be created before it updates its outputs, which is necessary for better atomic tests in the DRM backend.
This commit is contained in:
parent
1d906169d8
commit
2742e5b422
5 changed files with 31 additions and 47 deletions
|
@ -164,6 +164,16 @@ void ApplicationWayland::performStartup()
|
|||
TabletModeManager::create(this);
|
||||
createPlugins();
|
||||
|
||||
createScreens();
|
||||
WaylandCompositor::create();
|
||||
|
||||
connect(Compositor::self(), &Compositor::sceneCreated, platform(), &Platform::sceneInitialized);
|
||||
connect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::continueStartupWithScene);
|
||||
}
|
||||
|
||||
void ApplicationWayland::continueStartupWithScene()
|
||||
{
|
||||
disconnect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::continueStartupWithScene);
|
||||
if (!platform()->enabledOutputs().isEmpty()) {
|
||||
continueStartupWithScreens();
|
||||
} else {
|
||||
|
@ -173,25 +183,7 @@ void ApplicationWayland::performStartup()
|
|||
|
||||
void ApplicationWayland::continueStartupWithScreens()
|
||||
{
|
||||
disconnect(kwinApp()->platform(), &Platform::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
|
||||
createScreens();
|
||||
WaylandCompositor::create();
|
||||
connect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::continueStartupWithScene);
|
||||
}
|
||||
|
||||
void ApplicationWayland::finalizeStartup()
|
||||
{
|
||||
if (m_xwayland) {
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &ApplicationWayland::finalizeStartup);
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
||||
}
|
||||
startSession();
|
||||
notifyStarted();
|
||||
}
|
||||
|
||||
void ApplicationWayland::continueStartupWithScene()
|
||||
{
|
||||
disconnect(Compositor::self(), &Compositor::sceneCreated, this, &ApplicationWayland::continueStartupWithScene);
|
||||
disconnect(platform(), &Platform::screensQueried, this, &ApplicationWayland::continueStartupWithScreens);
|
||||
|
||||
// Note that we start accepting client connections after creating the Workspace.
|
||||
createWorkspace();
|
||||
|
@ -211,6 +203,16 @@ void ApplicationWayland::continueStartupWithScene()
|
|||
m_xwayland->start();
|
||||
}
|
||||
|
||||
void ApplicationWayland::finalizeStartup()
|
||||
{
|
||||
if (m_xwayland) {
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::errorOccurred, this, &ApplicationWayland::finalizeStartup);
|
||||
disconnect(m_xwayland, &Xwl::Xwayland::started, this, &ApplicationWayland::finalizeStartup);
|
||||
}
|
||||
startSession();
|
||||
notifyStarted();
|
||||
}
|
||||
|
||||
void ApplicationWayland::refreshSettings(const KConfigGroup &group, const QByteArrayList &names)
|
||||
{
|
||||
if (group.name() != "Wayland" || !names.contains("InputMethod")) {
|
||||
|
|
|
@ -459,6 +459,7 @@ public Q_SLOTS:
|
|||
void processPinchGestureCancelled(quint32 time);
|
||||
|
||||
void cursorRendered(const QRect &geometry);
|
||||
virtual void sceneInitialized() {};
|
||||
|
||||
Q_SIGNALS:
|
||||
void screensQueried();
|
||||
|
|
|
@ -197,12 +197,6 @@ bool DrmBackend::initialize()
|
|||
}
|
||||
|
||||
initCursor();
|
||||
if (!updateOutputs())
|
||||
return false;
|
||||
|
||||
if (m_outputs.isEmpty()) {
|
||||
qCDebug(KWIN_DRM) << "No connected outputs found on startup.";
|
||||
}
|
||||
|
||||
// setup udevMonitor
|
||||
if (m_udevMonitor) {
|
||||
|
@ -318,11 +312,8 @@ void DrmBackend::removeOutput(DrmOutput *o)
|
|||
emit outputRemoved(o);
|
||||
}
|
||||
|
||||
bool DrmBackend::updateOutputs()
|
||||
void DrmBackend::updateOutputs()
|
||||
{
|
||||
if (m_gpus.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
const auto oldOutputs = m_outputs;
|
||||
for (auto it = m_gpus.begin(); it < m_gpus.end();) {
|
||||
auto gpu = *it;
|
||||
|
@ -343,7 +334,6 @@ bool DrmBackend::updateOutputs()
|
|||
if (!m_outputs.isEmpty()) {
|
||||
emit screensQueried();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace KWinKScreenIntegration
|
||||
|
@ -613,6 +603,11 @@ OpenGLBackend *DrmBackend::createOpenGLBackend()
|
|||
#endif
|
||||
}
|
||||
|
||||
void DrmBackend::sceneInitialized()
|
||||
{
|
||||
updateOutputs();
|
||||
}
|
||||
|
||||
QVector<CompositingType> DrmBackend::supportedCompositors() const
|
||||
{
|
||||
if (selectedCompositor() != NoCompositing) {
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
void turnOutputsOn();
|
||||
void sceneInitialized() override;
|
||||
|
||||
Q_SIGNALS:
|
||||
void gpuRemoved(DrmGpu *gpu);
|
||||
|
@ -84,7 +85,7 @@ private:
|
|||
void activate(bool active);
|
||||
void reactivate();
|
||||
void deactivate();
|
||||
bool updateOutputs();
|
||||
void updateOutputs();
|
||||
void updateCursor();
|
||||
void moveCursor();
|
||||
void initCursor();
|
||||
|
|
|
@ -146,23 +146,8 @@ void EglGbmBackend::init()
|
|||
bool EglGbmBackend::initRenderingContext()
|
||||
{
|
||||
initBufferConfigs();
|
||||
// no secondary GPU -> no OpenGL context!
|
||||
if (isPrimary() && !createContext()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto outputs = m_gpu->outputs();
|
||||
|
||||
for (DrmOutput *drmOutput: outputs) {
|
||||
addOutput(drmOutput);
|
||||
}
|
||||
|
||||
if (m_outputs.isEmpty() && !outputs.isEmpty()) {
|
||||
qCCritical(KWIN_DRM) << "Create Window Surfaces failed";
|
||||
return false;
|
||||
}
|
||||
if (isPrimary()) {
|
||||
return makeCurrent();
|
||||
return createContext() && makeCurrent();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue