--- xorg-server-1.3.0.0/hw/xfree86/modes/xf86Crtc.c.pix 2007-09-20 15:45:03.000000000 +0200 +++ xorg-server-1.3.0.0/hw/xfree86/modes/xf86Crtc.c 2007-09-20 18:41:48.000000000 +0200 @@ -690,10 +690,14 @@ xf86DefaultMode (xf86OutputPtr output, i 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 */ + if (!mm_width) + mm_width = 270; /* 1024 pixels at 96dpi */ /* * Pick a mode closest to 96dpi */ @@ -701,7 +705,7 @@ xf86DefaultMode (xf86OutputPtr output, i { int dpi; int preferred = (mode->type & M_T_PREFERRED) != 0; - int diff; + int diff, diff2; if (xf86ModeWidth (mode, output->initial_rotation) > width || xf86ModeHeight (mode, output->initial_rotation) > height) @@ -711,6 +715,11 @@ xf86DefaultMode (xf86OutputPtr output, i dpi = (mode->VDisplay * 254) / (mm_height * 10); diff = dpi - 96; diff = diff < 0 ? -diff : diff; + + dpi = (mode->HDisplay * 254) / (mm_width * 10); + diff2 = dpi - 96; + diff += diff2 < 0 ? -diff2 : diff2; + if (target_mode == NULL || (preferred > target_preferred) || (preferred == target_preferred && diff < target_diff)) {