summaryrefslogtreecommitdiff
path: root/linux-core/drm_modes.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2007-04-23 09:10:46 +1000
committerDave Airlie <airlied@linux.ie>2007-04-23 09:10:46 +1000
commit0f3c5148f02bd98411095fdc8059207fa17b4a7d (patch)
tree48d69709e71f0c8d6120913c78f52e46119b265e /linux-core/drm_modes.c
parent97b5599982c76915b0750c6ef0a270639b02a6f2 (diff)
fixup vrefresh reporting, it should now be *1000 in userspace
Diffstat (limited to 'linux-core/drm_modes.c')
-rw-r--r--linux-core/drm_modes.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/linux-core/drm_modes.c b/linux-core/drm_modes.c
index 648e85e5..54c25137 100644
--- a/linux-core/drm_modes.c
+++ b/linux-core/drm_modes.c
@@ -47,7 +47,7 @@ void drm_mode_debug_printmodeline(struct drm_device *dev,
struct drm_display_mode *mode)
{
DRM_DEBUG("Modeline %d:\"%s\" %d %d %d %d %d %d %d %d %d %d\n",
- mode->mode_id, mode->name, mode->vrefresh / 1000, mode->clock,
+ mode->mode_id, mode->name, mode->vrefresh, mode->clock,
mode->hdisplay, mode->hsync_start,
mode->hsync_end, mode->htotal,
mode->vdisplay, mode->vsync_start,
@@ -144,16 +144,24 @@ EXPORT_SYMBOL(drm_mode_height);
* FIXME: why is this needed?
*
* RETURNS:
- * Vertical refresh rate of @mode.
+ * Vertical refresh rate of @mode x 1000. For precision reasons.
*/
int drm_mode_vrefresh(struct drm_display_mode *mode)
{
int refresh = 0;
+ unsigned int calc_val;
if (mode->vrefresh > 0)
refresh = mode->vrefresh;
else if (mode->htotal > 0 && mode->vtotal > 0) {
- refresh = ((mode->clock * 1000) * 1000) / mode->htotal / mode->vtotal;
+ /* work out vrefresh the value will be x1000 */
+ calc_val = (mode->clock * 1000);
+
+ calc_val /= mode->htotal;
+ calc_val *= 1000;
+ calc_val /= mode->vtotal;
+
+ refresh = calc_val;
if (mode->flags & V_INTERLACE)
refresh *= 2;
if (mode->flags & V_DBLSCAN)