diff --git a/src/trident_driver.c b/src/trident_driver.c index a5b11df..357cbfc 100644 --- a/src/trident_driver.c +++ b/src/trident_driver.c @@ -3729,35 +3729,34 @@ tridentSetModeBIOS(ScrnInfoPtr pScrn, DisplayModePtr mode) static int TRIDENTLcdDisplaySize (xf86MonPtr pMon) { + unsigned int max = 0; + if (pMon) { int i,j; + /* + * Try to find the display's maximal mode + */ for (i = 0; i < STD_TIMINGS; i++) { - if (pMon->timings2[i].hsize == 1400) { - return 1400; + if (pMon->timings2[i].hsize > max) { + max = pMon->timings2[i].hsize; } } - /* - * If not explicitely set try to find out if the display supports - * the 1400 mode. For sanity check if DDC comes from a digital - * display. - */ + if (DIGITAL(pMon->features.input_type)) { for (i = 0; i < DET_TIMINGS; i++) { if (pMon->det_mon[i].type == DS_STD_TIMINGS) { for (j = 0; j < 5; j++) { - if (pMon->det_mon[i].section.std_t[j].hsize == 1400) { - return 1400; - } + if (pMon->det_mon[i].section.std_t[j].hsize > max) + max = pMon->det_mon[i].section.std_t[j].hsize; } } else if (pMon->det_mon[i].type == DT) { - if (pMon->det_mon[i].section.d_timings.h_active == 1400) { - return 1400; - } + if (pMon->det_mon[i].section.d_timings.h_active > max) + max = pMon->det_mon[i].section.d_timings.h_active; } } } } - return 0; + return max; }