diff options
author | Keith Packard <keithp@neko.keithp.com> | 2007-04-09 14:12:27 -0700 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2007-04-10 12:36:45 -0700 |
commit | bcf17df69a232e5e84609abacdca36274316e170 (patch) | |
tree | e963e121dd47b7d4df5c0d7899c14df68b879228 | |
parent | 67e1c98895a566f927e1ae2384d56cfca104f971 (diff) |
Disable CRTC when SetSingleMode has no matching mode. Update RandR as well.
xf86SetSingleMode tries to resize all crtcs to match the selected mode. When
a CRTC has no matching mode, it now disables the CRTC (instead of crashing).
Also, poke the RandR extension when xf86SetSingleMode is done so that
appropriate events can be delivered, and so that future RandR queries return
correct information.
(cherry picked from commit dc6c4f6989f87149d8605604f4514f5cbf11de67)
-rw-r--r-- | hw/xfree86/modes/xf86Crtc.c | 10 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86RandR12.c | 22 | ||||
-rw-r--r-- | hw/xfree86/modes/xf86RandR12.h | 1 |
3 files changed, 31 insertions, 2 deletions
diff --git a/hw/xfree86/modes/xf86Crtc.c b/hw/xfree86/modes/xf86Crtc.c index 0fe03d372..7e7c7e7ec 100644 --- a/hw/xfree86/modes/xf86Crtc.c +++ b/hw/xfree86/modes/xf86Crtc.c @@ -233,8 +233,6 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, int saved_x, saved_y; Rotation saved_rotation; - adjusted_mode = xf86DuplicateMode(mode); - crtc->enabled = xf86CrtcInUse (crtc); if (!crtc->enabled) @@ -243,6 +241,8 @@ xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, return TRUE; } + adjusted_mode = xf86DuplicateMode(mode); + didLock = crtc->funcs->lock (crtc); saved_mode = crtc->mode; @@ -1833,6 +1833,11 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) else crtc_mode = xf86OutputFindClosestMode (output, desired); } + if (!crtc_mode) + { + crtc->enabled = FALSE; + continue; + } if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0)) ok = FALSE; else @@ -1844,6 +1849,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation) } } xf86DisableUnusedFunctions(pScrn); + xf86RandR12TellChanged (pScrn->pScreen); return ok; } diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c index 6f52ee2d9..90de585f5 100644 --- a/hw/xfree86/modes/xf86RandR12.c +++ b/hw/xfree86/modes/xf86RandR12.c @@ -1048,6 +1048,28 @@ xf86RandR12CreateScreenResources12 (ScreenPtr pScreen) return TRUE; } +/* + * Something happened within the screen configuration due + * to DGA, VidMode or hot key. Tell RandR + */ + +void +xf86RandR12TellChanged (ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn); + XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + int c; + + if (!randrp) + return; + xf86RandR12SetInfo12 (pScreen); + for (c = 0; c < config->num_crtc; c++) + xf86RandR12CrtcNotify (config->crtc[c]->randr_crtc); + + RRTellChanged (pScreen); +} + static void xf86RandR12PointerMoved (int scrnIndex, int x, int y) { diff --git a/hw/xfree86/modes/xf86RandR12.h b/hw/xfree86/modes/xf86RandR12.h index 8a4668b46..0d3346a77 100644 --- a/hw/xfree86/modes/xf86RandR12.h +++ b/hw/xfree86/modes/xf86RandR12.h @@ -33,5 +33,6 @@ Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, Rotation xf86RandR12GetRotation(ScreenPtr pScreen); void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); Bool xf86RandR12PreInit (ScrnInfoPtr pScrn); +void xf86RandR12TellChanged (ScreenPtr pScreen); #endif /* _XF86_RANDR_H_ */ |