backends/drm: fix legacy dpms

This commit is contained in:
Xaver Hugl 2022-02-15 03:22:55 +01:00 committed by Vlad Zahorodnii
parent 76dbe9e590
commit 4d0998cfed
2 changed files with 7 additions and 3 deletions

View file

@ -97,7 +97,6 @@ bool DrmPipeline::applyPendingChangesLegacy()
if (needsModeset() &&!legacyModeset()) {
return false;
}
m_connector->getProp(DrmConnector::PropertyIndex::Dpms)->setCurrent(DRM_MODE_DPMS_ON);
if (pending.gamma && drmModeCrtcSetGamma(gpu()->fd(), pending.crtc->id(), pending.gamma->size(),
pending.gamma->red(), pending.gamma->green(), pending.gamma->blue()) != 0) {
qCWarning(KWIN_DRM) << "Setting gamma failed!" << strerror(errno);
@ -106,7 +105,7 @@ bool DrmPipeline::applyPendingChangesLegacy()
setCursorLegacy();
moveCursorLegacy();
}
if (pending.crtc && !m_connector->getProp(DrmConnector::PropertyIndex::Dpms)->setPropertyLegacy(pending.active ? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF)) {
if (!m_connector->getProp(DrmConnector::PropertyIndex::Dpms)->setPropertyLegacy(activePending() ? DRM_MODE_DPMS_ON : DRM_MODE_DPMS_OFF)) {
qCWarning(KWIN_DRM) << "Setting legacy dpms failed!" << strerror(errno);
return false;
}

View file

@ -65,7 +65,12 @@ void DrmProperty::rollbackPending()
bool DrmProperty::setPropertyLegacy(uint64_t value)
{
return drmModeObjectSetProperty(m_obj->gpu()->fd(), m_obj->id(), m_obj->type(), m_propId, value) == 0;
if (drmModeObjectSetProperty(m_obj->gpu()->fd(), m_obj->id(), m_obj->type(), m_propId, value) == 0) {
m_current = m_next = m_pending = value;
return true;
} else {
return false;
}
}
void DrmProperty::initEnumMap(drmModePropertyRes *prop)