aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Gilg <[email protected]>2018-11-09 20:08:21 +0100
committerRoman Gilg <[email protected]>2018-11-14 19:56:07 +0100
commite2b1bcea1b1b4003a6e0262bc3758dbd893030f5 (patch)
tree15dd3d019857d40fd9af8293247589c5e0c6f1a3
parent254a8073746e7c3af12a9a87fb179a3fbaef361b (diff)
Set mode in AbstractOutput
Summary: Set the mode in AbstractOutput and call into the plugin for final change on hardware. Reviewers: #kwin, davidedmundson Reviewed By: #kwin, davidedmundson Subscribers: davidedmundson, kwin Tags: #kwin Maniphest Tasks: T10016 Differential Revision: https://phabricator.kde.org/D16786
-rw-r--r--abstract_output.cpp13
-rw-r--r--abstract_output.h4
-rw-r--r--plugins/platforms/drm/drm_output.cpp30
-rw-r--r--plugins/platforms/drm/drm_output.h2
4 files changed, 29 insertions, 20 deletions
diff --git a/abstract_output.cpp b/abstract_output.cpp
index c514d73..fbb9da2 100644
--- a/abstract_output.cpp
+++ b/abstract_output.cpp
@@ -100,6 +100,7 @@ void AbstractOutput::setScale(qreal scale)
m_xdgOutput->setLogicalSize(pixelSize() / m_scale);
m_xdgOutput->done();
}
+ emit modeChanged();
}
void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes)
@@ -132,6 +133,18 @@ void AbstractOutput::setChanges(KWayland::Server::OutputChangeSet *changes)
}
}
+void AbstractOutput::setWaylandMode(const QSize &size, int refreshRate)
+{
+ if (m_waylandOutput.isNull()) {
+ return;
+ }
+ m_waylandOutput->setCurrentMode(size, refreshRate);
+ if (m_xdgOutput) {
+ m_xdgOutput->setLogicalSize(pixelSize() / scale());
+ m_xdgOutput->done();
+ }
+}
+
void AbstractOutput::createXdgOutput()
{
if (!m_waylandOutput || m_xdgOutput) {
diff --git a/abstract_output.h b/abstract_output.h
index 49a1812..2494576 100644
--- a/abstract_output.h
+++ b/abstract_output.h
@@ -103,6 +103,9 @@ public:
return false;
}
+Q_SIGNALS:
+ void modeChanged();
+
protected:
void initWaylandOutput();
@@ -142,6 +145,7 @@ protected:
virtual void transform(KWayland::Server::OutputDeviceInterface::Transform transform) {
Q_UNUSED(transform);
}
+ void setWaylandMode(const QSize &size, int refreshRate);
private:
QPointer<KWayland::Server::OutputInterface> m_waylandOutput;
diff --git a/plugins/platforms/drm/drm_output.cpp b/plugins/platforms/drm/drm_output.cpp
index 115a520..2f55c00 100644
--- a/plugins/platforms/drm/drm_output.cpp
+++ b/plugins/platforms/drm/drm_output.cpp
@@ -332,22 +332,6 @@ void DrmOutput::initUuid()
void DrmOutput::initDrmWaylandOutput()
{
auto wlOutput = waylandOutput();
- connect(this, &DrmOutput::modeChanged, this,
- [this] {
- auto wlOutput = waylandOutput();
- if (wlOutput.isNull()) {
- return;
- }
- wlOutput->setCurrentMode(QSize(m_mode.hdisplay, m_mode.vdisplay),
- refreshRateForMode(&m_mode));
- auto xdg = xdgOutput();
- if (xdg) {
- xdg->setLogicalSize(pixelSize() / scale());
- xdg->done();
- }
- }
- );
-
// set dpms
if (!m_dpms.isNull()) {
wlOutput->setDpmsSupported(true);
@@ -825,7 +809,9 @@ void DrmOutput::transform(KWayland::Server::OutputDeviceInterface::Transform tra
// the cursor might need to get rotated
updateCursor();
showCursor();
- emit modeChanged();
+
+ // TODO: are these calls not enough in updateMode already?
+ setWaylandMode();
}
void DrmOutput::updateMode(int modeIndex)
@@ -842,7 +828,13 @@ void DrmOutput::updateMode(int modeIndex)
}
m_mode = connector->modes[modeIndex];
m_modesetRequested = true;
- emit modeChanged();
+ setWaylandMode();
+}
+
+void DrmOutput::setWaylandMode()
+{
+ AbstractOutput::setWaylandMode(QSize(m_mode.hdisplay, m_mode.vdisplay),
+ refreshRateForMode(&m_mode));
}
void DrmOutput::pageFlipped()
@@ -961,7 +953,7 @@ bool DrmOutput::presentAtomically(DrmBuffer *buffer)
updateCursor();
showCursor();
// TODO: forward to OutputInterface and OutputDeviceInterface
- emit modeChanged();
+ setWaylandMode();
emit screens()->changed();
}
return false;
diff --git a/plugins/platforms/drm/drm_output.h b/plugins/platforms/drm/drm_output.h
index 873b084..a8fda77 100644
--- a/plugins/platforms/drm/drm_output.h
+++ b/plugins/platforms/drm/drm_output.h
@@ -99,7 +99,6 @@ public:
Q_SIGNALS:
void dpmsChanged();
- void modeChanged();
private:
friend class DrmBackend;
@@ -132,6 +131,7 @@ private:
bool dpmsAtomicOff();
bool atomicReqModesetPopulate(drmModeAtomicReq *req, bool enable);
void updateMode(int modeIndex) override;
+ void setWaylandMode();
void transform(KWayland::Server::OutputDeviceInterface::Transform transform) override;
void automaticRotation();