Bug 439515 - Refresh rate list is not sorted
Summary: Refresh rate list is not sorted
Status: RESOLVED FIXED
Alias: None
Product: systemsettings
Classification: Applications
Component: kcm_kscreen (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kscreen-bugs-null@kde.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-07-05 13:29 UTC by ratijas
Modified: 2021-07-08 01:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.23


Attachments
KDE Display Configuration - Refresh rate sorting (90.96 KB, image/png)
2021-07-05 13:29 UTC, ratijas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ratijas 2021-07-05 13:29:59 UTC
Created attachment 139869 [details]
KDE Display Configuration - Refresh rate sorting

SUMMARY

I got a setup where second monitor's available refresh rates are unsorted.

STEPS TO REPRODUCE
1. Connect second monitor "DELL S2421HN-G8PBZ13"
2. Open KScreen KCM in System Settings
3. Open "Refresh rate" drop-down

OBSERVED RESULT

Three available refresh rates, unsorted:

1. 60 Hz
2. 75 Hz
3. 50 Hz

Meanwhile my xrandr output shows this:

> Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 16384 x 16384
> DP-0 disconnected (normal left inverted right x axis y axis)
> DP-1 disconnected (normal left inverted right x axis y axis)
> DP-2 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 382mm x 215mm
>    1920x1080     75.00*+
> HDMI-0 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 527mm x 296mm
>    1920x1080     60.00 +  74.97*   59.94    50.00    60.05    60.00    50.04  
>    1600x900      60.00  
>    1280x1024     75.02    60.02  
>    1280x720      60.00    59.94    50.00  
>    1152x864      75.00  
>    1024x768      75.03    60.00  
>    800x600       75.00    60.32  
>    720x576       50.00  
>    720x480       59.94  
>    640x480       75.00    59.94    59.93  
> DP-3 disconnected (normal left inverted right x axis y axis)
> DP-4 disconnected (normal left inverted right x axis y axis)

EXPECTED RESULT

Sorted list, ordered by refresh rate's numerical value descending.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux
KDE Plasma Version: 5.22.2
KDE Frameworks Version: 5.83.0
Qt Version: 5.15.2
Kernel Version: 5.12.14-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 8 × Intel® Core™ i7-6700HQ CPU @ 2.60GHz
Memory: 15.6 GiB of RAM
Graphics Processor: NVIDIA GeForce GTX 970M/PCIe/SSE2

ADDITIONAL INFORMATION

I tool a brief look at kcm's source code, and I found that it's hard to understand it. Properties are just untyped "property var element: model", implicit scoping everywhere and so on.

But it seems the core problem lies in the `element.refreshRates` model,
provided by `kcm.outputModel`, which fetches data from C++ method
OutputModel::refreshRates. There is a lot of custom logic in that method,
including deduplication of almost-equal rates, but nothing handles sorting,
or at least it seems so.
Comment 1 Bug Janitor Service 2021-07-05 14:44:56 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/kscreen/-/merge_requests/31