fixup vrefresh reporting, it should now be *1000 in userspace

main
Dave Airlie 2007-04-23 09:10:46 +10:00
parent 97b5599982
commit 0f3c5148f0
3 changed files with 14 additions and 4 deletions

View File

@ -1085,7 +1085,7 @@ void drm_crtc_convert_to_umode(struct drm_mode_modeinfo *out, struct drm_display
out->vsync_end = in->vsync_end; out->vsync_end = in->vsync_end;
out->vtotal = in->vtotal; out->vtotal = in->vtotal;
out->vscan = in->vscan; out->vscan = in->vscan;
out->vrefresh = in->vrefresh;
out->flags = in->flags; out->flags = in->flags;
strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN); strncpy(out->name, in->name, DRM_DISPLAY_MODE_LEN);
out->name[DRM_DISPLAY_MODE_LEN-1] = 0; out->name[DRM_DISPLAY_MODE_LEN-1] = 0;

View File

@ -47,7 +47,7 @@ void drm_mode_debug_printmodeline(struct drm_device *dev,
struct drm_display_mode *mode) struct drm_display_mode *mode)
{ {
DRM_DEBUG("Modeline %d:\"%s\" %d %d %d %d %d %d %d %d %d %d\n", 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->hdisplay, mode->hsync_start,
mode->hsync_end, mode->htotal, mode->hsync_end, mode->htotal,
mode->vdisplay, mode->vsync_start, mode->vdisplay, mode->vsync_start,
@ -144,16 +144,24 @@ EXPORT_SYMBOL(drm_mode_height);
* FIXME: why is this needed? * FIXME: why is this needed?
* *
* RETURNS: * 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 drm_mode_vrefresh(struct drm_display_mode *mode)
{ {
int refresh = 0; int refresh = 0;
unsigned int calc_val;
if (mode->vrefresh > 0) if (mode->vrefresh > 0)
refresh = mode->vrefresh; refresh = mode->vrefresh;
else if (mode->htotal > 0 && mode->vtotal > 0) { 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) if (mode->flags & V_INTERLACE)
refresh *= 2; refresh *= 2;
if (mode->flags & V_DBLSCAN) if (mode->flags & V_DBLSCAN)

View File

@ -905,6 +905,8 @@ struct drm_mode_modeinfo {
unsigned short hdisplay, hsync_start, hsync_end, htotal, hskew; unsigned short hdisplay, hsync_start, hsync_end, htotal, hskew;
unsigned short vdisplay, vsync_start, vsync_end, vtotal, vscan; unsigned short vdisplay, vsync_start, vsync_end, vtotal, vscan;
unsigned int vrefresh; /* vertical refresh * 1000 */
unsigned int flags; unsigned int flags;
char name[DRM_DISPLAY_MODE_LEN]; char name[DRM_DISPLAY_MODE_LEN];