Changeset View
Changeset View
Standalone View
Standalone View
plugins/platforms/drm/drm_output.cpp
Show First 20 Lines • Show All 326 Lines • ▼ Show 20 Line(s) | 323 | { | |||
---|---|---|---|---|---|
327 | hash.addData(m_edid.monitorName); | 327 | hash.addData(m_edid.monitorName); | ||
328 | hash.addData(m_edid.serialNumber); | 328 | hash.addData(m_edid.serialNumber); | ||
329 | m_uuid = hash.result().toHex().left(10); | 329 | m_uuid = hash.result().toHex().left(10); | ||
330 | } | 330 | } | ||
331 | 331 | | |||
332 | void DrmOutput::initDrmWaylandOutput() | 332 | void DrmOutput::initDrmWaylandOutput() | ||
333 | { | 333 | { | ||
334 | auto wlOutput = waylandOutput(); | 334 | auto wlOutput = waylandOutput(); | ||
335 | connect(this, &DrmOutput::modeChanged, this, | | |||
336 | [this] { | | |||
337 | auto wlOutput = waylandOutput(); | | |||
338 | if (wlOutput.isNull()) { | | |||
339 | return; | | |||
340 | } | | |||
341 | wlOutput->setCurrentMode(QSize(m_mode.hdisplay, m_mode.vdisplay), | | |||
342 | refreshRateForMode(&m_mode)); | | |||
343 | auto xdg = xdgOutput(); | | |||
344 | if (xdg) { | | |||
345 | xdg->setLogicalSize(pixelSize() / scale()); | | |||
346 | xdg->done(); | | |||
347 | } | | |||
348 | } | | |||
349 | ); | | |||
350 | | ||||
351 | // set dpms | 335 | // set dpms | ||
352 | if (!m_dpms.isNull()) { | 336 | if (!m_dpms.isNull()) { | ||
353 | wlOutput->setDpmsSupported(true); | 337 | wlOutput->setDpmsSupported(true); | ||
354 | wlOutput->setDpmsMode(toWaylandDpmsMode(m_dpmsMode)); | 338 | wlOutput->setDpmsMode(toWaylandDpmsMode(m_dpmsMode)); | ||
355 | connect(wlOutput.data(), &KWayland::Server::OutputInterface::dpmsModeRequested, this, | 339 | connect(wlOutput.data(), &KWayland::Server::OutputInterface::dpmsModeRequested, this, | ||
356 | [this] (KWayland::Server::OutputInterface::DpmsMode mode) { | 340 | [this] (KWayland::Server::OutputInterface::DpmsMode mode) { | ||
357 | setDpms(fromWaylandDpmsMode(mode)); | 341 | setDpms(fromWaylandDpmsMode(mode)); | ||
358 | }, Qt::QueuedConnection | 342 | }, Qt::QueuedConnection | ||
▲ Show 20 Lines • Show All 461 Lines • ▼ Show 20 Line(s) | 803 | if (wlOutput) { | |||
820 | wlOutput->setTransform(OutputInterface::Transform::Flipped270); | 804 | wlOutput->setTransform(OutputInterface::Transform::Flipped270); | ||
821 | } | 805 | } | ||
822 | break; | 806 | break; | ||
823 | } | 807 | } | ||
824 | m_modesetRequested = true; | 808 | m_modesetRequested = true; | ||
825 | // the cursor might need to get rotated | 809 | // the cursor might need to get rotated | ||
826 | updateCursor(); | 810 | updateCursor(); | ||
827 | showCursor(); | 811 | showCursor(); | ||
828 | emit modeChanged(); | 812 | | ||
813 | // TODO: are these calls not enough in updateMode already? | ||||
814 | setWaylandMode(); | ||||
829 | } | 815 | } | ||
830 | 816 | | |||
831 | void DrmOutput::updateMode(int modeIndex) | 817 | void DrmOutput::updateMode(int modeIndex) | ||
832 | { | 818 | { | ||
833 | // get all modes on the connector | 819 | // get all modes on the connector | ||
834 | ScopedDrmPointer<_drmModeConnector, &drmModeFreeConnector> connector(drmModeGetConnector(m_backend->fd(), m_conn->id())); | 820 | ScopedDrmPointer<_drmModeConnector, &drmModeFreeConnector> connector(drmModeGetConnector(m_backend->fd(), m_conn->id())); | ||
835 | if (connector->count_modes <= modeIndex) { | 821 | if (connector->count_modes <= modeIndex) { | ||
836 | // TODO: error? | 822 | // TODO: error? | ||
837 | return; | 823 | return; | ||
838 | } | 824 | } | ||
839 | if (isCurrentMode(&connector->modes[modeIndex])) { | 825 | if (isCurrentMode(&connector->modes[modeIndex])) { | ||
840 | // nothing to do | 826 | // nothing to do | ||
841 | return; | 827 | return; | ||
842 | } | 828 | } | ||
843 | m_mode = connector->modes[modeIndex]; | 829 | m_mode = connector->modes[modeIndex]; | ||
844 | m_modesetRequested = true; | 830 | m_modesetRequested = true; | ||
845 | emit modeChanged(); | 831 | setWaylandMode(); | ||
832 | } | ||||
833 | | ||||
834 | void DrmOutput::setWaylandMode() | ||||
835 | { | ||||
836 | AbstractOutput::setWaylandMode(QSize(m_mode.hdisplay, m_mode.vdisplay), | ||||
837 | refreshRateForMode(&m_mode)); | ||||
846 | } | 838 | } | ||
847 | 839 | | |||
848 | void DrmOutput::pageFlipped() | 840 | void DrmOutput::pageFlipped() | ||
849 | { | 841 | { | ||
850 | m_pageFlipPending = false; | 842 | m_pageFlipPending = false; | ||
851 | if (m_deleted) { | 843 | if (m_deleted) { | ||
852 | deleteLater(); | 844 | deleteLater(); | ||
853 | return; | 845 | return; | ||
▲ Show 20 Lines • Show All 102 Lines • ▼ Show 20 Line(s) | 944 | if (m_lastWorkingState.valid) { | |||
956 | if (m_primaryPlane) { | 948 | if (m_primaryPlane) { | ||
957 | m_primaryPlane->setTransformation(m_lastWorkingState.planeTransformations); | 949 | m_primaryPlane->setTransformation(m_lastWorkingState.planeTransformations); | ||
958 | } | 950 | } | ||
959 | m_modesetRequested = true; | 951 | m_modesetRequested = true; | ||
960 | // the cursor might need to get rotated | 952 | // the cursor might need to get rotated | ||
961 | updateCursor(); | 953 | updateCursor(); | ||
962 | showCursor(); | 954 | showCursor(); | ||
963 | // TODO: forward to OutputInterface and OutputDeviceInterface | 955 | // TODO: forward to OutputInterface and OutputDeviceInterface | ||
964 | emit modeChanged(); | 956 | setWaylandMode(); | ||
965 | emit screens()->changed(); | 957 | emit screens()->changed(); | ||
966 | } | 958 | } | ||
967 | return false; | 959 | return false; | ||
968 | } | 960 | } | ||
969 | const bool wasModeset = m_modesetRequested; | 961 | const bool wasModeset = m_modesetRequested; | ||
970 | if (!doAtomicCommit(AtomicCommitMode::Real)) { | 962 | if (!doAtomicCommit(AtomicCommitMode::Real)) { | ||
971 | qCDebug(KWIN_DRM) << "Atomic commit failed. This should have never happened! Aborting present."; | 963 | qCDebug(KWIN_DRM) << "Atomic commit failed. This should have never happened! Aborting present."; | ||
972 | //TODO: Probably should undo setNext and reset the flip list | 964 | //TODO: Probably should undo setNext and reset the flip list | ||
▲ Show 20 Lines • Show All 264 Lines • Show Last 20 Lines |