Mir

Merge lp:~vanvugt/mir/fix-1407558 into lp:mir

Proposed by Daniel van Vugt
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 2193
Proposed branch: lp:~vanvugt/mir/fix-1407558
Merge into: lp:mir
Prerequisite: lp:~vanvugt/mir/wrap-the-rest
Diff against target: 48 lines (+9/-6)
3 files modified
src/platforms/mesa/real_kms_display_configuration.cpp (+6/-3)
src/utils/out.c (+1/-1)
tests/unit-tests/graphics/mesa/test_display_configuration.cpp (+2/-2)
To merge this branch: bzr merge lp:~vanvugt/mir/fix-1407558
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Approve
Review via email: mp+245557@code.launchpad.net

Commit message

Report vertical refresh rates to two decimal places so that one can tell
the difference between common frequencies such as 59.94 vs 60.00Hz.
(LP: #1407558)

I'm kind of undecided about this. Although slightly on the side of
preferring two decimal places because that's the precision most commonly
used in the industry. If people do round then they tend to round to the
nearest whole number. Never one decimal place.

To post a comment you must log in.
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

Ok

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/platforms/mesa/real_kms_display_configuration.cpp'
--- src/platforms/mesa/real_kms_display_configuration.cpp 2014-12-18 18:30:27 +0000
+++ src/platforms/mesa/real_kms_display_configuration.cpp 2015-01-05 10:46:45 +0000
@@ -54,10 +54,13 @@
54 return 0.0;54 return 0.0;
5555
56 /* mode.clock is in KHz */56 /* mode.clock is in KHz */
57 double vrefresh_hz = mode.clock * 1000.0 / (mode.htotal * mode.vtotal);57 double hz = (mode.clock * 100000LL /
58 ((long)mode.htotal * (long)mode.vtotal)
59 ) / 100.0;
5860
59 /* Round to first decimal */61 // Actually we don't need floating point at all for this...
60 return round(vrefresh_hz * 10.0) / 10.0;62 // TODO: Consider converting our structs to fixed-point ints
63 return hz;
61}64}
6265
63mg::DisplayConfigurationOutputType66mg::DisplayConfigurationOutputType
6467
=== modified file 'src/utils/out.c'
--- src/utils/out.c 2014-03-06 06:05:17 +0000
+++ src/utils/out.c 2015-01-05 10:46:45 +0000
@@ -177,7 +177,7 @@
177 mode->vertical_resolution);177 mode->vertical_resolution);
178 }178 }
179179
180 printf("%6.1f%c%c",180 printf("%6.2f%c%c",
181 mode->refresh_rate,181 mode->refresh_rate,
182 (m == out->current_mode) ? '*' : ' ',182 (m == out->current_mode) ? '*' : ' ',
183 (m == out->preferred_mode) ? '+' : ' ');183 (m == out->preferred_mode) ? '+' : ' ');
184184
=== modified file 'tests/unit-tests/graphics/mesa/test_display_configuration.cpp'
--- tests/unit-tests/graphics/mesa/test_display_configuration.cpp 2014-12-19 02:31:34 +0000
+++ tests/unit-tests/graphics/mesa/test_display_configuration.cpp 2015-01-05 10:46:45 +0000
@@ -56,8 +56,8 @@
56 /* Calculate vertical refresh rate from DRM mode information */56 /* Calculate vertical refresh rate from DRM mode information */
57 if (mode.htotal != 0.0 && mode.vtotal != 0.0)57 if (mode.htotal != 0.0 && mode.vtotal != 0.0)
58 {58 {
59 vrefresh_hz = mode.clock * 1000.0 / (mode.htotal * mode.vtotal);59 vrefresh_hz = (mode.clock * 100000LL /
60 vrefresh_hz = round(vrefresh_hz * 10.0) / 10.0;60 ((long)mode.htotal * (long)mode.vtotal)) / 100.0;
61 }61 }
6262
63 return mg::DisplayConfigurationMode{size, vrefresh_hz};63 return mg::DisplayConfigurationMode{size, vrefresh_hz};

Subscribers

People subscribed via source and target branches