diff options
-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; |