diff options
author | Y.C. Chen <yc_chen@aspeedtech.com> | 2015-08-13 15:21:57 +0800 |
---|---|---|
committer | Y.C. Chen <yc_chen@aspeedtech.com> | 2015-08-13 15:21:57 +0800 |
commit | 77e7ac37c6031551f7ad355dc94c4176df4956aa (patch) | |
tree | aea346a44a7fa914881ab366022a5474e84afbad | |
parent | 4f404aa29eea5707cfdfe3dc2c762bd46063dfec (diff) |
use same search mode criteria with ast drm driver
-rw-r--r-- | src/ast_mode.c | 51 | ||||
-rw-r--r-- | src/ast_mode.h | 16 |
2 files changed, 40 insertions, 27 deletions
diff --git a/src/ast_mode.c b/src/ast_mode.c index f43d9a0..2b5ebde 100644 --- a/src/ast_mode.c +++ b/src/ast_mode.c @@ -495,6 +495,8 @@ static Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIO ASTRecPtr pAST; ULONG ulModeID, ulColorIndex, ulRefreshRate, ulRefreshRateIndex = 0; ULONG ulHBorder, ulVBorder; + Bool check_sync; + PVBIOS_ENHTABLE_STRUCT loop, best = NULL; pAST = ASTPTR(pScrn); @@ -560,27 +562,34 @@ static Bool bGetAST1000VGAModeInfo(ScrnInfoPtr pScrn, DisplayModePtr mode, PVBIO } /* Get Proper Mode Index */ - if (pVGAModeInfo->pEnhTableEntry->Flags & WideScreenMode) - { - /* parsing for wide screen reduced blank mode */ - if ((mode->Flags & V_NVSYNC) && (mode->Flags & V_PHSYNC)) /* CVT RB */ - pVGAModeInfo->pEnhTableEntry++; - } - else - { - ulRefreshRate = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal); - - while (pVGAModeInfo->pEnhTableEntry->ulRefreshRate < ulRefreshRate) - { - pVGAModeInfo->pEnhTableEntry++; - if ((pVGAModeInfo->pEnhTableEntry->ulRefreshRate > ulRefreshRate) || - (pVGAModeInfo->pEnhTableEntry->ulRefreshRate == 0xFF)) - { - pVGAModeInfo->pEnhTableEntry--; - break; - } - } - } + ulRefreshRate = (mode->Clock * 1000) / (mode->HTotal * mode->VTotal) + 1; + loop = pVGAModeInfo->pEnhTableEntry; + check_sync = loop->Flags & WideScreenMode; + do { + while (loop->ulRefreshRate != 0xff) { + if ((check_sync) && + (((mode->Flags & V_NVSYNC) && + (loop->Flags & PVSync)) || + ((mode->Flags & V_PVSYNC) && + (loop->Flags & NVSync)) || + ((mode->Flags & V_NHSYNC) && + (loop->Flags & PHSync)) || + ((mode->Flags & V_PHSYNC) && + (loop->Flags & NHSync)))) { + loop++; + continue; + } + if (loop->ulRefreshRate <= ulRefreshRate + && (!best || loop->ulRefreshRate > best->ulRefreshRate)) + best = loop; + loop++; + } + if (best || !check_sync) + break; + check_sync = 0; + } while (1); + if (best) + pVGAModeInfo->pEnhTableEntry = best; /* Update mode CRTC info */ ulHBorder = (pVGAModeInfo->pEnhTableEntry->Flags & HBorder) ? 8:0; diff --git a/src/ast_mode.h b/src/ast_mode.h index 0eb5ebd..25d4cd5 100644 --- a/src/ast_mode.h +++ b/src/ast_mode.h @@ -66,14 +66,18 @@ #define HalfDCLK 0x00000002 #define DoubleScanMode 0x00000004 #define LineCompareOff 0x00000008 -#define SyncPP 0x00000000 -#define SyncPN 0x00000040 -#define SyncNP 0x00000080 -#define SyncNN 0x000000C0 #define HBorder 0x00000020 #define VBorder 0x00000010 -#define WideScreenMode 0x00000100 -#define NewModeInfo 0x00000200 +#define WideScreenMode 0x00000100 +#define NewModeInfo 0x00000200 +#define NHSync 0x00000400 +#define PHSync 0x00000800 +#define NVSync 0x00001000 +#define PVSync 0x00002000 +#define SyncPP (PVSync | PHSync) +#define SyncPN (PVSync | NHSync) +#define SyncNP (NVSync | PHSync) +#define SyncNN (NVSync | NHSync) /* DAC Definition */ #define DAC_NUM_TEXT 64 |