Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 163954
b: refs/heads/master
c: 559ee21
h: refs/heads/master
v: v3
  • Loading branch information
Zhao Yakui authored and Dave Airlie committed Sep 7, 2009
1 parent c0b4485 commit 9c2b865
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aa9eaa1f0962152d0bde821149d82fe7b70a6f92
refs/heads/master: 559ee21d261a54c42594ef9405d27e9008eedf44
40 changes: 33 additions & 7 deletions trunk/drivers/gpu/drm/drm_edid.c
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,26 @@ static struct drm_display_mode drm_dmt_modes[] = {
DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_PVSYNC) },
};

static struct drm_display_mode *drm_find_dmt(struct drm_device *dev,
int hsize, int vsize, int fresh)
{
int i, count;
struct drm_display_mode *ptr, *mode;

count = sizeof(drm_dmt_modes) / sizeof(struct drm_display_mode);
mode = NULL;
for (i = 0; i < count; i++) {
ptr = &drm_dmt_modes[i];
if (hsize == ptr->hdisplay &&
vsize == ptr->vdisplay &&
fresh == drm_mode_vrefresh(ptr)) {
/* get the expected default mode */
mode = drm_mode_duplicate(dev, ptr);
break;
}
}
return mode;
}
/**
* drm_mode_std - convert standard mode info (width, height, refresh) into mode
* @t: standard timing params
Expand Down Expand Up @@ -516,16 +536,22 @@ struct drm_display_mode *drm_mode_std(struct drm_device *dev,
vsize = (hsize * 4) / 5;
else
vsize = (hsize * 9) / 16;

/* HDTV hack */
if (hsize == 1360 && vsize == 765 && vrefresh_rate == 60) {
mode = drm_cvt_mode(dev, hsize, vsize, vrefresh_rate, 0, 0);
mode->hdisplay = 1366;
mode->vsync_start = mode->vsync_start - 1;
mode->vsync_end = mode->vsync_end - 1;
return mode;
}
mode = NULL;
/* check whether it can be found in default mode table */
mode = drm_find_dmt(dev, hsize, vsize, vrefresh_rate);
if (mode)
return mode;

switch (timing_level) {
case LEVEL_DMT:
mode = drm_mode_create(dev);
if (mode) {
mode->hdisplay = hsize;
mode->vdisplay = vsize;
drm_mode_set_name(mode);
}
break;
case LEVEL_GTF:
mode = drm_gtf_mode(dev, hsize, vsize, vrefresh_rate, 0, 0);
Expand Down
11 changes: 6 additions & 5 deletions trunk/drivers/gpu/drm/drm_modes.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,9 @@ EXPORT_SYMBOL(drm_mode_height);
* FIXME: why is this needed? shouldn't vrefresh be set already?
*
* RETURNS:
* Vertical refresh rate of @mode x 1000. For precision reasons.
* Vertical refresh rate. It will be the result of actual value plus 0.5.
* If it is 70.288, it will return 70Hz.
* If it is 59.6, it will return 60Hz.
*/
int drm_mode_vrefresh(struct drm_display_mode *mode)
{
Expand All @@ -576,14 +578,13 @@ int drm_mode_vrefresh(struct drm_display_mode *mode)
if (mode->vrefresh > 0)
refresh = mode->vrefresh;
else if (mode->htotal > 0 && mode->vtotal > 0) {
int vtotal;
vtotal = 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 + vtotal / 2) / vtotal;

refresh = calc_val;
if (mode->flags & DRM_MODE_FLAG_INTERLACE)
refresh *= 2;
if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
Expand Down

0 comments on commit 9c2b865

Please sign in to comment.