Can't reproduce rate value in monitors.xml
Affected version
- Ubuntu 18.04.4 with kernel 5.3.0-61-generic
- Mutter 3.28.4
- X.Org X Server 1.20.8
Bug summary
The refresh_rate value in monitors.xml does not reflect the calculated refresh rate from dtd.
Generating
Steps to reproduce
- Connect a monitor with this dtd block in EDID (samsung_40.bin)
pixelClock: 85.5MHz
horActivePixels: 1366
horBlankPixels: 426
vertActivePixels: 768
vertBlankPixels: 30
- Select and apply the resolution 1366x768
What happened
Observe in ~/.config/monitors.xml
:
<mode>
<width>1366</width>
<height>768</height>
<rate>59.789539337158203</rate>
</mode
What did you expect to happen
When calculating the refresh rate from DTD informations :
refresh_rate = pixelClock / ((horActivePixels + horBlankPixels) * (vertActivePixels + vertBlankPixels))
refresh_rate = 85500000 / ((1366 + 426) * (768 + 30))
refresh_rate = 59.78954081632653061224
We can see the difference between the mutter generated rate and the calculated one.
59.789539337158203
59.78954081632653061224
This difference makes the programmatic generation of monitors.xml file quite impossible, because the EXACT VALUE is expected by mutter.
Maybe, a solution would be to round to 4 or 5 decimals the refresh rate, and accept this value to match a resolution + rate.