[drm] Implement changing of modes
ClosedPublic

Authored by graesslin on Oct 21 2017, 1:20 PM.

Details

Summary

This change hooks up the bits for changing the mode when a request to
change mode from kscreen is received. This includes:

  • setting new mode in DrmOutput
  • creating new buffers in SceneQPainter backend
  • creating new GbmSurface in SceneOpenGL backend

Room for improvement:

  • detect whether the new mode works and go back to old one if it fails
Test Plan

Started both a QPainter/OpenGL session. Used kcmshell5 kscreen
to modify the resolution. Saw that it got applied, maximized a window to
verify it's correct. Changed back to original resolution. Verified it looked
good by maximizing a window.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Oct 21 2017, 1:20 PM
Restricted Application added a project: KWin. · View Herald TranscriptOct 21 2017, 1:20 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript

Nice!

You are using AMS on your testing machine I assume? The mode change should currently not work in legacy mode, because m_modesetRequested gets only used by AMS. Without AMS you need to call directly setModeLegacy with a black buffer. Or maybe just test on m_modesetRequested in presentLegacy on the next present. This said is there the possibility that the next present won't come soon (also relevant for AMS, where the mode gets changed with the next present)?

plugins/platforms/drm/drm_output.cpp
725

Also make sure modeIndex>=0.

romangg added inline comments.Oct 21 2017, 3:44 PM
plugins/platforms/drm/egl_gbm_backend.cpp
153

Rename this function resetOutput and put the destroy surface logic from the lambda function below in here? Would look cleaner I think.

In D8398#157766, @subdiff wrote:

Nice!

You are using AMS on your testing machine I assume?

Yes. I'm using defaults :-)

The mode change should currently not work in legacy mode, because m_modesetRequested gets only used by AMS. Without AMS you need to call directly setModeLegacy with a black buffer. Or maybe just test on m_modesetRequested in presentLegacy on the next present. This said is there the possibility that the next present won't come soon (also relevant for AMS, where the mode gets changed with the next present)?

Yeah, I already got from the code that my change won't work with legacy. And I'm tempted to just not implement it there. At least we could consider to not implement it and wait for a bug report. If we don't get one we could drop the complete legacy mode settings in ~1 year. That's the xorg style of deprecation: known breakage, waiting for someone notices.

graesslin updated this revision to Diff 21065.Oct 21 2017, 4:25 PM

Rename method to resetOutput and move the complete recreate logic there.

Hope I didn't break anything with it.

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptOct 21 2017, 4:25 PM
graesslin marked an inline comment as done.Oct 21 2017, 4:25 PM
romangg accepted this revision.Oct 21 2017, 8:11 PM

Looks good to me. I couldn't test it though, because KScreen KCM only showed me one mode to select from.

plugins/platforms/drm/drm_output.h
152

Nowhere (yet?) used.

This revision is now accepted and ready to land.Oct 21 2017, 8:11 PM

My notebook also only reports one more. I tested this on "real" hardware.

plugins/platforms/drm/drm_output.h
152

Yes, it is for the case that modesettings fails, so that we can go back.

This revision was automatically updated to reflect the committed changes.