diff options
author | Keith Packard <keithp@neko.keithp.com> | 2006-10-06 21:57:26 -0700 |
---|---|---|
committer | Keith Packard <keithp@neko.keithp.com> | 2006-10-06 21:57:26 -0700 |
commit | bf3820f1f505649ac0730add23d97d6de3f6d22c (patch) | |
tree | 7eaa7ed2ee33e267c65f8b2a25d8597c13983488 | |
parent | d649fb0d964a9b40b8e04314b5fc14bbbfd41bc3 (diff) |
Compute LVDS resolution from server DPI and native panel size.
I was unable to find the native LVDS panel physical size in the BDB
information. I would prefer to report accurate information through RandR if
possible though.
-rw-r--r-- | src/i830_modes.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/i830_modes.c b/src/i830_modes.c index ac7c4c51..9301dda4 100644 --- a/src/i830_modes.c +++ b/src/i830_modes.c @@ -651,11 +651,27 @@ static MonPtr i830GetLVDSMonitor(ScrnInfoPtr pScrn) { MonPtr mon; + DisplayModePtr mode; mon = xnfcalloc(1, sizeof(*mon)); mon->Modes = i830GetLVDSModes(pScrn, pScrn->display->modes); mon->Last = i830GetModeListTail(mon->Modes); - + /* + * Find the preferred mode, use the display resolution to compute + * the effective monitor size + */ + for (mode = mon->Modes; mode; mode = mode->next) + if (mode->type & M_T_PREFERRED) + break; + if (!mode) + mode = mon->Modes; + if (mode) + { +#define MMPERINCH 25.4 + mon->widthmm = (double) mode->HDisplay / pScrn->xDpi * MMPERINCH; + mon->heightmm = (double) mode->VDisplay / pScrn->yDpi * MMPERINCH; + } + return mon; } |