Add dummy OutputLayer type

It's needed to make repaint scheduling in render layers simple.
This commit is contained in:
Vlad Zahorodnii 2022-02-05 19:00:25 +02:00
parent 203d7b3b8a
commit 65ccfd336f
5 changed files with 79 additions and 0 deletions

View file

@ -83,6 +83,7 @@ target_sources(kwin PRIVATE
options.cpp options.cpp
osd.cpp osd.cpp
outline.cpp outline.cpp
outputlayer.cpp
overlaywindow.cpp overlaywindow.cpp
placement.cpp placement.cpp
platform.cpp platform.cpp

View file

@ -8,6 +8,7 @@
*/ */
#include "abstract_output.h" #include "abstract_output.h"
#include "outputlayer.h"
#include <KSharedConfig> #include <KSharedConfig>
#include <KConfigGroup> #include <KConfigGroup>
@ -78,6 +79,7 @@ QDebug operator<<(QDebug debug, const AbstractOutput *output)
AbstractOutput::AbstractOutput(QObject *parent) AbstractOutput::AbstractOutput(QObject *parent)
: QObject(parent) : QObject(parent)
, m_layer(new OutputLayer(this))
{ {
} }
@ -85,6 +87,11 @@ AbstractOutput::~AbstractOutput()
{ {
} }
OutputLayer *AbstractOutput::layer() const
{
return m_layer;
}
QUuid AbstractOutput::uuid() const QUuid AbstractOutput::uuid() const
{ {
return QUuid(); return QUuid();

View file

@ -26,6 +26,7 @@ class OutputChangeSetV2;
namespace KWin namespace KWin
{ {
class EffectScreenImpl; class EffectScreenImpl;
class OutputLayer;
class RenderLoop; class RenderLoop;
class KWIN_EXPORT GammaRamp class KWIN_EXPORT GammaRamp
@ -93,6 +94,11 @@ public:
explicit AbstractOutput(QObject *parent = nullptr); explicit AbstractOutput(QObject *parent = nullptr);
~AbstractOutput() override; ~AbstractOutput() override;
/**
* Returns the primary layer. TODO: remove it
*/
OutputLayer *layer() const;
/** /**
* Returns a short identifiable name of this output. * Returns a short identifiable name of this output.
*/ */
@ -262,6 +268,7 @@ Q_SIGNALS:
private: private:
Q_DISABLE_COPY(AbstractOutput) Q_DISABLE_COPY(AbstractOutput)
EffectScreenImpl *m_effectScreen = nullptr; EffectScreenImpl *m_effectScreen = nullptr;
OutputLayer *m_layer;
int m_directScanoutCount = 0; int m_directScanoutCount = 0;
friend class EffectScreenImpl; // to access m_effectScreen friend class EffectScreenImpl; // to access m_effectScreen
}; };

32
src/outputlayer.cpp Normal file
View file

@ -0,0 +1,32 @@
/*
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "outputlayer.h"
namespace KWin
{
OutputLayer::OutputLayer(QObject *parent)
: QObject(parent)
{
}
QRegion OutputLayer::repaints() const
{
return m_repaints;
}
void OutputLayer::addRepaint(const QRegion &region)
{
m_repaints += region;
}
void OutputLayer::resetRepaints()
{
m_repaints = QRegion();
}
} // namespace KWin

32
src/outputlayer.h Normal file
View file

@ -0,0 +1,32 @@
/*
SPDX-FileCopyrightText: 2022 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "kwin_export.h"
#include <QObject>
#include <QRegion>
namespace KWin
{
class KWIN_EXPORT OutputLayer : public QObject
{
Q_OBJECT
public:
explicit OutputLayer(QObject *parent = nullptr);
QRegion repaints() const;
void resetRepaints();
void addRepaint(const QRegion &region);
private:
QRegion m_repaints;
};
} // namespace KWin