Add scaling to DRM backend

Authored by davidedmundson on Nov 25 2016, 10:21 AM.


Test Plan

For the first time, actually plugged in my high DPI laptop.
Tested both 1x and 2x windows on 2 real displays one high DPI, one normal

Diff Detail

R108 KWin
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.
davidedmundson retitled this revision from to Add scaling to DRM backend.
davidedmundson updated this object.
davidedmundson edited the test plan for this revision. (Show Details)
davidedmundson added a reviewer: Plasma.
Restricted Application added a project: KWin. · View Herald TranscriptNov 25 2016, 10:21 AM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
graesslin accepted this revision.Nov 25 2016, 2:19 PM
graesslin added a reviewer: graesslin.
This revision is now accepted and ready to land.Nov 25 2016, 2:19 PM

Set m_output as well as m_outputDevice

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptMar 25 2017, 12:22 PM
Restricted Application added a subscriber: KWin. · View Herald Transcript
romangg requested changes to this revision.Mar 25 2017, 4:55 PM
romangg added a subscriber: romangg.
romangg added inline comments.

Divding above through scale and then multiplying again here and in blank() could lead to rounding errors.

This revision now requires changes to proceed.Mar 25 2017, 4:55 PM
davidedmundson edited edge metadata.

Rename Output::size to Output::pixelSize

This mirrors KWayland::Client::Output and is useful
to separate the two co-ordinate spaces.

We have this for buffers, and we use geometry when
we want it all normalised.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptMar 25 2017, 11:08 PM

Regarding all your Diffs about Scaling, that you haven't yet merged: Can you edit the Related Revisions in Phab, so it's easier to review them? For example for this diff here D3159 is needed.

romangg added inline comments.Mar 31 2017, 1:48 AM

Instead of dividing on every call, declare new private variable QSize m_scaledSize = pixelSize() / scale(), and update its value only when m_mode or the scale value is changed.


What benefit will that have?

romangg added inline comments.Mar 31 2017, 12:19 PM

geometry() is called several times per frame. We can optimize here when we don't do the division every time (maybe the compiler already does the saving, I don't know).

Also this way we can make sure, that the subsequent rounding is not fluctuating from one frame to another.


It's good design to not have member variables that can ever be in a corrupt state, it reduces chance for bugs being introduced later, which is why I'm against changing it.

Dividing two integers is not going to make any performance difference whatsoever and an int divided by an int will result in the same every single time.

romangg added inline comments.Mar 31 2017, 12:43 PM

Ok, fine with me. Can you now expand the testing parameter from the other Diff, so it's possible to use it in DRM mode? I tried to set a hard coded value in DrmOutput::setScale in order to test different scale factors, but the results were garbage, so I think (hope) that this hard coding doesn't set the scale factors elsewhere correctly and the testing parameter is necessary.

This revision was automatically updated to reflect the committed changes.