Commit d5203c79 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii

Report partial updates on all outputs

Previously, we couldn't do it because repaints weren't tracked per each
output.
parent d9528a5d
......@@ -111,8 +111,9 @@ QSharedPointer<KWin::GLTexture> OpenGLBackend::textureForOutput(AbstractOutput*
return {};
}
void OpenGLBackend::aboutToStartPainting(const QRegion &damage)
void OpenGLBackend::aboutToStartPainting(int screenId, const QRegion &damage)
{
Q_UNUSED(screenId)
Q_UNUSED(damage)
}
......
......@@ -70,7 +70,7 @@ public:
*
* @p damage contains the reported damage as suggested by windows and effects on prepaint calls.
*/
virtual void aboutToStartPainting(const QRegion &damage);
virtual void aboutToStartPainting(int screenId, const QRegion &damage);
/**
* @brief Backend specific code to handle the end of rendering a frame.
......
......@@ -465,14 +465,10 @@ static QVector<EGLint> regionToRects(const QRegion &region, AbstractWaylandOutpu
return rects;
}
void EglGbmBackend::aboutToStartPainting(const QRegion &damagedRegion)
void EglGbmBackend::aboutToStartPainting(int screenId, const QRegion &damagedRegion)
{
// See EglGbmBackend::endRenderingFrameForScreen comment for the reason why we only support screenId=0
if (m_outputs.count() > 1) {
return;
}
const Output &output = m_outputs.at(0);
Q_ASSERT_X(screenId != -1, "aboutToStartPainting", "not using per screen rendering");
const Output &output = m_outputs.at(screenId);
if (output.bufferAge > 0 && !damagedRegion.isEmpty() && supportsPartialUpdate()) {
const QRegion region = damagedRegion & output.output->geometry();
......
......@@ -48,7 +48,7 @@ public:
protected:
void present() override;
void cleanupSurfaces() override;
void aboutToStartPainting(const QRegion &damage) override;
void aboutToStartPainting(int screenId, const QRegion &damage) override;
private:
bool initializeEgl();
......
......@@ -306,9 +306,10 @@ static QVector<EGLint> regionToRects(const QRegion &region, AbstractWaylandOutpu
return rects;
}
void EglWaylandBackend::aboutToStartPainting(const QRegion &damagedRegion)
void EglWaylandBackend::aboutToStartPainting(int screenId, const QRegion &damagedRegion)
{
EglWaylandOutput* output = m_outputs.at(0);
Q_ASSERT_X(screenId != -1, "aboutToStartPainting", "not using per screen rendering");
EglWaylandOutput *output = m_outputs.at(screenId);
if (output->m_bufferAge > 0 && !damagedRegion.isEmpty() && supportsPartialUpdate()) {
const QRegion region = damagedRegion & output->m_waylandOutput->geometry();
......
......@@ -82,7 +82,7 @@ public:
return m_havePlatformBase;
}
void aboutToStartPainting(const QRegion &damage) override;
void aboutToStartPainting(int screenId, const QRegion &damage) override;
private:
bool initializeEgl();
......
......@@ -615,9 +615,9 @@ void SceneOpenGL2::paintCursor(const QRegion &rendered)
glDisable(GL_BLEND);
}
void SceneOpenGL::aboutToStartPainting(const QRegion &damage)
void SceneOpenGL::aboutToStartPainting(int screenId, const QRegion &damage)
{
m_backend->aboutToStartPainting(damage);
m_backend->aboutToStartPainting(screenId, damage);
}
qint64 SceneOpenGL::paint(const QRegion &damage, const QList<Toplevel *> &toplevels)
......
......@@ -78,7 +78,7 @@ public:
protected:
SceneOpenGL(OpenGLBackend *backend, QObject *parent = nullptr);
void paintBackground(const QRegion &region) override;
void aboutToStartPainting(const QRegion &damage) override;
void aboutToStartPainting(int screenId, const QRegion &damage) override;
void extendPaintRegion(QRegion &region, bool opaqueFullscreen) override;
QMatrix4x4 transformation(int mask, const ScreenPaintData &data) const;
void paintDesktop(int desktop, int mask, const QRegion &region, ScreenPaintData &data) override;
......
......@@ -236,7 +236,7 @@ void Scene::paintGenericScreen(int orig_mask, const ScreenPaintData &)
damaged_region = QRegion(QRect {{}, screens()->size()});
if (m_paintScreenCount == 1) {
aboutToStartPainting(damaged_region);
aboutToStartPainting(painted_screen, damaged_region);
if (orig_mask & PAINT_SCREEN_BACKGROUND_FIRST) {
paintBackground(infiniteRegion());
......@@ -377,7 +377,7 @@ void Scene::paintSimpleScreen(int orig_mask, const QRegion &region)
QRegion paintedArea;
// Fill any areas of the root window not covered by opaque windows
if (m_paintScreenCount == 1) {
aboutToStartPainting(dirtyArea);
aboutToStartPainting(painted_screen, dirtyArea);
if (orig_mask & PAINT_SCREEN_BACKGROUND_FIRST) {
paintBackground(infiniteRegion());
......@@ -636,8 +636,9 @@ void Scene::paintDesktop(int desktop, int mask, const QRegion &region, ScreenPai
static_cast<EffectsHandlerImpl*>(effects)->paintDesktop(desktop, mask, region, data);
}
void Scene::aboutToStartPainting(const QRegion &damage)
void Scene::aboutToStartPainting(int screenId, const QRegion &damage)
{
Q_UNUSED(screenId)
Q_UNUSED(damage)
}
......
......@@ -227,7 +227,7 @@ protected:
*
* @p damage contains the reported damage as suggested by windows and effects on prepaint calls.
*/
virtual void aboutToStartPainting(const QRegion &damage);
virtual void aboutToStartPainting(int screenId, const QRegion &damage);
// called after all effects had their paintWindow() called
void finalPaintWindow(EffectWindowImpl* w, int mask, const QRegion &region, WindowPaintData& data);
// shared implementation, starts painting the window
......
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