Commit 01752895 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Move Scene::isPerScreenRenderingEnabled() to Platform

This way the Compositor can know if per screen rendering is enabled
before creating the Scene.
parent b94c8765
......@@ -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);
}
......
......@@ -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 &region)
{
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();
......
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