From 017528956b25640b964fe4c43ec27c166e21c96c Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Mon, 9 Nov 2020 14:19:15 +0200 Subject: [PATCH] Move Scene::isPerScreenRenderingEnabled() to Platform This way the Compositor can know if per screen rendering is enabled before creating the Scene. --- composite.cpp | 2 +- platform.cpp | 10 ++++++++++ platform.h | 7 +++++++ platformsupport/scenes/opengl/backend.cpp | 5 ----- platformsupport/scenes/opengl/backend.h | 5 ----- platformsupport/scenes/qpainter/backend.cpp | 5 ----- platformsupport/scenes/qpainter/backend.h | 5 ----- .../platforms/drm/abstract_egl_drm_backend.cpp | 5 ----- .../platforms/drm/abstract_egl_drm_backend.h | 1 - plugins/platforms/drm/drm_backend.cpp | 1 + plugins/platforms/drm/egl_multi_backend.cpp | 5 ----- plugins/platforms/drm/egl_multi_backend.h | 1 - .../drm/scene_qpainter_drm_backend.cpp | 5 ----- .../platforms/drm/scene_qpainter_drm_backend.h | 1 - plugins/platforms/fbdev/fb_backend.cpp | 1 + .../fbdev/scene_qpainter_fb_backend.cpp | 5 ----- .../platforms/fbdev/scene_qpainter_fb_backend.h | 1 - .../platforms/hwcomposer/hwcomposer_backend.cpp | 1 + .../virtual/scene_qpainter_virtual_backend.cpp | 5 ----- .../virtual/scene_qpainter_virtual_backend.h | 1 - plugins/platforms/virtual/virtual_backend.cpp | 1 + .../platforms/wayland/egl_wayland_backend.cpp | 5 ----- plugins/platforms/wayland/egl_wayland_backend.h | 1 - .../wayland/scene_qpainter_wayland_backend.cpp | 5 ----- .../wayland/scene_qpainter_wayland_backend.h | 1 - plugins/platforms/wayland/wayland_backend.cpp | 1 + .../platforms/x11/standalone/x11_platform.cpp | 1 + .../platforms/x11/windowed/egl_x11_backend.cpp | 5 ----- .../platforms/x11/windowed/egl_x11_backend.h | 1 - .../x11/windowed/scene_qpainter_x11_backend.cpp | 5 ----- .../x11/windowed/scene_qpainter_x11_backend.h | 1 - .../x11/windowed/x11windowed_backend.cpp | 1 + plugins/scenes/opengl/scene_opengl.cpp | 2 -- plugins/scenes/qpainter/scene_qpainter.cpp | 3 +-- scene.cpp | 17 +++-------------- scene.h | 3 --- 36 files changed, 29 insertions(+), 96 deletions(-) diff --git a/composite.cpp b/composite.cpp index ee5b6a29f4..1bf598545c 100644 --- a/composite.cpp +++ b/composite.cpp @@ -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); } diff --git a/platform.cpp b/platform.cpp index f5ca28b94c..293f6fa360 100644 --- a/platform.cpp +++ b/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) diff --git a/platform.h b/platform.h index 0947fb1943..8395e6663d 100644 --- a/platform.h +++ b/platform.h @@ -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; }; diff --git a/platformsupport/scenes/opengl/backend.cpp b/platformsupport/scenes/opengl/backend.cpp index 51fcae0adf..72bcb17b8b 100644 --- a/platformsupport/scenes/opengl/backend.cpp +++ b/platformsupport/scenes/opengl/backend.cpp @@ -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(); diff --git a/platformsupport/scenes/opengl/backend.h b/platformsupport/scenes/opengl/backend.h index 6e4ab45857..5bc1c33030 100644 --- a/platformsupport/scenes/opengl/backend.h +++ b/platformsupport/scenes/opengl/backend.h @@ -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; /** diff --git a/platformsupport/scenes/qpainter/backend.cpp b/platformsupport/scenes/qpainter/backend.cpp index 5592e05c92..c4347aacab 100644 --- a/platformsupport/scenes/qpainter/backend.cpp +++ b/platformsupport/scenes/qpainter/backend.cpp @@ -34,9 +34,4 @@ void QPainterBackend::setFailed(const QString &reason) m_failed = true; } -bool QPainterBackend::perScreenRendering() const -{ - return false; -} - } diff --git a/platformsupport/scenes/qpainter/backend.h b/platformsupport/scenes/qpainter/backend.h index 18b187fd6f..5cc551d156 100644 --- a/platformsupport/scenes/qpainter/backend.h +++ b/platformsupport/scenes/qpainter/backend.h @@ -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(); diff --git a/plugins/platforms/drm/abstract_egl_drm_backend.cpp b/plugins/platforms/drm/abstract_egl_drm_backend.cpp index 4fce0a1e0c..3b650cda86 100644 --- a/plugins/platforms/drm/abstract_egl_drm_backend.cpp +++ b/plugins/platforms/drm/abstract_egl_drm_backend.cpp @@ -39,8 +39,3 @@ bool AbstractEglDrmBackend::usesOverlayWindow() const { return false; } - -bool AbstractEglDrmBackend::perScreenRendering() const -{ - return true; -} diff --git a/plugins/platforms/drm/abstract_egl_drm_backend.h b/plugins/platforms/drm/abstract_egl_drm_backend.h index 448559e129..7a19837196 100644 --- a/plugins/platforms/drm/abstract_egl_drm_backend.h +++ b/plugins/platforms/drm/abstract_egl_drm_backend.h @@ -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; diff --git a/plugins/platforms/drm/drm_backend.cpp b/plugins/platforms/drm/drm_backend.cpp index 7210b6092a..7c00cdf801 100644 --- a/plugins/platforms/drm/drm_backend.cpp +++ b/plugins/platforms/drm/drm_backend.cpp @@ -69,6 +69,7 @@ DrmBackend::DrmBackend(QObject *parent) , m_dpmsFilter() { setSupportsGammaControl(true); + setPerScreenRenderingEnabled(true); supportsOutputChanges(); } diff --git a/plugins/platforms/drm/egl_multi_backend.cpp b/plugins/platforms/drm/egl_multi_backend.cpp index afcaee22c8..660c876891 100644 --- a/plugins/platforms/drm/egl_multi_backend.cpp +++ b/plugins/platforms/drm/egl_multi_backend.cpp @@ -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) diff --git a/plugins/platforms/drm/egl_multi_backend.h b/plugins/platforms/drm/egl_multi_backend.h index 737250dc8e..86ca9dde89 100644 --- a/plugins/platforms/drm/egl_multi_backend.h +++ b/plugins/platforms/drm/egl_multi_backend.h @@ -33,7 +33,6 @@ public: QSharedPointer textureForOutput(AbstractOutput *requestedOutput) const override; bool usesOverlayWindow() const override; - bool perScreenRendering() const override; void screenGeometryChanged(const QSize &size) override; diff --git a/plugins/platforms/drm/scene_qpainter_drm_backend.cpp b/plugins/platforms/drm/scene_qpainter_drm_backend.cpp index a52052df3d..d8bfbb0b65 100644 --- a/plugins/platforms/drm/scene_qpainter_drm_backend.cpp +++ b/plugins/platforms/drm/scene_qpainter_drm_backend.cpp @@ -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; -} - } diff --git a/plugins/platforms/drm/scene_qpainter_drm_backend.h b/plugins/platforms/drm/scene_qpainter_drm_backend.h index bf26d30f61..f2c5758e76 100644 --- a/plugins/platforms/drm/scene_qpainter_drm_backend.h +++ b/plugins/platforms/drm/scene_qpainter_drm_backend.h @@ -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); diff --git a/plugins/platforms/fbdev/fb_backend.cpp b/plugins/platforms/fbdev/fb_backend.cpp index 6240ebea4e..84f2c07158 100644 --- a/plugins/platforms/fbdev/fb_backend.cpp +++ b/plugins/platforms/fbdev/fb_backend.cpp @@ -45,6 +45,7 @@ void FramebufferOutput::init(const QSize &pixelSize, const QSize &physicalSize) FramebufferBackend::FramebufferBackend(QObject *parent) : Platform(parent) { + setPerScreenRenderingEnabled(true); } FramebufferBackend::~FramebufferBackend() diff --git a/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp b/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp index 68864aa35c..539f2ab33f 100644 --- a/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp +++ b/plugins/platforms/fbdev/scene_qpainter_fb_backend.cpp @@ -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; -} - } diff --git a/plugins/platforms/fbdev/scene_qpainter_fb_backend.h b/plugins/platforms/fbdev/scene_qpainter_fb_backend.h index fabbede078..79d119595f 100644 --- a/plugins/platforms/fbdev/scene_qpainter_fb_backend.h +++ b/plugins/platforms/fbdev/scene_qpainter_fb_backend.h @@ -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: /** diff --git a/plugins/platforms/hwcomposer/hwcomposer_backend.cpp b/plugins/platforms/hwcomposer/hwcomposer_backend.cpp index 44344b1ed9..296134e497 100644 --- a/plugins/platforms/hwcomposer/hwcomposer_backend.cpp +++ b/plugins/platforms/hwcomposer/hwcomposer_backend.cpp @@ -140,6 +140,7 @@ HwcomposerBackend::HwcomposerBackend(QObject *parent) SLOT(screenBrightnessChanged(int)))) { qCWarning(KWIN_HWCOMPOSER) << "Failed to connect to brightness control"; } + setPerScreenRenderingEnabled(false); } HwcomposerBackend::~HwcomposerBackend() diff --git a/plugins/platforms/virtual/scene_qpainter_virtual_backend.cpp b/plugins/platforms/virtual/scene_qpainter_virtual_backend.cpp index 6dead48705..da6d7e709b 100644 --- a/plugins/platforms/virtual/scene_qpainter_virtual_backend.cpp +++ b/plugins/platforms/virtual/scene_qpainter_virtual_backend.cpp @@ -60,9 +60,4 @@ void VirtualQPainterBackend::endFrame(int screenId, int mask, const QRegion &dam } } -bool VirtualQPainterBackend::perScreenRendering() const -{ - return true; -} - } diff --git a/plugins/platforms/virtual/scene_qpainter_virtual_backend.h b/plugins/platforms/virtual/scene_qpainter_virtual_backend.h index a81a5daab9..c0705ebc84 100644 --- a/plugins/platforms/virtual/scene_qpainter_virtual_backend.h +++ b/plugins/platforms/virtual/scene_qpainter_virtual_backend.h @@ -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(); diff --git a/plugins/platforms/virtual/virtual_backend.cpp b/plugins/platforms/virtual/virtual_backend.cpp index 3f0431df0a..7088829bd7 100644 --- a/plugins/platforms/virtual/virtual_backend.cpp +++ b/plugins/platforms/virtual/virtual_backend.cpp @@ -38,6 +38,7 @@ VirtualBackend::VirtualBackend(QObject *parent) } setSupportsPointerWarping(true); setSupportsGammaControl(true); + setPerScreenRenderingEnabled(true); } VirtualBackend::~VirtualBackend() diff --git a/plugins/platforms/wayland/egl_wayland_backend.cpp b/plugins/platforms/wayland/egl_wayland_backend.cpp index fdcd338665..e845297c30 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.cpp +++ b/plugins/platforms/wayland/egl_wayland_backend.cpp @@ -418,11 +418,6 @@ bool EglWaylandBackend::usesOverlayWindow() const return false; } -bool EglWaylandBackend::perScreenRendering() const -{ - return true; -} - /************************************************ * EglTexture ************************************************/ diff --git a/plugins/platforms/wayland/egl_wayland_backend.h b/plugins/platforms/wayland/egl_wayland_backend.h index 8a418aaba9..b14df8d7c0 100644 --- a/plugins/platforms/wayland/egl_wayland_backend.h +++ b/plugins/platforms/wayland/egl_wayland_backend.h @@ -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 { diff --git a/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp b/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp index 4f738b12ad..0bca5d7d96 100644 --- a/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp +++ b/plugins/platforms/wayland/scene_qpainter_wayland_backend.cpp @@ -156,11 +156,6 @@ WaylandQPainterBackend::~WaylandQPainterBackend() { } -bool WaylandQPainterBackend::perScreenRendering() const -{ - return true; -} - void WaylandQPainterBackend::createOutput(AbstractOutput *waylandOutput) { auto *output = new WaylandQPainterOutput(static_cast(waylandOutput), this); diff --git a/plugins/platforms/wayland/scene_qpainter_wayland_backend.h b/plugins/platforms/wayland/scene_qpainter_wayland_backend.h index e5bcc4531e..049dbd30a7 100644 --- a/plugins/platforms/wayland/scene_qpainter_wayland_backend.h +++ b/plugins/platforms/wayland/scene_qpainter_wayland_backend.h @@ -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); diff --git a/plugins/platforms/wayland/wayland_backend.cpp b/plugins/platforms/wayland/wayland_backend.cpp index 3561616b55..21641edb62 100644 --- a/plugins/platforms/wayland/wayland_backend.cpp +++ b/plugins/platforms/wayland/wayland_backend.cpp @@ -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); diff --git a/plugins/platforms/x11/standalone/x11_platform.cpp b/plugins/platforms/x11/standalone/x11_platform.cpp index fa47643e4f..4ede30198c 100644 --- a/plugins/platforms/x11/standalone/x11_platform.cpp +++ b/plugins/platforms/x11/standalone/x11_platform.cpp @@ -64,6 +64,7 @@ X11StandalonePlatform::X11StandalonePlatform(QObject *parent) #endif setSupportsGammaControl(true); + setPerScreenRenderingEnabled(false); } X11StandalonePlatform::~X11StandalonePlatform() diff --git a/plugins/platforms/x11/windowed/egl_x11_backend.cpp b/plugins/platforms/x11/windowed/egl_x11_backend.cpp index b17148a544..b3513be80d 100644 --- a/plugins/platforms/x11/windowed/egl_x11_backend.cpp +++ b/plugins/platforms/x11/windowed/egl_x11_backend.cpp @@ -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)); diff --git a/plugins/platforms/x11/windowed/egl_x11_backend.h b/plugins/platforms/x11/windowed/egl_x11_backend.h index bb354b74ee..ad75878a77 100644 --- a/plugins/platforms/x11/windowed/egl_x11_backend.h +++ b/plugins/platforms/x11/windowed/egl_x11_backend.h @@ -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; diff --git a/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.cpp b/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.cpp index a624dcf450..3a91e9d590 100644 --- a/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.cpp +++ b/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.cpp @@ -81,9 +81,4 @@ void X11WindowedQPainterBackend::endFrame(int screenId, int mask, const QRegion rendererOutput->needsFullRepaint = false; } -bool X11WindowedQPainterBackend::perScreenRendering() const -{ - return true; -} - } diff --git a/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.h b/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.h index 373f3faf4d..c4d8869241 100644 --- a/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.h +++ b/plugins/platforms/x11/windowed/scene_qpainter_x11_backend.h @@ -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(); diff --git a/plugins/platforms/x11/windowed/x11windowed_backend.cpp b/plugins/platforms/x11/windowed/x11windowed_backend.cpp index 50c9f899b6..a975135d30 100644 --- a/plugins/platforms/x11/windowed/x11windowed_backend.cpp +++ b/plugins/platforms/x11/windowed/x11windowed_backend.cpp @@ -44,6 +44,7 @@ X11WindowedBackend::X11WindowedBackend(QObject *parent) : Platform(parent) { setSupportsPointerWarping(true); + setPerScreenRenderingEnabled(true); connect(this, &X11WindowedBackend::sizeChanged, this, &X11WindowedBackend::screenSizeChanged); } diff --git a/plugins/scenes/opengl/scene_opengl.cpp b/plugins/scenes/opengl/scene_opengl.cpp index 7e645ed795..f90f00375d 100644 --- a/plugins/scenes/opengl/scene_opengl.cpp +++ b/plugins/scenes/opengl/scene_opengl.cpp @@ -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() diff --git a/plugins/scenes/qpainter/scene_qpainter.cpp b/plugins/scenes/qpainter/scene_qpainter.cpp index 68e8aa31de..7a9b525254 100644 --- a/plugins/scenes/qpainter/scene_qpainter.cpp +++ b/plugins/scenes/qpainter/scene_qpainter.cpp @@ -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 &toplevels) { - Q_ASSERT(m_backend->perScreenRendering()); + Q_ASSERT(kwinApp()->platform()->isPerScreenRenderingEnabled()); painted_screen = screenId; createStackingOrder(toplevels); diff --git a/scene.cpp b/scene.cpp index 3c7c02f22d..7faaeffdb0 100644 --- a/scene.cpp +++ b/scene.cpp @@ -56,6 +56,7 @@ */ #include "scene.h" +#include "platform.h" #include #include @@ -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 { diff --git a/scene.h b/scene.h index 00f3a32264..1b8ea7c432 100644 --- a/scene.h +++ b/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 &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; }; /**