diff options
author | Henry Zhao <henryz@localhost.localdomain> | 2007-04-23 01:38:09 +0200 |
---|---|---|
committer | Stephane Marchesin <marchesin@icps.u-strasbg.fr> | 2007-04-23 01:38:09 +0200 |
commit | 7af7d95eb8826fa3fb9914a8c6ad4b6f4867095e (patch) | |
tree | 56526b7e95787ccc406820450f22462df7798e7f | |
parent | 896fe62233f62d5e1f874ed0eba3a200fa5ef14b (diff) | |
download | xorg-driver-xf86-video-nouveau-7af7d95eb8826fa3fb9914a8c6ad4b6f4867095e.tar.gz |
Import from nv : Need to inject a mode corresponding panel width/height for validation
-rw-r--r-- | src/nv_driver.c | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/nv_driver.c b/src/nv_driver.c index 24564e8..acd8f42 100644 --- a/src/nv_driver.c +++ b/src/nv_driver.c @@ -33,6 +33,8 @@ #include "xf86drm.h" +extern DisplayModePtr xf86ModesAdd(DisplayModePtr Modes, DisplayModePtr Additions); + /*const OptionInfoRec * RivaAvailableOptions(int chipid, int busid); Bool RivaGetScrnInfoRec(PciChipsets *chips, int chip);*/ @@ -1036,6 +1038,7 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) int i, max_width, max_height; ClockRangePtr clockRanges; const char *s; + int config_mon_rates; if (flags & PROBE_DETECT) { EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -1497,7 +1500,13 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) xf86FreeInt10(pNv->pInt); return FALSE; } - + + if ((pScrn->monitor->nHsync == 0) && + (pScrn->monitor->nVrefresh == 0)) + config_mon_rates = FALSE; + else + config_mon_rates = TRUE; + NVCommonSetup(pScrn); pScrn->videoRam = pNv->RamAmountKBytes; @@ -1555,6 +1564,36 @@ NVPreInit(ScrnInfoPtr pScrn, int flags) max_height = 4096; } + /* If DFP, add a modeline corresponding to its panel size */ + if (pNv->FlatPanel && !pNv->Television && pNv->fpWidth && pNv->fpHeight) { + DisplayModePtr Mode; + + Mode = xnfcalloc(1, sizeof(DisplayModeRec)); + Mode = xf86CVTMode(pNv->fpWidth, pNv->fpHeight, 60.00, TRUE, FALSE); + Mode->type = M_T_DRIVER; + pScrn->monitor->Modes = xf86ModesAdd(pScrn->monitor->Modes, Mode); + + if (!config_mon_rates) { + if (!Mode->HSync) + Mode->HSync = ((float) Mode->Clock ) / ((float) Mode->HTotal); + if (!Mode->VRefresh) + Mode->VRefresh = (1000.0 * ((float) Mode->Clock)) / + ((float) (Mode->HTotal * Mode->VTotal)); + + if (Mode->HSync < pScrn->monitor->hsync[0].lo) + pScrn->monitor->hsync[0].lo = Mode->HSync; + if (Mode->HSync > pScrn->monitor->hsync[0].hi) + pScrn->monitor->hsync[0].hi = Mode->HSync; + if (Mode->VRefresh < pScrn->monitor->vrefresh[0].lo) + pScrn->monitor->vrefresh[0].lo = Mode->VRefresh; + if (Mode->VRefresh > pScrn->monitor->vrefresh[0].hi) + pScrn->monitor->vrefresh[0].hi = Mode->VRefresh; + + pScrn->monitor->nHsync = 1; + pScrn->monitor->nVrefresh = 1; + } + } + /* * xf86ValidateModes will check that the mode HTotal and VTotal values * don't exceed the chipset's limit if pScrn->maxHValue and |