From 8739258f2f3f19523cfade8a89659d0e72934f15 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 17 Feb 2022 16:53:12 +0200 Subject: [PATCH] Drop Platform::isPerScreenRenderingEnabled() At this point, it's safe to assume that only X11 has weird rendering model, which stands in the way of making rendering abstractions nice and intuitive, so let's check operation mode. If OperationModeX11 is dropped, this will also simplify finding X11-specific code in kwin. --- src/backends/drm/drm_backend.cpp | 1 - src/backends/fbdev/fb_backend.cpp | 1 - src/backends/virtual/virtual_backend.cpp | 1 - src/backends/wayland/wayland_backend.cpp | 1 - src/backends/x11/standalone/x11_platform.cpp | 1 - src/backends/x11/windowed/x11windowed_backend.cpp | 1 - src/item.cpp | 4 ++-- src/platform.cpp | 10 ---------- src/platform.h | 7 ------- 9 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/backends/drm/drm_backend.cpp b/src/backends/drm/drm_backend.cpp index fbe4bf6571..4105d73b09 100644 --- a/src/backends/drm/drm_backend.cpp +++ b/src/backends/drm/drm_backend.cpp @@ -62,7 +62,6 @@ DrmBackend::DrmBackend(QObject *parent) { setSupportsPointerWarping(true); setSupportsGammaControl(true); - setPerScreenRenderingEnabled(true); supportsOutputChanges(); } diff --git a/src/backends/fbdev/fb_backend.cpp b/src/backends/fbdev/fb_backend.cpp index e0459e0337..3485a50876 100644 --- a/src/backends/fbdev/fb_backend.cpp +++ b/src/backends/fbdev/fb_backend.cpp @@ -79,7 +79,6 @@ FramebufferBackend::FramebufferBackend(QObject *parent) : Platform(parent) , m_session(Session::create(this)) { - setPerScreenRenderingEnabled(true); setSupportsPointerWarping(true); } diff --git a/src/backends/virtual/virtual_backend.cpp b/src/backends/virtual/virtual_backend.cpp index f3a19b2bde..d6110247f5 100644 --- a/src/backends/virtual/virtual_backend.cpp +++ b/src/backends/virtual/virtual_backend.cpp @@ -164,7 +164,6 @@ VirtualBackend::VirtualBackend(QObject *parent) supportsOutputChanges(); setSupportsPointerWarping(true); setSupportsGammaControl(true); - setPerScreenRenderingEnabled(true); } VirtualBackend::~VirtualBackend() diff --git a/src/backends/wayland/wayland_backend.cpp b/src/backends/wayland/wayland_backend.cpp index 96b479060c..d0ddc05250 100644 --- a/src/backends/wayland/wayland_backend.cpp +++ b/src/backends/wayland/wayland_backend.cpp @@ -579,7 +579,6 @@ WaylandBackend::WaylandBackend(QObject *parent) , m_connectionThreadObject(new ConnectionThread(nullptr)) , m_connectionThread(nullptr) { - setPerScreenRenderingEnabled(true); supportsOutputChanges(); connect(this, &WaylandBackend::connectionFailed, qApp, &QCoreApplication::quit); diff --git a/src/backends/x11/standalone/x11_platform.cpp b/src/backends/x11/standalone/x11_platform.cpp index 3d5cc48846..a4dc495522 100644 --- a/src/backends/x11/standalone/x11_platform.cpp +++ b/src/backends/x11/standalone/x11_platform.cpp @@ -112,7 +112,6 @@ X11StandalonePlatform::X11StandalonePlatform(QObject *parent) connect(m_updateOutputsTimer, &QTimer::timeout, this, &X11StandalonePlatform::updateOutputs); setSupportsGammaControl(true); - setPerScreenRenderingEnabled(false); } X11StandalonePlatform::~X11StandalonePlatform() diff --git a/src/backends/x11/windowed/x11windowed_backend.cpp b/src/backends/x11/windowed/x11windowed_backend.cpp index 444fb7cda3..e49fccc65b 100644 --- a/src/backends/x11/windowed/x11windowed_backend.cpp +++ b/src/backends/x11/windowed/x11windowed_backend.cpp @@ -164,7 +164,6 @@ X11WindowedBackend::X11WindowedBackend(QObject *parent) , m_session(Session::create(Session::Type::Noop, this)) { setSupportsPointerWarping(true); - setPerScreenRenderingEnabled(true); } X11WindowedBackend::~X11WindowedBackend() diff --git a/src/item.cpp b/src/item.cpp index 74ba5b8d30..3aeb2ffaf3 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -257,7 +257,7 @@ void Item::scheduleRepaintInternal(const QRegion ®ion) { const QVector outputs = kwinApp()->platform()->enabledOutputs(); const QRegion globalRegion = mapToGlobal(region); - if (kwinApp()->platform()->isPerScreenRenderingEnabled()) { + if (kwinApp()->operationMode() != Application::OperationModeX11) { for (const auto &output : outputs) { const QRegion dirtyRegion = globalRegion & output->geometry(); if (!dirtyRegion.isEmpty()) { @@ -277,7 +277,7 @@ void Item::scheduleFrame() return; } const QVector outputs = kwinApp()->platform()->enabledOutputs(); - if (kwinApp()->platform()->isPerScreenRenderingEnabled()) { + if (kwinApp()->operationMode() != Application::OperationModeX11) { const QRect geometry = mapToGlobal(rect()); for (const AbstractOutput *output : outputs) { if (output->geometry().intersects(geometry)) { diff --git a/src/platform.cpp b/src/platform.cpp index f4c9a52390..92a0470b67 100644 --- a/src/platform.cpp +++ b/src/platform.cpp @@ -409,16 +409,6 @@ void Platform::setReady(bool ready) Q_EMIT readyChanged(m_ready); } -bool Platform::isPerScreenRenderingEnabled() const -{ - return m_isPerScreenRenderingEnabled; -} - -void Platform::setPerScreenRenderingEnabled(bool enabled) -{ - m_isPerScreenRenderingEnabled = enabled; -} - AbstractOutput *Platform::createVirtualOutput(const QString &name, const QSize &size, double scale) { Q_UNUSED(name); diff --git a/src/platform.h b/src/platform.h index a1b32ab93a..3fcc1ed65e 100644 --- a/src/platform.h +++ b/src/platform.h @@ -338,11 +338,6 @@ public: m_selectedCompositor = type; } - /** - * Returns @c true if rendering is split per screen; otherwise returns @c false. - */ - bool isPerScreenRenderingEnabled() const; - virtual AbstractOutput *createVirtualOutput(const QString &name, const QSize &size, qreal scaling); virtual void removeVirtualOutput(AbstractOutput *output); @@ -425,7 +420,6 @@ protected: explicit Platform(QObject *parent = nullptr); void repaint(const QRect &rect); void setReady(bool ready); - void setPerScreenRenderingEnabled(bool enabled); QSize initialWindowSize() const { return m_initialWindowSize; } @@ -457,7 +451,6 @@ private: EGLContext m_globalShareContext = EGL_NO_CONTEXT; bool m_supportsGammaControl = false; bool m_supportsOutputChanges = false; - bool m_isPerScreenRenderingEnabled = false; CompositingType m_selectedCompositor = NoCompositing; AbstractOutput *m_primaryOutput = nullptr; };