Make Compositor responsible for locking compositing type
It's something that Compositor cares, not necessarily the output backend.
This commit is contained in:
parent
c67660b0fa
commit
5a227bf69d
9 changed files with 18 additions and 46 deletions
|
@ -64,7 +64,6 @@ void GenericSceneOpenGLTest::initTestCase()
|
|||
QVERIFY(Compositor::self());
|
||||
|
||||
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
|
||||
QCOMPARE(kwinApp()->platform()->selectedCompositor(), KWin::OpenGLCompositing);
|
||||
}
|
||||
|
||||
void GenericSceneOpenGLTest::testRestart()
|
||||
|
@ -77,7 +76,6 @@ void GenericSceneOpenGLTest::testRestart()
|
|||
}
|
||||
QCOMPARE(sceneCreatedSpy.count(), 1);
|
||||
QCOMPARE(Compositor::self()->backend()->compositingType(), KWin::OpenGLCompositing);
|
||||
QCOMPARE(kwinApp()->platform()->selectedCompositor(), KWin::OpenGLCompositing);
|
||||
|
||||
// trigger a repaint
|
||||
KWin::Compositor::self()->scene()->addRepaintFull();
|
||||
|
|
|
@ -105,7 +105,6 @@ void SceneQPainterTest::testStartFrame()
|
|||
Compositor::self()->scene()->addRepaintFull();
|
||||
auto scene = Compositor::self()->scene();
|
||||
QVERIFY(scene);
|
||||
QCOMPARE(kwinApp()->platform()->selectedCompositor(), QPainterCompositing);
|
||||
QSignalSpy frameRenderedSpy(scene, &Scene::frameRendered);
|
||||
QVERIFY(frameRenderedSpy.wait());
|
||||
// now let's render a reference image for comparison
|
||||
|
|
|
@ -372,9 +372,6 @@ void DrmBackend::sceneInitialized()
|
|||
|
||||
QVector<CompositingType> DrmBackend::supportedCompositors() const
|
||||
{
|
||||
if (selectedCompositor() != NoCompositing) {
|
||||
return {selectedCompositor()};
|
||||
}
|
||||
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
|
||||
}
|
||||
|
||||
|
|
|
@ -47,9 +47,6 @@ public:
|
|||
|
||||
QVector<CompositingType> supportedCompositors() const override
|
||||
{
|
||||
if (selectedCompositor() != NoCompositing) {
|
||||
return {selectedCompositor()};
|
||||
}
|
||||
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
|
||||
}
|
||||
|
||||
|
|
|
@ -909,9 +909,6 @@ bool WaylandBackend::pointerIsLocked()
|
|||
|
||||
QVector<CompositingType> WaylandBackend::supportedCompositors() const
|
||||
{
|
||||
if (selectedCompositor() != NoCompositing) {
|
||||
return {selectedCompositor()};
|
||||
}
|
||||
#if HAVE_WAYLAND_EGL
|
||||
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
|
||||
#else
|
||||
|
|
|
@ -121,9 +121,6 @@ public:
|
|||
|
||||
QVector<CompositingType> supportedCompositors() const override
|
||||
{
|
||||
if (selectedCompositor() != NoCompositing) {
|
||||
return {selectedCompositor()};
|
||||
}
|
||||
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
|
||||
}
|
||||
|
||||
|
|
|
@ -254,19 +254,25 @@ bool Compositor::setupStart()
|
|||
|
||||
Q_EMIT aboutToToggleCompositing();
|
||||
|
||||
auto supportedCompositors = kwinApp()->platform()->supportedCompositors();
|
||||
const auto userConfigIt = std::find(supportedCompositors.begin(), supportedCompositors.end(),
|
||||
options->compositingMode());
|
||||
const QVector<CompositingType> availableCompositors = kwinApp()->platform()->supportedCompositors();
|
||||
QVector<CompositingType> candidateCompositors;
|
||||
|
||||
if (userConfigIt != supportedCompositors.end()) {
|
||||
supportedCompositors.erase(userConfigIt);
|
||||
supportedCompositors.prepend(options->compositingMode());
|
||||
// If compositing has been restarted, try to use the last used compositing type.
|
||||
if (m_selectedCompositor != NoCompositing) {
|
||||
candidateCompositors.append(m_selectedCompositor);
|
||||
} else {
|
||||
qCWarning(KWIN_CORE)
|
||||
<< "Configured compositor not supported by Platform. Falling back to defaults";
|
||||
candidateCompositors = availableCompositors;
|
||||
|
||||
const auto userConfigIt = std::find(candidateCompositors.begin(), candidateCompositors.end(), options->compositingMode());
|
||||
if (userConfigIt != candidateCompositors.end()) {
|
||||
candidateCompositors.erase(userConfigIt);
|
||||
candidateCompositors.prepend(options->compositingMode());
|
||||
} else {
|
||||
qCWarning(KWIN_CORE) << "Configured compositor not supported by Platform. Falling back to defaults";
|
||||
}
|
||||
}
|
||||
|
||||
for (auto type : qAsConst(supportedCompositors)) {
|
||||
for (auto type : qAsConst(candidateCompositors)) {
|
||||
bool stop = false;
|
||||
switch (type) {
|
||||
case OpenGLCompositing:
|
||||
|
@ -299,7 +305,7 @@ bool Compositor::setupStart()
|
|||
m_selectionOwner->setOwning(false);
|
||||
m_selectionOwner->release();
|
||||
}
|
||||
if (!supportedCompositors.contains(NoCompositing)) {
|
||||
if (!availableCompositors.contains(NoCompositing)) {
|
||||
qCCritical(KWIN_CORE) << "The used windowing system requires compositing";
|
||||
qCCritical(KWIN_CORE) << "We are going to quit KWin now as it is broken";
|
||||
qApp->quit();
|
||||
|
@ -307,7 +313,7 @@ bool Compositor::setupStart()
|
|||
return false;
|
||||
}
|
||||
|
||||
kwinApp()->platform()->setSelectedCompositor(m_backend->compositingType());
|
||||
m_selectedCompositor = m_backend->compositingType();
|
||||
|
||||
if (!Workspace::self() && m_backend && m_backend->compositingType() == QPainterCompositing) {
|
||||
// Force Software QtQuick on first startup with QPainter.
|
||||
|
|
|
@ -156,6 +156,7 @@ private:
|
|||
std::unique_ptr<Scene> m_scene;
|
||||
std::unique_ptr<RenderBackend> m_backend;
|
||||
QHash<RenderLoop *, RenderLayer *> m_superlayers;
|
||||
CompositingType m_selectedCompositor = NoCompositing;
|
||||
};
|
||||
|
||||
class KWIN_EXPORT WaylandCompositor final : public Compositor
|
||||
|
|
|
@ -293,25 +293,6 @@ public:
|
|||
*/
|
||||
virtual QString supportInformation() const;
|
||||
|
||||
/**
|
||||
* The compositor plugin which got selected from @ref supportedCompositors.
|
||||
* Prior to selecting a compositor this returns @c NoCompositing.
|
||||
*
|
||||
* This method allows the platforms to limit the offerings in @ref supportedCompositors
|
||||
* in case they do not support runtime compositor switching
|
||||
*/
|
||||
CompositingType selectedCompositor() const
|
||||
{
|
||||
return m_selectedCompositor;
|
||||
}
|
||||
/**
|
||||
* Used by Compositor to set the used compositor.
|
||||
*/
|
||||
void setSelectedCompositor(CompositingType type)
|
||||
{
|
||||
m_selectedCompositor = type;
|
||||
}
|
||||
|
||||
virtual Output *createVirtualOutput(const QString &name, const QSize &size, qreal scale);
|
||||
virtual void removeVirtualOutput(Output *output);
|
||||
|
||||
|
@ -366,7 +347,6 @@ private:
|
|||
EGLDisplay m_eglDisplay;
|
||||
EGLContext m_globalShareContext = EGL_NO_CONTEXT;
|
||||
bool m_supportsGammaControl = false;
|
||||
CompositingType m_selectedCompositor = NoCompositing;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
||||
|
|
Loading…
Reference in a new issue