diff options
author | Hans-Juergen Mauser <hjmauser@gmx.net> | 2012-05-10 20:52:35 +0200 |
---|---|---|
committer | Tormod Volden <debian.tormod@gmail.com> | 2012-05-27 20:50:30 +0200 |
commit | 4fd71d6781f78967a6f72bcade28687b9ac3a500 (patch) | |
tree | d87d530d22166d7d6267076c2c8a81b892a7b9f8 | |
parent | 9d80cfc650e39c57581fb77df1991796bd545295 (diff) |
SavageSetPanelEnabled() only write active devices if needed
If the LCD is off, DPMS for the LCD is blocked. Otherwise, the
display would get corrupted on external (esp. TV) screen and the LCD got
into an undesired state of turning white. This was especially annoying
as e.g. the VLC player makes calls to DPMS before playing a video! I
think this was well-meant, but was destructive in case of our savage
driver. Now the driver is protected.
Signed-off-by: Hans-Juergen Mauser <hjmauser@gmx.net>
[Tormod: patch split out from a big diff]
Signed-off-by: Tormod Volden <debian.tormod@gmail.com>
-rw-r--r-- | src/savage_vbe.c | 46 |
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. */ |