diff options
author | Tormod Volden <debian.tormod@gmail.com> | 2012-02-15 22:20:37 +0100 |
---|---|---|
committer | Tormod Volden <debian.tormod@gmail.com> | 2012-03-24 22:17:48 +0100 |
commit | de22eab9a21df80fe965dc37d21ba3ac2b9f5fd0 (patch) | |
tree | 31d51b8747f643441082cf3a7f2e1dddebd0355d | |
parent | 63dd44674a28263c5d8d6aec8b72e95f94d3fe6c (diff) |
Refactor BIOS modes retrieval to call VBEGetVBEInfo only once
Otherwise, calling it twice would trigger a VBE bug when using
xserver 1.12.
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
-rw-r--r-- | src/savage_driver.h | 1 | ||||
-rw-r--r-- | src/savage_vbe.c | 25 |
2 files changed, 15 insertions, 11 deletions
diff --git a/src/savage_driver.h b/src/savage_driver.h index 7b7e01d..338cfac 100644 --- a/src/savage_driver.h +++ b/src/savage_driver.h @@ -625,6 +625,7 @@ ModeStatus SavageMatchBiosMode(ScrnInfoPtr pScrn,int width,int height,int refres unsigned short SavageGetBIOSModes( SavagePtr psav, + VbeInfoBlock *vbe, int iDepth, SavageModeEntryPtr s3vModeTable ); diff --git a/src/savage_vbe.c b/src/savage_vbe.c index d24da24..7dba538 100644 --- a/src/savage_vbe.c +++ b/src/savage_vbe.c @@ -242,17 +242,28 @@ SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable ) SavageModeTablePtr SavageGetBIOSModeTable( SavagePtr psav, int iDepth ) { - int nModes = SavageGetBIOSModes( psav, iDepth, NULL ); + VbeInfoBlock *vbe; + int nModes; SavageModeTablePtr pTable; + if( !psav->pVbe ) + return 0; + + if (!(vbe = VBEGetVBEInfo(psav->pVbe))) + return 0; + + nModes = SavageGetBIOSModes( psav, vbe, iDepth, NULL ); + pTable = (SavageModeTablePtr) calloc( 1, sizeof(SavageModeTableRec) + (nModes-1) * sizeof(SavageModeEntry) ); if( pTable ) { pTable->NumModes = nModes; - SavageGetBIOSModes( psav, iDepth, pTable->Modes ); + SavageGetBIOSModes( psav, vbe, iDepth, pTable->Modes ); } + VBEFreeVBEInfo(vbe); + return pTable; } @@ -260,19 +271,16 @@ SavageGetBIOSModeTable( SavagePtr psav, int iDepth ) unsigned short SavageGetBIOSModes( SavagePtr psav, + VbeInfoBlock *vbe, int iDepth, SavageModeEntryPtr s3vModeTable ) { unsigned short iModeCount = 0; unsigned short int *mode_list; pointer vbeLinear = NULL; - VbeInfoBlock *vbe; int vbeReal; struct vbe_mode_info_block * vmib; - if( !psav->pVbe ) - return 0; - vbeLinear = xf86Int10AllocPages( psav->pVbe->pInt10, 1, &vbeReal ); if( !vbeLinear ) { @@ -281,9 +289,6 @@ SavageGetBIOSModes( } vmib = (struct vbe_mode_info_block *) vbeLinear; - if (!(vbe = VBEGetVBEInfo(psav->pVbe))) - return 0; - for (mode_list = vbe->VideoModePtr; *mode_list != 0xffff; mode_list++) { /* @@ -377,8 +382,6 @@ SavageGetBIOSModes( } } - VBEFreeVBEInfo(vbe); - xf86Int10FreePages( psav->pVbe->pInt10, vbeLinear, 1 ); return iModeCount; |