drm_hwcomposer: recalculate vrefresh from clock + resolution
For DMT modes and HDMI modes with 1000/1001 variations, the kernel
reports the vrefresh in integer, rounded up, thus 59.94Hz or 23.97Hz
are reported as 60Hz and 24Hz to userspace.
To solve this, recalculate the vrefresh from clock + resolution.
Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
diff --git a/drmmode.cpp b/drmmode.cpp
index 5f2e7c2..c3ab385 100644
--- a/drmmode.cpp
+++ b/drmmode.cpp
@@ -122,8 +122,8 @@
}
float DrmMode::v_refresh() const {
- return v_refresh_ ? v_refresh_ * 1.0f
- : clock_ / (float)(v_total_ * h_total_) * 1000.0f;
+ // Always recalculate refresh to report correct float rate
+ return clock_ / (float)(v_total_ * h_total_) * 1000.0f;
}
uint32_t DrmMode::flags() const {