summaryrefslogtreecommitdiff
path: root/kms++/src/videomode.cpp
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-09-29 10:55:19 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-09-29 11:21:20 +0300
commit8e3d7e30e34ffb181a600e12e74727737e0c1f76 (patch)
tree631d2ef472a9ce9c51a58393bbbdaa9cbef3c0f7 /kms++/src/videomode.cpp
parent8170f7a37747c3a414b8ad45bb587adcdac6e0da (diff)
Improve mode finding
Change calculated_vrefresh to round to 2 decimals, and do two rounds when looking for a mode: first look for exact vrefresh match, then look for rounded match. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'kms++/src/videomode.cpp')
-rw-r--r--kms++/src/videomode.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/kms++/src/videomode.cpp b/kms++/src/videomode.cpp
index 107ee3b..f675914 100644
--- a/kms++/src/videomode.cpp
+++ b/kms++/src/videomode.cpp
@@ -1,5 +1,6 @@
#include <xf86drm.h>
#include <xf86drmMode.h>
+#include <math.h>
#include <kms++/kms++.h>
#include "helpers.h"
@@ -18,7 +19,8 @@ unique_ptr<Blob> Videomode::to_blob(Card& card) const
float Videomode::calculated_vrefresh() const
{
- return (clock * 1000.0) / (htotal * vtotal) * (interlace() ? 2 : 1);
+ float refresh = (clock * 1000.0) / (htotal * vtotal) * (interlace() ? 2 : 1);
+ return roundf(refresh * 100.0) / 100.0;
}
bool Videomode::interlace() const