diff options
author | Keith Packard <keithp@koto.keithp.com> | 2007-10-17 11:42:28 +0800 |
---|---|---|
committer | Keith Packard <keithp@koto.keithp.com> | 2007-10-17 11:42:28 +0800 |
commit | feac0759522cbdc3e61ccfa373df735903c5cb27 (patch) | |
tree | 67aed05ce7594a191e03f5ac152444967ce4ed22 | |
parent | f2da10f7bc2ddb6ad2f18b793afc10d04b97c51c (diff) |
Make config file preferred mode override monitor preferred mode.
Add a new even-more-preferred bit to each mode which is used to make config
file preferences selected instead of the monitor preferred mode.
-rw-r--r-- | hw/xfree86/common/xf86str.h | 1 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.c | 55 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.h | 3 |
3 files changed, 28 insertions, 31 deletions
diff --git a/hw/xfree86/common/xf86str.h b/hw/xfree86/common/xf86str.h index 0365ddd62..af98b4fd5 100644 --- a/hw/xfree86/common/xf86str.h +++ b/hw/xfree86/common/xf86str.h | |||
@@ -142,6 +142,7 @@ typedef enum { | |||
142 | # define M_T_DEFAULT 0x10 /* (VESA) default modes */ | 142 | # define M_T_DEFAULT 0x10 /* (VESA) default modes */ |
143 | # define M_T_USERDEF 0x20 /* One of the modes from the config file */ | 143 | # define M_T_USERDEF 0x20 /* One of the modes from the config file */ |
144 | # define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */ | 144 | # define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */ |
145 | # define M_T_USERPREF 0x80 /* mode preferred by the user config */ | ||
145 | 146 | ||
146 | /* Video mode */ | 147 | /* Video mode */ |
147 | typedef struct _DisplayModeRec { | 148 | typedef struct _DisplayModeRec { |
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index f589b5aac..0a48d5bd3 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c | |||
@@ -711,7 +711,8 @@ xf86DefaultMode (xf86OutputPtr output, int width, int height) | |||
711 | for (mode = output->probed_modes; mode; mode = mode->next) | 711 | for (mode = output->probed_modes; mode; mode = mode->next) |
712 | { | 712 | { |
713 | int dpi; | 713 | int dpi; |
714 | int preferred = (mode->type & M_T_PREFERRED) != 0; | 714 | int preferred = (((mode->type & M_T_PREFERRED) != 0) + |
715 | ((mode->type & M_T_USERPREF) != 0)); | ||
715 | int diff; | 716 | int diff; |
716 | 717 | ||
717 | if (xf86ModeWidth (mode, output->initial_rotation) > width || | 718 | if (xf86ModeWidth (mode, output->initial_rotation) > width || |
@@ -1415,7 +1416,7 @@ xf86ProbeOutputModes (ScrnInfoPtr scrn, int maxX, int maxY) | |||
1415 | mode->prev = NULL; | 1416 | mode->prev = NULL; |
1416 | output->probed_modes = mode; | 1417 | output->probed_modes = mode; |
1417 | } | 1418 | } |
1418 | mode->type |= M_T_PREFERRED; | 1419 | mode->type |= (M_T_PREFERRED|M_T_USERPREF); |
1419 | } | 1420 | } |
1420 | else | 1421 | else |
1421 | mode->type &= ~M_T_PREFERRED; | 1422 | mode->type &= ~M_T_PREFERRED; |
@@ -1532,6 +1533,7 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) | |||
1532 | xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); | 1533 | xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); |
1533 | int o, c; | 1534 | int o, c; |
1534 | DisplayModePtr target_mode = NULL; | 1535 | DisplayModePtr target_mode = NULL; |
1536 | int target_preferred = 0; | ||
1535 | Rotation target_rotation = RR_Rotate_0; | 1537 | Rotation target_rotation = RR_Rotate_0; |
1536 | xf86CrtcPtr *crtcs; | 1538 | xf86CrtcPtr *crtcs; |
1537 | DisplayModePtr *modes; | 1539 | DisplayModePtr *modes; |
@@ -1572,43 +1574,34 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) | |||
1572 | } | 1574 | } |
1573 | 1575 | ||
1574 | /* | 1576 | /* |
1575 | * Let outputs with preferred modes drive screen size | 1577 | * User preferred > preferred > other modes |
1576 | */ | 1578 | */ |
1577 | for (o = 0; o < config->num_output; o++) | 1579 | for (o = 0; o < config->num_output; o++) |
1578 | { | 1580 | { |
1579 | xf86OutputPtr output = config->output[o]; | 1581 | xf86OutputPtr output = config->output[o]; |
1582 | DisplayModePtr default_mode; | ||
1583 | int default_preferred; | ||
1580 | 1584 | ||
1581 | if (enabled[o] && | 1585 | if (!enabled[o]) |
1582 | xf86OutputHasPreferredMode (output, width, height)) | 1586 | continue; |
1587 | default_mode = xf86DefaultMode (output, width, height); | ||
1588 | if (!default_mode) | ||
1589 | continue; | ||
1590 | default_preferred = (((default_mode->type & M_T_PREFERRED) != 0) + | ||
1591 | ((default_mode->type & M_T_USERPREF) != 0)); | ||
1592 | if (default_preferred > target_preferred || !target_mode) | ||
1583 | { | 1593 | { |
1584 | target_mode = xf86DefaultMode (output, width, height); | 1594 | target_mode = default_mode; |
1595 | target_preferred = default_preferred; | ||
1585 | target_rotation = output->initial_rotation; | 1596 | target_rotation = output->initial_rotation; |
1586 | if (target_mode) | 1597 | config->compat_output = o; |
1587 | { | ||
1588 | modes[o] = target_mode; | ||
1589 | config->compat_output = o; | ||
1590 | break; | ||
1591 | } | ||
1592 | } | ||
1593 | } | ||
1594 | if (!target_mode) | ||
1595 | { | ||
1596 | for (o = 0; o < config->num_output; o++) | ||
1597 | { | ||
1598 | xf86OutputPtr output = config->output[o]; | ||
1599 | if (enabled[o]) | ||
1600 | { | ||
1601 | target_mode = xf86DefaultMode (output, width, height); | ||
1602 | target_rotation = output->initial_rotation; | ||
1603 | if (target_mode) | ||
1604 | { | ||
1605 | modes[o] = target_mode; | ||
1606 | config->compat_output = o; | ||
1607 | break; | ||
1608 | } | ||
1609 | } | ||
1610 | } | 1598 | } |
1611 | } | 1599 | } |
1600 | if (target_mode) | ||
1601 | modes[config->compat_output] = target_mode; | ||
1602 | /* | ||
1603 | * Fill in other output modes | ||
1604 | */ | ||
1612 | for (o = 0; o < config->num_output; o++) | 1605 | for (o = 0; o < config->num_output; o++) |
1613 | { | 1606 | { |
1614 | xf86OutputPtr output = config->output[o]; | 1607 | xf86OutputPtr output = config->output[o]; |
diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 9693e12bb..4c843cd83 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h | |||
@@ -39,6 +39,9 @@ | |||
39 | #ifndef M_T_DRIVER | 39 | #ifndef M_T_DRIVER |
40 | #define M_T_DRIVER 0x40 | 40 | #define M_T_DRIVER 0x40 |
41 | #endif | 41 | #endif |
42 | #ifndef M_T_USERPREF | ||
43 | #define M_T_USERPREF 0x80 | ||
44 | #endif | ||
42 | #ifndef HARDWARE_CURSOR_ARGB | 45 | #ifndef HARDWARE_CURSOR_ARGB |
43 | #define HARDWARE_CURSOR_ARGB 0x00004000 | 46 | #define HARDWARE_CURSOR_ARGB 0x00004000 |
44 | #endif | 47 | #endif |