summaryrefslogtreecommitdiff
path: root/src/savage_vbe.c
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2004-07-30 21:25:26 +0000
committerEgbert Eich <eich@suse.de>2004-07-30 21:25:26 +0000
commitc18f5801a555b1c1651a9d9cfb4ed141e210effa (patch)
tree0710668373cdcf8d1b2f9880819f74d90e12aa8d /src/savage_vbe.c
parent81760d382c4921a270715fe9e6b348699353ee01 (diff)
Add pseudocolor overlay mode. Leave streams engine running at all times to
prevent artefacts during video playback. Fixed VBE mode list code to work together with reading DDC data using VBE functions. Fixed data types to muffle compiler. Fixed requested size of FIFO for image writes. Fixes temporary lockups.
Diffstat (limited to 'src/savage_vbe.c')
-rw-r--r--src/savage_vbe.c132
1 files changed, 57 insertions, 75 deletions
diff --git a/src/savage_vbe.c b/src/savage_vbe.c
index 70059ca..25e64da 100644
--- a/src/savage_vbe.c
+++ b/src/savage_vbe.c
@@ -1,4 +1,4 @@
-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.9 2001/05/19 02:05:55 dawes Exp $ */
+/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.11 2002/05/14 20:19:52 alanh Exp $ */
#include "savage_driver.h"
#include "savage_vbe.h"
@@ -35,18 +35,18 @@ SavageSetTextMode( SavagePtr psav )
{
/* Restore display device if changed. */
if( psav->iDevInfo != psav->iDevInfoPrim ) {
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14;
- psav->pInt10->bx = 0x0003;
- psav->pInt10->cx = psav->iDevInfoPrim;
- xf86ExecX86int10( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14;
+ psav->pVbe->pInt10->bx = 0x0003;
+ psav->pVbe->pInt10->cx = psav->iDevInfoPrim;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
}
- SavageClearVM86Regs( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
- psav->pInt10->ax = 0x83;
+ psav->pVbe->pInt10->ax = 0x83;
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
}
@@ -69,31 +69,31 @@ SavageSetVESAMode( SavagePtr psav, int n, int Refresh )
/* Establish the refresh rate for this mode. */
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0001; /* Set default refresh rate */
- psav->pInt10->cx = n & 0x3fff;
- psav->pInt10->di = Refresh & 0xffff;
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0001; /* Set default refresh rate */
+ psav->pVbe->pInt10->cx = n & 0x3fff;
+ psav->pVbe->pInt10->di = Refresh & 0xffff;
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
/* Set TV type if TV is on. */
if( psav->TvOn ) {
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0007; /* TV extensions */
- psav->pInt10->cx = psav->PAL ? 0x08 : 0x04;
- psav->pInt10->dx = 0x0c;
- xf86ExecX86int10( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0007; /* TV extensions */
+ psav->pVbe->pInt10->cx = psav->PAL ? 0x08 : 0x04;
+ psav->pVbe->pInt10->dx = 0x0c;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
}
/* Manipulate output device set. */
if( psav->iDevInfo != iDevInfo ) {
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0003; /* set active devices */
- psav->pInt10->cx = psav->iDevInfo;
- xf86ExecX86int10( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0003; /* set active devices */
+ psav->pVbe->pInt10->cx = psav->PAL ? 0x08 : 0x04;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
/* Re-fetch actual device set. */
psav->iDevInfo = SavageGetDevice( psav );
@@ -123,36 +123,17 @@ SavageSetVESAMode( SavagePtr psav, int n, int Refresh )
}
-void
-SavageSetPanelEnabled( SavagePtr psav, Bool active )
-{
- int iDevInfo;
- if( !psav->PanelX )
- return; /* no panel */
- iDevInfo = SavageGetDevice( psav );
- if( active )
- iDevInfo |= LCD_ACTIVE;
- else
- iDevInfo &= ~LCD_ACTIVE;
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0003; /* set active devices */
- psav->pInt10->cx = iDevInfo;
- xf86ExecX86int10( psav->pInt10 );
-}
-
-
/* Function to get supported device list. */
static int SavageGetDevice( SavagePtr psav )
{
- SavageClearVM86Regs( psav->pInt10 );
- psav->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pInt10->bx = 0x0103; /* get active devices */
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0103; /* get active devices */
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
- return ((psav->pInt10->cx) & 0xf);
+ return ((psav->pVbe->pInt10->cx) & 0xf);
}
@@ -169,6 +150,7 @@ SavageFreeBIOSModeTable( SavagePtr psav, SavageModeTablePtr* ppTable )
xfree( pMode->RefreshRate );
pMode->RefreshRate = NULL;
}
+ pMode++;
}
xfree( *ppTable );
@@ -202,15 +184,14 @@ SavageGetBIOSModes(
unsigned short iModeCount = 0;
unsigned short int *mode_list;
pointer vbeLinear = NULL;
- vbeControllerInfoPtr vbe = NULL;
+ VbeInfoBlock *vbe;
int vbeReal;
struct vbe_mode_info_block * vmib;
if( !psav->pVbe )
return 0;
- vbe = (vbeControllerInfoPtr) psav->pVbe->memory;
- vbeLinear = xf86Int10AllocPages( psav->pInt10, 1, &vbeReal );
+ vbeLinear = xf86Int10AllocPages( psav->pVbe->pInt10, 1, &vbeReal );
if( !vbeLinear )
{
ErrorF( "Cannot allocate scratch page in real mode memory." );
@@ -218,12 +199,11 @@ SavageGetBIOSModes(
}
vmib = (struct vbe_mode_info_block *) vbeLinear;
- for (
- mode_list = xf86int10Addr( psav->pInt10, L_ADD(vbe->VideoModePtr) );
- *mode_list != 0xffff;
- mode_list++
- )
- {
+ if (!(vbe = VBEGetVBEInfo(psav->pVbe)))
+ return 0;
+
+ for (mode_list = vbe->VideoModePtr; *mode_list != 0xffff; mode_list++) {
+
/*
* This is a HACK to work around what I believe is a BUG in the
* Toshiba Satellite BIOSes in 08/2000 and 09/2000. The BIOS
@@ -239,15 +219,15 @@ SavageGetBIOSModes(
if( *mode_list >= 0x0200 )
continue;
- SavageClearVM86Regs( psav->pInt10 );
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
- psav->pInt10->ax = 0x4f01;
- psav->pInt10->cx = *mode_list;
- psav->pInt10->es = SEG_ADDR(vbeReal);
- psav->pInt10->di = SEG_OFF(vbeReal);
- psav->pInt10->num = 0x10;
+ psav->pVbe->pInt10->ax = 0x4f01;
+ psav->pVbe->pInt10->cx = *mode_list;
+ psav->pVbe->pInt10->es = SEG_ADDR(vbeReal);
+ psav->pVbe->pInt10->di = SEG_OFF(vbeReal);
+ psav->pVbe->pInt10->num = 0x10;
- xf86ExecX86int10( psav->pInt10 );
+ xf86ExecX86int10( psav->pVbe->pInt10 );
if(
(vmib->bits_per_pixel == iDepth) &&
@@ -274,8 +254,8 @@ SavageGetBIOSModes(
/* Query the refresh rates at this mode. */
- psav->pInt10->cx = *mode_list;
- psav->pInt10->dx = 0;
+ psav->pVbe->pInt10->cx = *mode_list;
+ psav->pVbe->pInt10->dx = 0;
do
{
@@ -299,14 +279,14 @@ SavageGetBIOSModes(
}
}
- psav->pInt10->ax = 0x4f14; /* S3 extended functions */
- psav->pInt10->bx = 0x0201; /* query refresh rates */
- psav->pInt10->num = 0x10;
- xf86ExecX86int10( psav->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extended functions */
+ psav->pVbe->pInt10->bx = 0x0201; /* query refresh rates */
+ psav->pVbe->pInt10->num = 0x10;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
- s3vModeTable->RefreshRate[iRefresh++] = psav->pInt10->di;
+ s3vModeTable->RefreshRate[iRefresh++] = psav->pVbe->pInt10->di;
}
- while( psav->pInt10->dx );
+ while( psav->pVbe->pInt10->dx );
s3vModeTable->RefreshCount = iRefresh;
@@ -315,7 +295,9 @@ SavageGetBIOSModes(
}
}
- xf86Int10FreePages( psav->pInt10, vbeLinear, 1 );
+ VBEFreeVBEInfo(vbe);
+
+ xf86Int10FreePages( psav->pVbe->pInt10, vbeLinear, 1 );
return iModeCount;
}