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.c46
1 files changed, 37 insertions, 9 deletions
diff --git a/src/savage_vbe.c b/src/savage_vbe.c
index c7c62ba..b2a91fa 100644
--- a/src/savage_vbe.c
+++ b/src/savage_vbe.c
@@ -230,20 +230,48 @@ void
SavageSetPanelEnabled( SavagePtr psav, Bool active )
{
int iDevInfo;
+ Bool bDoChange = 0;
if( !psav->PanelX )
return; /* no panel */
iDevInfo = SavageGetDevice( psav );
- if( active )
- iDevInfo |= LCD_ACTIVE;
- else
- iDevInfo &= ~LCD_ACTIVE;
- SavageClearVM86Regs( psav->pVbe->pInt10 );
- psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
- psav->pVbe->pInt10->bx = 0x0003; /* set active devices */
- psav->pVbe->pInt10->cx = iDevInfo;
- xf86ExecX86int10( psav->pVbe->pInt10 );
+ /*
+ * This function (currently) gets called ONLY by the DPMS mode switching function.
+ * Therefore, we should NOT change anything in the following cases:
+ * - if the TV output is active, as we will corrupt the screen
+ * - TODO: check conditions for CRT / dual modes
+ * Anyway, we will make our settings consistent here and only write out something
+ * if we need a change.
+ */
+ if ((iDevInfo & TV_ACTIVE) == 0) {
+ /* continue, no TV will disturb us */
+ if( active ) {
+ /* LCD should be on afterwards */
+ if ((iDevInfo & LCD_ACTIVE) == 0) {
+ iDevInfo |= LCD_ACTIVE;
+ /* we need a change */
+ bDoChange = 1;
+ }
+ } else {
+ /* LCD should be off afterwards */
+ if ((iDevInfo & LCD_ACTIVE) != 0) {
+ iDevInfo &= ~LCD_ACTIVE;
+ /* change requested */
+ bDoChange = 1;
+ }
+ }
+ }
+
+ /* now check if we really need to do anything */
+ if (bDoChange != 0) {
+ /* update the active device configuration */
+ SavageClearVM86Regs( psav->pVbe->pInt10 );
+ psav->pVbe->pInt10->ax = 0x4f14; /* S3 extensions */
+ psav->pVbe->pInt10->bx = 0x0003; /* set active devices */
+ psav->pVbe->pInt10->cx = iDevInfo;
+ xf86ExecX86int10( psav->pVbe->pInt10 );
+ }
}
/* Function to get supported device list. */