Commit 6295d1e6 authored by Roman Gilg's avatar Roman Gilg

Move output refresh rate getter into AbstractOutput

Summary:
The current refresh rate is stored in OutputInterface. Move the getter
therefore in the AbstractOutput class.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D16793
parent 0af57d63
......@@ -65,6 +65,14 @@ QSize AbstractOutput::physicalSize() const
return m_physicalSize;
}
int AbstractOutput::refreshRate() const
{
if (!m_waylandOutput) {
return 60000;
}
return m_waylandOutput->refreshRate();
}
void AbstractOutput::setGlobalPos(const QPoint &pos)
{
m_globalPos = pos;
......
......@@ -80,6 +80,11 @@ public:
return m_orientation;
}
/*
* Current refresh rate in 1/ms
*/
int refreshRate() const;
bool isInternal() const {
return m_internal;
}
......
......@@ -93,6 +93,15 @@ QSizeF OutputScreens::physicalSize(int screen) const
return enOuts.at(screen)->physicalSize();
}
float OutputScreens::refreshRate(int screen) const
{
const auto enOuts = m_platform->enabledOutputs();
if (screen >= enOuts.size()) {
return Screens::refreshRate(screen);
}
return enOuts.at(screen)->refreshRate() / 1000.0f;
}
Qt::ScreenOrientation OutputScreens::orientation(int screen) const
{
const auto enOuts = m_platform->enabledOutputs();
......
......@@ -42,7 +42,8 @@ public:
QRect geometry(int screen) const override;
QSize size(int screen) const override;
qreal scale(int screen) const override;
Qt::ScreenOrientation orientation(int screen) const;
float refreshRate(int screen) const override;
Qt::ScreenOrientation orientation(int screen) const override;
void updateCount() override;
int number(const QPoint &pos) const override;
......
......@@ -781,15 +781,6 @@ void DrmOutput::updateMode(int modeIndex)
setWaylandMode();
}
int DrmOutput::currentRefreshRate() const
{
auto wlOutput = waylandOutput();
if (!wlOutput) {
return 60000;
}
return wlOutput->refreshRate();
}
QSize DrmOutput::pixelSize() const
{
auto orient = orientation();
......
......@@ -67,7 +67,6 @@ public:
QSize pixelSize() const override;
int currentRefreshRate() const;
// These values are defined by the kernel
enum class DpmsMode {
On = DRM_MODE_DPMS_ON,
......
......@@ -34,15 +34,6 @@ DrmScreens::DrmScreens(DrmBackend *backend, QObject *parent)
DrmScreens::~DrmScreens() = default;
float DrmScreens::refreshRate(int screen) const
{
const auto enOuts = m_backend->drmEnabledOutputs();
if (screen >= enOuts.size()) {
return Screens::refreshRate(screen);
}
return enOuts.at(screen)->currentRefreshRate() / 1000.0f;
}
bool DrmScreens::supportsTransformations(int screen) const
{
const auto enOuts = m_backend->drmEnabledOutputs();
......
......@@ -32,7 +32,6 @@ public:
DrmScreens(DrmBackend *backend, QObject *parent = nullptr);
virtual ~DrmScreens();
float refreshRate(int screen) const override;
bool supportsTransformations(int screen) const override;
DrmBackend *m_backend;
......
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