diff options
author | Ben Byer <bbyer@bbyer.(none)> | 2007-03-06 01:04:50 -0800 |
---|---|---|
committer | Ben Byer <bbyer@bbyer.(none)> | 2007-03-06 01:04:50 -0800 |
commit | 0ccd1443fd6db397b42e5b99ce733ce1316c785e (patch) | |
tree | da7fc4bd2a98f411df89a7cbd909c0cc7944ccf8 /hw | |
parent | ec1ef8a56d6217ca2b04899043874ce0bcad9784 (diff) | |
parent | 9b6bb06f13a71f6078f762b4a78fa516faccb638 (diff) |
Merge branch 'master' of git+ssh://bbyer@git.freedesktop.org/git/xorg/xserver
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.c | 71 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.h | 8 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86RandR12.c | 24 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86Rename.h | 3 |
4 files changed, 99 insertions, 7 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 3d28293c8..46515fdcc 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -879,13 +879,17 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes) { xf86OutputPtr out_rel = config->output[or]; XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor; - char *name; if (rel_mon) - name = rel_mon->mon_identifier; - else - name = out_rel->name; - if (!strcmp (relative_name, name)) + { + if (xf86nameCompare (rel_mon->mon_identifier, + relative_name) == 0) + { + relative = config->output[or]; + break; + } + } + if (strcmp (out_rel->name, relative_name) == 0) { relative = config->output[or]; break; @@ -1542,6 +1546,63 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow) return TRUE; } +/* + * Using the desired mode information in each crtc, set + * modes (used in EnterVT functions, or at server startup) + */ + +Bool +xf86SetDesiredModes (ScrnInfoPtr scrn) +{ + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn); + int c; + + for (c = 0; c < config->num_crtc; c++) + { + xf86CrtcPtr crtc = config->crtc[c]; + xf86OutputPtr output = NULL; + int o; + + if (config->output[config->compat_output]->crtc == crtc) + output = config->output[config->compat_output]; + else + { + for (o = 0; o < config->num_output; o++) + if (config->output[o]->crtc == crtc) + { + output = config->output[o]; + break; + } + } + /* + * Skip disabled crtcs + */ + if (!output) + continue; + + /* Mark that we'll need to re-set the mode for sure */ + memset(&crtc->mode, 0, sizeof(crtc->mode)); + if (!crtc->desiredMode.CrtcHDisplay) + { + DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode); + + if (!mode) + return FALSE; + crtc->desiredMode = *mode; + crtc->desiredRotation = RR_Rotate_0; + crtc->desiredX = 0; + crtc->desiredY = 0; + } + + if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation, + crtc->desiredX, crtc->desiredY)) + return FALSE; + } + + xf86DisableUnusedFunctions(scrn); + return TRUE; +} + /** * In the current world order, there are lists of modes per output, which may * or may not include the mode that was asked to be set by XFree86's mode diff --git a/hw/xfree86/modes/xf86Crtc.h b/hw/xfree86/modes/xf86Crtc.h index 56c7769cf..062a2dbec 100644 --- a/hw/xfree86/modes/xf86Crtc.h +++ b/hw/xfree86/modes/xf86Crtc.h @@ -644,4 +644,12 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen); char * xf86ConnectorGetName(xf86ConnectorType connector); +/* + * Using the desired mode information in each crtc, set + * modes (used in EnterVT functions, or at server startup) + */ + +Bool +xf86SetDesiredModes (ScrnInfoPtr pScrn); + #endif /* _XF86CRTC_H_ */ diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 052d12aa3..ce780b6ef 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -422,8 +422,28 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen) } else { - mmWidth = pScreen->mmWidth; - mmHeight = pScreen->mmHeight; + xf86OutputPtr output = config->output[config->compat_output]; + xf86CrtcPtr crtc = output->crtc; + + if (crtc && crtc->mode.HDisplay && + output->mm_width && output->mm_height) + { + /* + * If the output has a mode and a declared size, use that + * to scale the screen size + */ + DisplayModePtr mode = &crtc->mode; + mmWidth = output->mm_width * width / mode->HDisplay; + mmHeight = output->mm_height * height / mode->VDisplay; + } + else + { + /* + * Otherwise, just set the screen to 96dpi + */ + mmWidth = width * 25.4 / 96; + mmHeight = height * 25.4 / 96; + } } xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Setting screen physical size to %d x %d\n", diff --git a/hw/xfree86/modes/xf86Rename.h b/hw/xfree86/modes/xf86Rename.h index 6cfa5caa1..eae6d64d5 100644 --- a/hw/xfree86/modes/xf86Rename.h +++ b/hw/xfree86/modes/xf86Rename.h @@ -76,5 +76,8 @@ #define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder) #define xf86ModeWidth XF86NAME(xf86ModeWidth) #define xf86ModeHeight XF86NAME(xf86ModeHeight) +#define xf86OutputFindClosestMode XF86NAME(xf86OutputFindClosestMode) +#define xf86SetSingleMode XF86NAME(xf86SetSingleMode) +#define xf86SetDesiredModes XF86NAME(xf86SetDesiredModes) #endif /* _XF86RENAME_H_ */ |