| Summary: | Refresh rate values in Display Configuration menu are always incorrect due to floating-point precision issues | ||
|---|---|---|---|
| Product: | [Applications] systemsettings | Reporter: | valdikss |
| Component: | kcm_kscreen | Assignee: | kscreen-bugs-null <kscreen-bugs-null> |
| Status: | CONFIRMED --- | ||
| Severity: | normal | CC: | adolfotregosa, boot.efi, nate, plasma-bugs-null |
| Priority: | NOR | ||
| Version First Reported In: | 5.22.4 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| See Also: | https://bugs.kde.org/show_bug.cgi?id=424997 | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: |
Video
kscreen-console json |
||
|
Description
valdikss
2021-01-02 11:51:18 UTC
Created attachment 134462 [details] Video Please watch the video. The video shows: 1. The display at 1920×1080@60, which I try to switch to 3840×2160@39.98 2. Display Configuration shows 60/50/30/25/24 Hz options for 3840×2160, switches to 30 Hz when 50 Hz is selected 3. After leaving configuration and entering it again, it shows correct 30/40 Hz for 3840×2160 4. Trying to switch from 3840×2160@30 to 1920×1080@60. Display Configuration shows 40/30 Hz for 1920×1080, switches to 30 Hz interlaced when none refresh rate is selected. 5. After leaving configuration and entering it again, it shows correct 60/50/30/25/24 Hz options for 1920×1080 Created attachment 134464 [details]
kscreen-console json
The output of kscreen-console json
It seems that Display Configuration applet is built on incorrect assumption that all resolution will have common refresh rates. It does not update refresh rates on resolution change, refreshRates() function accepts only output (screen) as a single argument. Unfortunately the issue is still present in the newest KDE 5.22.4. Thank you for the bug report. Unfortunately we were not able to get to it yet. Can we ask you to please see if you can reproduce the issue with Plasma 5.25 or 5.26? If you can, please change the status to CONFIRMED when replying. Thanks a lot! (In reply to Nate Graham from comment #5) > Thank you for the bug report. Unfortunately we were not able to get to it > yet. Can we ask you to please see if you can reproduce the issue with Plasma > 5.25 or 5.26? > > If you can, please change the status to CONFIRMED when replying. Thanks a > lot! This is still an issue as of KDE 5.25.4 on Fedora 35. Based on the attachment, it appears that the issue is that the refresh rates are stored as floats, like:
> "refreshRate": 120.10496520996094,
> "refreshRate": 120.00162506103516,
That's not gonna work. We are losing precision so anything that tries to compare one to another will get a result of false.
I'm in favor of changing config format. Let's store framerate as a string which is a fixed point number with two decimal digits. Exactly two should be enough to distinguish any valid modes, e.g. - 640x480 @ 59.94 vs 59.93; - 1920x1080 @ 59.94 vs 60.00; note: this isn't a problem for [1280x720 @ 50.00] vs [720x576 @ 50.00], because in this case resolution is different. If there are legit two modes with same resolution but with refresh rate only diverting at or after third decimal digit, then I'd assume it doesn't matter which to pick up. > Based on the attachment, it appears that the issue is that the refresh rates are stored as floats, like: >> "refreshRate": 120.10496520996094, >> "refreshRate": 120.00162506103516, > That's not gonna work. We are losing precision so anything that tries to compare one to another will get a result of false. As a workaround, I could implement a fuzzy lookup, such that a mode with the closest value to the one loaded from config will be picked up, iff absolute delta is less than 1Hz. +1 for storing as fixed point with two decimal places at the very minimum. *** Bug 502764 has been marked as a duplicate of this bug. *** (In reply to Nate Graham from comment #9) > +1 for storing as fixed point with two decimal places at the very minimum. It's basically what everyone else does. Round to two decimal places. |