summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/i830_modes.c18
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;
}