diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index f62d662..cf94e75 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -701,10 +701,15 @@ xf86DefaultMode (xf86OutputPtr output, int width, int height) int target_diff = 0; int target_preferred = 0; int mm_height; + int mm_width; mm_height = output->mm_height; + mm_width = output->mm_width; if (!mm_height) + { mm_height = 203; /* 768 pixels at 96dpi */ + mm_width = 271; /* 1024 pixels at 96dpi */ + } /* * Pick a mode closest to 96dpi */ @@ -714,6 +719,7 @@ xf86DefaultMode (xf86OutputPtr output, int width, int height) int preferred = (((mode->type & M_T_PREFERRED) != 0) + ((mode->type & M_T_USERPREF) != 0)); int diff; + int xdiff; if (xf86ModeWidth (mode, output->initial_rotation) > width || xf86ModeHeight (mode, output->initial_rotation) > height) @@ -723,6 +729,9 @@ xf86DefaultMode (xf86OutputPtr output, int width, int height) dpi = (mode->VDisplay * 254) / (mm_height * 10); diff = dpi - 96; diff = diff < 0 ? -diff : diff; + dpi = (mode->HDisplay * 254) / (mm_width * 10); + xdiff = (dpi - 96) * 2 / 3; + diff += xdiff < 0 ? -xdiff : xdiff; if (target_mode == NULL || (preferred > target_preferred) || (preferred == target_preferred && diff < target_diff)) {