Commit e2b1bcea authored by Roman Gilg's avatar Roman Gilg

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
parent 254a8073
......@@ -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) {
......
......@@ -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;
......
......@@ -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;
......
......@@ -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();
......
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