diff --git a/src/i830_driver.c b/src/i830_driver.c index d3b539a..11713ab 100644 --- a/src/i830_driver.c +++ b/src/i830_driver.c @@ -1595,6 +1595,16 @@ I830AccelMethodInit(ScrnInfoPtr pScrn) I830SetupOutputs(pScrn); SaveHWState(pScrn); + /* + { int num = 0; + while(1) { + num ++; + OUTREG(VGACNTRL, 1 << 31); + RestoreHWState(pScrn); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "MaLing's num is <%d>\n", num); + } + } + */ if (!xf86InitialConfiguration (pScrn, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes.\n"); diff --git a/src/i830_lvds.c b/src/i830_lvds.c index 4f64905..37134ce 100644 --- a/src/i830_lvds.c +++ b/src/i830_lvds.c @@ -891,6 +891,27 @@ i830_lvds_detect(xf86OutputPtr output) return XF86OutputStatusConnected; } +static void fill_detailed_block(struct detailed_monitor_section *det_mon, + DisplayModePtr mode) +{ + struct detailed_timings *timing = &det_mon->section.d_timings; + det_mon->type = DT; + timing->clock = mode->Clock * 1000; + timing->h_active = mode->HDisplay; + timing->h_blanking = mode->HTotal - mode->HDisplay; + timing->v_active = mode->VDisplay; + timing->v_blanking = mode->VTotal - mode->VDisplay; + timing->h_sync_off = mode->HSyncStart - mode->HDisplay; + timing->h_sync_width = mode->HSyncEnd - mode->HSyncStart; + timing->v_sync_off = mode->VSyncStart - mode->VDisplay; + timing->v_sync_width = mode->VSyncEnd - mode->VSyncStart; + + if (mode->Flags & V_PVSYNC) + timing->misc |= 0x02; + + if (mode->Flags & V_PHSYNC) + timing->misc |= 0x01; +} /** * Return the list of DDC modes if available, or the BIOS fixed mode otherwise. */ @@ -944,22 +965,39 @@ i830_lvds_get_modes(xf86OutputPtr output) { edid_mon = xcalloc (1, sizeof (xf86Monitor)); if (edid_mon) - { + { + struct detailed_monitor_section *det_mon = edid_mon->det_mon; + /*support DPM, instead of DPMS*/ + edid_mon->features.dpms |= 0x1; + /*defaultly support RGB color display*/ + edid_mon->features.display_type |= 0x1; + /*defaultly display support continuous-freqencey*/ + edid_mon->features.msc |= 0x1; + /* Set wide sync ranges so we get all modes * handed to valid_mode for checking */ - edid_mon->det_mon[0].type = DS_RANGES; - edid_mon->det_mon[0].section.ranges.min_v = 0; - edid_mon->det_mon[0].section.ranges.max_v = 200; - edid_mon->det_mon[0].section.ranges.min_h = 0; - edid_mon->det_mon[0].section.ranges.max_h = 200; - + if (pI830->lvds_fixed_mode != NULL) { + /* now we construct new EDID monitor, + * so filled one detailed timing block + */ + fill_detailed_block(det_mon, pI830->lvds_fixed_mode); + /* the filed timing block should be set preferred*/ + edid_mon->features.msc |= 0x2; + det_mon = det_mon + 1; + } + + det_mon->type = DS_RANGES; + det_mon->section.ranges.min_v = 0; + det_mon->section.ranges.max_v = 200; + det_mon->section.ranges.min_h = 0; + det_mon->section.ranges.max_h = 200; output->MonInfo = edid_mon; } } if (pI830->lvds_fixed_mode != NULL) - return xf86DuplicateMode(pI830->lvds_fixed_mode); + return xf86DuplicateMode(pI830->lvds_fixed_mode); return NULL; }