Move Scene::isPerScreenRenderingEnabled() to Platform
This way the Compositor can know if per screen rendering is enabled before creating the Scene.
This commit is contained in:
parent
b94c876597
commit
017528956b
36 changed files with 29 additions and 96 deletions
|
@ -685,7 +685,7 @@ void Compositor::performCompositing()
|
|||
kwinApp()->platform()->createOpenGLSafePoint(Platform::OpenGLSafePoint::PreFrame);
|
||||
}
|
||||
m_renderTimer.start();
|
||||
if (m_scene->isPerScreenRenderingEnabled()) {
|
||||
if (kwinApp()->platform()->isPerScreenRenderingEnabled()) {
|
||||
for (int screenId = 0; screenId < screens()->count(); ++screenId) {
|
||||
m_scene->paint(screenId, repaints, windows);
|
||||
}
|
||||
|
|
10
platform.cpp
10
platform.cpp
|
@ -434,6 +434,16 @@ void Platform::setReady(bool ready)
|
|||
emit readyChanged(m_ready);
|
||||
}
|
||||
|
||||
bool Platform::isPerScreenRenderingEnabled() const
|
||||
{
|
||||
return m_isPerScreenRenderingEnabled;
|
||||
}
|
||||
|
||||
void Platform::setPerScreenRenderingEnabled(bool enabled)
|
||||
{
|
||||
m_isPerScreenRenderingEnabled = enabled;
|
||||
}
|
||||
|
||||
void Platform::warpPointer(const QPointF &globalPos)
|
||||
{
|
||||
Q_UNUSED(globalPos)
|
||||
|
|
|
@ -454,6 +454,11 @@ public:
|
|||
m_selectedCompositor = type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns @c true if rendering is split per screen; otherwise returns @c false.
|
||||
*/
|
||||
bool isPerScreenRenderingEnabled() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void pointerMotion(const QPointF &position, quint32 time);
|
||||
void pointerButtonPressed(quint32 button, quint32 time);
|
||||
|
@ -500,6 +505,7 @@ protected:
|
|||
void setSoftwareCursorForced(bool forced);
|
||||
void repaint(const QRect &rect);
|
||||
void setReady(bool ready);
|
||||
void setPerScreenRenderingEnabled(bool enabled);
|
||||
QSize initialWindowSize() const {
|
||||
return m_initialWindowSize;
|
||||
}
|
||||
|
@ -566,6 +572,7 @@ private:
|
|||
int m_hideCursorCounter = 0;
|
||||
bool m_supportsGammaControl = false;
|
||||
bool m_supportsOutputChanges = false;
|
||||
bool m_isPerScreenRenderingEnabled = false;
|
||||
CompositingType m_selectedCompositor = NoCompositing;
|
||||
};
|
||||
|
||||
|
|
|
@ -74,11 +74,6 @@ OverlayWindow* OpenGLBackend::overlayWindow() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
bool OpenGLBackend::perScreenRendering() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void OpenGLBackend::copyPixels(const QRegion ®ion)
|
||||
{
|
||||
const int height = screens()->size().height();
|
||||
|
|
|
@ -59,11 +59,6 @@ public:
|
|||
virtual bool makeCurrent() = 0;
|
||||
virtual void doneCurrent() = 0;
|
||||
virtual bool usesOverlayWindow() const = 0;
|
||||
/**
|
||||
* Whether the rendering needs to be split per screen.
|
||||
* Default implementation returns @c false.
|
||||
*/
|
||||
virtual bool perScreenRendering() const;
|
||||
virtual QRegion beginFrame(int screenId) = 0;
|
||||
virtual void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) = 0;
|
||||
/**
|
||||
|
|
|
@ -34,9 +34,4 @@ void QPainterBackend::setFailed(const QString &reason)
|
|||
m_failed = true;
|
||||
}
|
||||
|
||||
bool QPainterBackend::perScreenRendering() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -50,11 +50,6 @@ public:
|
|||
*/
|
||||
virtual QImage *bufferForScreen(int screenId) = 0;
|
||||
virtual bool needsFullRepaint(int screenId) const = 0;
|
||||
/**
|
||||
* Whether the rendering needs to be split per screen.
|
||||
* Default implementation returns @c false.
|
||||
*/
|
||||
virtual bool perScreenRendering() const;
|
||||
|
||||
protected:
|
||||
QPainterBackend();
|
||||
|
|
|
@ -39,8 +39,3 @@ bool AbstractEglDrmBackend::usesOverlayWindow() const
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool AbstractEglDrmBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ public:
|
|||
~AbstractEglDrmBackend();
|
||||
|
||||
bool usesOverlayWindow() const override;
|
||||
bool perScreenRendering() const override;
|
||||
void screenGeometryChanged(const QSize &size) override;
|
||||
|
||||
virtual int screenCount() const = 0;
|
||||
|
|
|
@ -69,6 +69,7 @@ DrmBackend::DrmBackend(QObject *parent)
|
|||
, m_dpmsFilter()
|
||||
{
|
||||
setSupportsGammaControl(true);
|
||||
setPerScreenRenderingEnabled(true);
|
||||
supportsOutputChanges();
|
||||
}
|
||||
|
||||
|
|
|
@ -111,11 +111,6 @@ bool EglMultiBackend::usesOverlayWindow() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool EglMultiBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void EglMultiBackend::screenGeometryChanged(const QSize &size)
|
||||
{
|
||||
Q_UNUSED(size)
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
QSharedPointer<GLTexture> textureForOutput(AbstractOutput *requestedOutput) const override;
|
||||
|
||||
bool usesOverlayWindow() const override;
|
||||
bool perScreenRendering() const override;
|
||||
|
||||
void screenGeometryChanged(const QSize &size) override;
|
||||
|
||||
|
|
|
@ -118,9 +118,4 @@ void DrmQPainterBackend::endFrame(int screenId, int mask, const QRegion &damage)
|
|||
m_backend->present(rendererOutput.buffer[rendererOutput.index], rendererOutput.output);
|
||||
}
|
||||
|
||||
bool DrmQPainterBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
bool needsFullRepaint(int screenId) const override;
|
||||
void beginFrame(int screenId) override;
|
||||
void endFrame(int screenId, int mask, const QRegion &damage) override;
|
||||
bool perScreenRendering() const override;
|
||||
|
||||
private:
|
||||
void initOutput(DrmOutput *output);
|
||||
|
|
|
@ -45,6 +45,7 @@ void FramebufferOutput::init(const QSize &pixelSize, const QSize &physicalSize)
|
|||
FramebufferBackend::FramebufferBackend(QObject *parent)
|
||||
: Platform(parent)
|
||||
{
|
||||
setPerScreenRenderingEnabled(true);
|
||||
}
|
||||
|
||||
FramebufferBackend::~FramebufferBackend()
|
||||
|
|
|
@ -80,9 +80,4 @@ void FramebufferQPainterBackend::endFrame(int screenId, int mask, const QRegion
|
|||
p.drawImage(QPoint(0, 0), m_backend->isBGR() ? m_renderBuffer.rgbSwapped() : m_renderBuffer);
|
||||
}
|
||||
|
||||
bool FramebufferQPainterBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ public:
|
|||
bool needsFullRepaint(int screenId) const override;
|
||||
void beginFrame(int screenId) override;
|
||||
void endFrame(int screenId, int mask, const QRegion &damage) override;
|
||||
bool perScreenRendering() const override;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -140,6 +140,7 @@ HwcomposerBackend::HwcomposerBackend(QObject *parent)
|
|||
SLOT(screenBrightnessChanged(int)))) {
|
||||
qCWarning(KWIN_HWCOMPOSER) << "Failed to connect to brightness control";
|
||||
}
|
||||
setPerScreenRenderingEnabled(false);
|
||||
}
|
||||
|
||||
HwcomposerBackend::~HwcomposerBackend()
|
||||
|
|
|
@ -60,9 +60,4 @@ void VirtualQPainterBackend::endFrame(int screenId, int mask, const QRegion &dam
|
|||
}
|
||||
}
|
||||
|
||||
bool VirtualQPainterBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ public:
|
|||
bool needsFullRepaint(int screenId) const override;
|
||||
void beginFrame(int screenId) override;
|
||||
void endFrame(int screenId, int mask, const QRegion &damage) override;
|
||||
bool perScreenRendering() const override;
|
||||
|
||||
private:
|
||||
void createOutputs();
|
||||
|
|
|
@ -38,6 +38,7 @@ VirtualBackend::VirtualBackend(QObject *parent)
|
|||
}
|
||||
setSupportsPointerWarping(true);
|
||||
setSupportsGammaControl(true);
|
||||
setPerScreenRenderingEnabled(true);
|
||||
}
|
||||
|
||||
VirtualBackend::~VirtualBackend()
|
||||
|
|
|
@ -418,11 +418,6 @@ bool EglWaylandBackend::usesOverlayWindow() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool EglWaylandBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/************************************************
|
||||
* EglTexture
|
||||
************************************************/
|
||||
|
|
|
@ -73,7 +73,6 @@ public:
|
|||
QRegion beginFrame(int screenId) override;
|
||||
void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) override;
|
||||
bool usesOverlayWindow() const override;
|
||||
bool perScreenRendering() const override;
|
||||
void init() override;
|
||||
|
||||
bool havePlatformBase() const {
|
||||
|
|
|
@ -156,11 +156,6 @@ WaylandQPainterBackend::~WaylandQPainterBackend()
|
|||
{
|
||||
}
|
||||
|
||||
bool WaylandQPainterBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void WaylandQPainterBackend::createOutput(AbstractOutput *waylandOutput)
|
||||
{
|
||||
auto *output = new WaylandQPainterOutput(static_cast<WaylandOutput *>(waylandOutput), this);
|
||||
|
|
|
@ -77,7 +77,6 @@ public:
|
|||
void beginFrame(int screenId) override;
|
||||
|
||||
bool needsFullRepaint(int screenId) const override;
|
||||
bool perScreenRendering() const override;
|
||||
|
||||
private:
|
||||
void createOutput(AbstractOutput *waylandOutput);
|
||||
|
|
|
@ -444,6 +444,7 @@ WaylandBackend::WaylandBackend(QObject *parent)
|
|||
, m_connectionThreadObject(new ConnectionThread(nullptr))
|
||||
, m_connectionThread(nullptr)
|
||||
{
|
||||
setPerScreenRenderingEnabled(true);
|
||||
supportsOutputChanges();
|
||||
connect(this, &WaylandBackend::connectionFailed, this, &WaylandBackend::initFailed);
|
||||
|
||||
|
|
|
@ -64,6 +64,7 @@ X11StandalonePlatform::X11StandalonePlatform(QObject *parent)
|
|||
#endif
|
||||
|
||||
setSupportsGammaControl(true);
|
||||
setPerScreenRenderingEnabled(false);
|
||||
}
|
||||
|
||||
X11StandalonePlatform::~X11StandalonePlatform()
|
||||
|
|
|
@ -65,11 +65,6 @@ bool EglX11Backend::usesOverlayWindow() const
|
|||
return false;
|
||||
}
|
||||
|
||||
bool EglX11Backend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
QRegion EglX11Backend::beginFrame(int screenId)
|
||||
{
|
||||
makeContextCurrent(m_surfaces.at(screenId));
|
||||
|
|
|
@ -24,7 +24,6 @@ public:
|
|||
explicit EglX11Backend(X11WindowedBackend *backend);
|
||||
~EglX11Backend() override;
|
||||
bool usesOverlayWindow() const override;
|
||||
bool perScreenRendering() const override;
|
||||
QRegion beginFrame(int screenId) override;
|
||||
void endFrame(int screenId, const QRegion &damage, const QRegion &damagedRegion) override;
|
||||
|
||||
|
|
|
@ -81,9 +81,4 @@ void X11WindowedQPainterBackend::endFrame(int screenId, int mask, const QRegion
|
|||
rendererOutput->needsFullRepaint = false;
|
||||
}
|
||||
|
||||
bool X11WindowedQPainterBackend::perScreenRendering() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
bool needsFullRepaint(int screenId) const override;
|
||||
void beginFrame(int screenId) override;
|
||||
void endFrame(int screenId, int mask, const QRegion &damage) override;
|
||||
bool perScreenRendering() const override;
|
||||
|
||||
private:
|
||||
void createOutputs();
|
||||
|
|
|
@ -44,6 +44,7 @@ X11WindowedBackend::X11WindowedBackend(QObject *parent)
|
|||
: Platform(parent)
|
||||
{
|
||||
setSupportsPointerWarping(true);
|
||||
setPerScreenRenderingEnabled(true);
|
||||
connect(this, &X11WindowedBackend::sizeChanged, this, &X11WindowedBackend::screenSizeChanged);
|
||||
}
|
||||
|
||||
|
|
|
@ -350,8 +350,6 @@ SceneOpenGL::SceneOpenGL(OpenGLBackend *backend, QObject *parent)
|
|||
qCDebug(KWIN_OPENGL) << "Explicit synchronization with the X command stream disabled by environment variable";
|
||||
}
|
||||
}
|
||||
|
||||
setPerScreenRenderingEnabled(m_backend->perScreenRendering());
|
||||
}
|
||||
|
||||
SceneOpenGL::~SceneOpenGL()
|
||||
|
|
|
@ -55,7 +55,6 @@ SceneQPainter::SceneQPainter(QPainterBackend *backend, QObject *parent)
|
|||
, m_backend(backend)
|
||||
, m_painter(new QPainter())
|
||||
{
|
||||
setPerScreenRenderingEnabled(m_backend->perScreenRendering());
|
||||
}
|
||||
|
||||
SceneQPainter::~SceneQPainter()
|
||||
|
@ -83,7 +82,7 @@ void SceneQPainter::paintGenericScreen(int mask, const ScreenPaintData &data)
|
|||
|
||||
void SceneQPainter::paint(int screenId, const QRegion &_damage, const QList<Toplevel *> &toplevels)
|
||||
{
|
||||
Q_ASSERT(m_backend->perScreenRendering());
|
||||
Q_ASSERT(kwinApp()->platform()->isPerScreenRenderingEnabled());
|
||||
painted_screen = screenId;
|
||||
|
||||
createStackingOrder(toplevels);
|
||||
|
|
17
scene.cpp
17
scene.cpp
|
@ -56,6 +56,7 @@
|
|||
*/
|
||||
|
||||
#include "scene.h"
|
||||
#include "platform.h"
|
||||
|
||||
#include <QQuickWindow>
|
||||
#include <QVector2D>
|
||||
|
@ -93,16 +94,6 @@ Scene::~Scene()
|
|||
Q_ASSERT(m_windows.isEmpty());
|
||||
}
|
||||
|
||||
bool Scene::isPerScreenRenderingEnabled() const
|
||||
{
|
||||
return m_isPerScreenRenderingEnabled;
|
||||
}
|
||||
|
||||
void Scene::setPerScreenRenderingEnabled(bool enabled)
|
||||
{
|
||||
m_isPerScreenRenderingEnabled = enabled;
|
||||
}
|
||||
|
||||
// returns mask and possibly modified region
|
||||
void Scene::paintScreen(int* mask, const QRegion &damage, const QRegion &repaint,
|
||||
QRegion *updateRegion, QRegion *validRegion, const QMatrix4x4 &projection, const QRect &outputGeometry, const qreal screenScale)
|
||||
|
@ -718,8 +709,7 @@ Scene::Window::Window(Toplevel *client, QObject *parent)
|
|||
, disable_painting(0)
|
||||
, cached_quad_list(nullptr)
|
||||
{
|
||||
const Scene *scene = Compositor::self()->scene();
|
||||
if (scene->isPerScreenRenderingEnabled()) {
|
||||
if (kwinApp()->platform()->isPerScreenRenderingEnabled()) {
|
||||
connect(screens(), &Screens::countChanged, this, &Window::reallocRepaints);
|
||||
}
|
||||
reallocRepaints();
|
||||
|
@ -1183,8 +1173,7 @@ void Scene::Window::resetRepaints(int screen)
|
|||
|
||||
void Scene::Window::reallocRepaints()
|
||||
{
|
||||
const Scene *scene = Compositor::self()->scene();
|
||||
if (scene->isPerScreenRenderingEnabled()) {
|
||||
if (kwinApp()->platform()->isPerScreenRenderingEnabled()) {
|
||||
m_repaints.resize(screens()->count());
|
||||
m_layerRepaints.resize(screens()->count());
|
||||
} else {
|
||||
|
|
3
scene.h
3
scene.h
|
@ -137,7 +137,6 @@ public:
|
|||
virtual bool blocksForRetrace() const;
|
||||
virtual bool syncsToVBlank() const;
|
||||
virtual OverlayWindow* overlayWindow() const = 0;
|
||||
bool isPerScreenRenderingEnabled() const;
|
||||
|
||||
virtual bool makeOpenGLContextCurrent();
|
||||
virtual void doneOpenGLContextCurrent();
|
||||
|
@ -204,7 +203,6 @@ public Q_SLOTS:
|
|||
void windowClosed(KWin::Toplevel* c, KWin::Deleted* deleted);
|
||||
protected:
|
||||
virtual Window *createWindow(Toplevel *toplevel) = 0;
|
||||
void setPerScreenRenderingEnabled(bool enabled);
|
||||
void createStackingOrder(const QList<Toplevel *> &toplevels);
|
||||
void clearStackingOrder();
|
||||
// shared implementation, starts painting the screen
|
||||
|
@ -275,7 +273,6 @@ private:
|
|||
QVector< Window* > stacking_order;
|
||||
// how many times finalPaintScreen() has been called
|
||||
int m_paintScreenCount = 0;
|
||||
bool m_isPerScreenRenderingEnabled = false;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue