On 2020-03-12 7:25 a.m., Simon Ser wrote:
On Thursday, March 12, 2020 11:45 AM, Michel Dänzer michel@daenzer.net wrote:
On 2020-03-11 9:09 p.m., Simon Ser wrote:
Hi all, I've been working on adding VRR support to Sway [1] (a Wayland compositor). The compositor just sets the VRR_ENABLED property. This works fine for some screens, but causes flcikering for other screens as expected [2]. Fixing the flickering is something we've talked about last XDC [3]. The flickering is caused by physical limitations of the screen: changing the refresh rate too quickly results in brightness issues. The approach taken by xf86-video-amdgpu is to only enable VRR if an app is fullscreen and not present in a special Mesa blacklist (e.g. Firefox is in the blacklist because it doesn't render at a fixed interval). For Wayland, I'd prefer to avoid having a blacklist. I'd like to be able to use VRR in the general case (not just for fullscreen apps). A way to fix the flickering would be to implement a slew rate and make it so refresh rate variations are capped by the slew rate.
One potential issue I see with this is the cursor, which can feel awkward if it only moves at 30 Hz. I wonder if a slew rate which can reliably prevent flickering allows the framerate to ramp up quickly enough for this not to be annoying.
Thanks for pointing this out, that's a valid concern.
My VRR monitor has a 40-60Hz VRR range. With the current Sway implementation and drm_monitor [1], I can check that moving my mouse on the monitor makes the refresh interval go from ~25ms to ~16.6ms (ie. 40Hz to 60Hz). Right now there's no slew rate, so it goes from min to max instantly. I don't notice any flickering and there's no lag.
Looking at the list of monitors [2] on Wikipedia, it doesn't seem like there's any monitor supporting less than 35Hz.
We'd need to perform experiments on more hardware, but flickering has been noticed by our users on higher-end monitors which support 144Hz. I think the slew rate would prevent going from 35Hz to 144Hz directly, but probably not from 40Hz to 60Hz. I think that would be acceptable.
If it's not, we can always tweak the minimum refresh rate.
tl;dr need to test on more hardware, but should probably be fine.
Not the main VRR expert and we're still discussing this internally but I think it'll very much depend on the display whether you'll see flicker in this case.
The other complication is that for gaming we don't want to use the cursor as a VRR trigger and only look at page flips in order to allow for smooth gameplay. For a desktop use-case that's probably not the right policy.
Harry