Commit 09489a4c authored by Martin Flöser's avatar Martin Flöser

Add a pure virtual method to Platform to describe the supported compositors

Summary:
So far KWin does not know which Compositors the platform actually
supports. This results in KWin happily trying to use the OpenGL
compositor on fbdev or the QPainter compositor on hwcomposer although
that is obviously going to fail as the platform doesn't support this.

By adding a pure virtual method all Platforms can define what they
support. In a later step the Compositor can use this to create an
appropriate scene and also perform proper fallback handling in case the
scene creation fails.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8316
parent aed7ff64
......@@ -376,6 +376,12 @@ public:
* Default implementation creates an EffectsHandlerImp;
**/
virtual void createEffectsHandler(Compositor *compositor, Scene *scene);
/**
* The CompositingTypes supported by the Platform.
* The first item should be the most preferred one.
* @since 5.11
**/
virtual QVector<CompositingType> supportedCompositors() const = 0;
public Q_SLOTS:
void pointerMotion(const QPointF &position, quint32 time);
......
......@@ -738,4 +738,13 @@ void DrmBackend::outputDpmsChanged()
setOutputsEnabled(enabled);
}
QVector<CompositingType> DrmBackend::supportedCompositors() const
{
#if HAVE_GBM
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
#else
return QVector<CompositingType>{QPainterCompositing};
#endif
}
}
......@@ -118,6 +118,8 @@ public:
return m_gbmDevice;
}
QVector<CompositingType> supportedCompositors() const override;
public Q_SLOTS:
void turnOutputsOn();
......
......@@ -78,6 +78,10 @@ public:
return m_bgr;
}
QVector<CompositingType> supportedCompositors() const override {
return QVector<CompositingType>{QPainterCompositing};
}
private:
void openFrameBuffer();
bool queryScreenInfo();
......
......@@ -82,6 +82,10 @@ public:
return m_outputBlank;
}
QVector<CompositingType> supportedCompositors() const override {
return QVector<CompositingType>{OpenGLCompositing};
}
Q_SIGNALS:
void outputBlankChanged();
......
......@@ -85,6 +85,10 @@ public:
m_gbmDevice = device;
}
QVector<CompositingType> supportedCompositors() const override {
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
}
Q_SIGNALS:
void sizeChanged();
void outputGeometriesChanged(const QVector<QRect> &geometries);
......
......@@ -653,6 +653,16 @@ void WaylandBackend::updateWindowTitle()
}
}
QVector<CompositingType> WaylandBackend::supportedCompositors() const
{
#if HAVE_WAYLAND_EGL
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
#else
return QVector<CompositingType>{QPainterCompositing};
#endif
}
}
} // KWin
......@@ -148,6 +148,8 @@ public:
void togglePointerConfinement();
QVector<CompositingType> supportedCompositors() const override;
Q_SIGNALS:
void shellSurfaceSizeChanged(const QSize &size);
void systemCompositorDied();
......
......@@ -410,4 +410,17 @@ void X11StandalonePlatform::createEffectsHandler(Compositor *compositor, Scene *
new EffectsHandlerImplX11(compositor, scene);
}
QVector<CompositingType> X11StandalonePlatform::supportedCompositors() const
{
QVector<CompositingType> compositors;
#if HAVE_EPOXY_GLX
compositors << OpenGLCompositing;
#endif
#ifdef KWIN_HAVE_XRENDER_COMPOSITING
compositors << XRenderCompositing;
#endif
compositors << NoCompositing;
return compositors;
}
}
......@@ -65,6 +65,7 @@ public:
void invertScreen() override;
void createEffectsHandler(Compositor *compositor, Scene *scene) override;
QVector<CompositingType> supportedCompositors() const override;
protected:
void doHideCursor() override;
......
......@@ -69,6 +69,10 @@ public:
QPainterBackend* createQPainterBackend() override;
void warpPointer(const QPointF &globalPos) override;
QVector<CompositingType> supportedCompositors() const override {
return QVector<CompositingType>{OpenGLCompositing, QPainterCompositing};
}
Q_SIGNALS:
void sizeChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment