backends/drm: don't set gamma with legacy unless really necessary

It seems to have a pretty large performance impact
This commit is contained in:
Xaver Hugl 2024-03-06 22:07:45 +01:00
parent 568f9fb666
commit d1bc39a6ea
2 changed files with 7 additions and 3 deletions

View file

@ -168,6 +168,7 @@ private:
bool m_modesetPresentPending = false;
bool m_didLegacyScanoutHack = false;
std::shared_ptr<DrmGammaRamp> m_currentLegacyGamma;
struct State
{

View file

@ -132,9 +132,12 @@ DrmPipeline::Error DrmPipeline::applyPendingChangesLegacy()
return err;
}
}
if (m_pending.gamma && drmModeCrtcSetGamma(gpu()->fd(), m_pending.crtc->id(), m_pending.gamma->lut().size(), m_pending.gamma->lut().red(), m_pending.gamma->lut().green(), m_pending.gamma->lut().blue()) != 0) {
qCWarning(KWIN_DRM) << "Setting gamma failed!" << strerror(errno);
return errnoToError();
if (m_pending.gamma && m_currentLegacyGamma != m_pending.gamma) {
if (drmModeCrtcSetGamma(gpu()->fd(), m_pending.crtc->id(), m_pending.gamma->lut().size(), m_pending.gamma->lut().red(), m_pending.gamma->lut().green(), m_pending.gamma->lut().blue()) != 0) {
qCWarning(KWIN_DRM) << "Setting gamma failed!" << strerror(errno);
return errnoToError();
}
m_currentLegacyGamma = m_pending.gamma;
}
if (m_connector->contentType.isValid()) {
m_connector->contentType.setEnumLegacy(m_pending.contentType);