summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Juergen Mauser <hjmauser@gmx.net>2012-05-27 20:01:40 +0200
committerTormod Volden <debian.tormod@gmail.com>2012-05-27 20:10:02 +0200
commit06878b40025cfabdcf7138cf6bae90ffe0c83f0c (patch)
treee1d95362a12b453eee8af0bf32157c72e34e6399
parent81e73bf0e3649e0f352f201c9c4d86b26582e0f3 (diff)
Update configuration flags on mode changes
Only enforce the user-supplied settings on the first mode change (from text to initial graphics mode). On subsequent mode changes, update the configuration flags to be consistent with the actual status before changing mode, so that "live" changes in output configuration can be preserved across mode changes. If we are changing from what seems to be original (text) mode the settings have probably not been changed so we do not use the actual state read from the hardware but the remembered state from after last change. Tormod comment: Does the above last part make any sense? On each mode switch, the driver should read in its current output configuration and update its list and flags. Up to now, a resolution switch after changing output by hot-key or s3switch caused the outputs to be changed back to their previous state. 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_regs.h2
-rw-r--r--src/savage_vbe.c36
2 files changed, 32 insertions, 6 deletions
diff --git a/src/savage_regs.h b/src/savage_regs.h
index 1a71c4e..66cb215 100644
--- a/src/savage_regs.h
+++ b/src/savage_regs.h
@@ -200,6 +200,8 @@ do { \
#define CRT_ATTACHED 0x10
#define LCD_ATTACHED 0x20
#define TV_ATTACHED 0x40
+/* flag to mask away anything but the active devices (x_ACTIVE) */
+#define ACTIVE_DEVICES 0x07
/*
diff --git a/src/savage_vbe.c b/src/savage_vbe.c
index 17a534e..7171582 100644
--- a/src/savage_vbe.c
+++ b/src/savage_vbe.c
@@ -118,6 +118,7 @@ void
SavageSetVESAMode( SavagePtr psav, int n, int Refresh )
{
int iDevInfo;
+ int iTVInfo;
static Bool bFirstRun = TRUE;
if (psav->IsSecondary) {
@@ -132,15 +133,38 @@ SavageSetVESAMode( SavagePtr psav, int n, int Refresh )
/* Get current display device status. */
iDevInfo = SavageGetDevice(psav);
- psav->iDevInfo = iDevInfo;
+ iTVInfo = SavageGetTV(psav);
+ /*
+ * Check if we run for the first time - if this is the case,
+ * save the original settings both as current and original.
+ * Additionally, prefer the flag settings at this point as they are the user's desire.
+ */
if( bFirstRun == TRUE ) {
bFirstRun = FALSE;
- psav->iDevInfoPrim = psav->iDevInfo;
+ /* run for the first time - store settings as current and original */
+ psav->iDevInfo = iDevInfo;
+ psav->iDevInfoPrim = iDevInfo;
+ /* add features requested by the config to the current settings */
+ if( psav->TvOn ) {
+ psav->iDevInfo |= TV_ACTIVE; /* TvOn is NOT TvOnly! */
+ }
+ if( psav->CrtOnly ) {
+ psav->iDevInfo = CRT_ACTIVE; /* do this at last as this is exclusive and cancels other settings */
+ }
+ /* read in TV format from the BIOS, ignore what has been configured before as the handling is silly and not documented (PAL does not mean that TV should be switched on, etc.) */
+ /* TODO: check how preference of BIOS and config can be handled intelligently, this must be coordinated with savage_driver.c */
+ psav->PAL = ((iTVInfo & BIOS_TV_PAL) != 0);
+ } else { /* subsequent run */
+ /* if the current settings are identical to the original, we likely come from text mode - prefer the stored ones */
+ /* but take the current ones if settings are different as they might have been modified on-line */
+ if (psav->iDevInfoPrim != iDevInfo) {
+ psav->iDevInfo = iDevInfo;
+ }
+ /* in both cases, update the flags according to the selected configuration */
+ psav->TvOn = ((psav->iDevInfo & TV_ACTIVE) != 0);
+ /* only set CRT flag if no other output is active */
+ psav->CrtOnly = (((psav->iDevInfo & ACTIVE_DEVICES) & ((unsigned char) ~CRT_ACTIVE)) == 0);
}
- if( psav->TvOn )
- psav->iDevInfo |= TV_ACTIVE; /* TvOn is NOT TvOnly! */
- if( psav->CrtOnly )
- psav->iDevInfo = CRT_ACTIVE; /* do this at last as this is exclusive and cancels other settings */
/* Establish the refresh rate for this mode. */