summaryrefslogtreecommitdiff
path: root/src/savage_vbe.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/savage_vbe.c')
-rw-r--r--src/savage_vbe.c25
1 files changed, 14 insertions, 11 deletions
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;