Skip to content

Commit

Permalink
Disable CRTC when SetSingleMode has no matching mode. Update RandR as…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
Keith Packard committed Apr 9, 2007
1 parent 7cf3a0e commit dc6c4f6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hw/xfree86/modes/xf86Crtc.c
Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -1817,6 +1817,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
Expand All @@ -1828,6 +1833,7 @@ xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
}
}
xf86DisableUnusedFunctions(pScrn);
xf86RandR12TellChanged (pScrn->pScreen);
return ok;
}

Expand Down
22 changes: 22 additions & 0 deletions hw/xfree86/modes/xf86RandR12.c
Expand Up @@ -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)
{
Expand Down
1 change: 1 addition & 0 deletions hw/xfree86/modes/xf86RandR12.h
Expand Up @@ -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_ */

0 comments on commit dc6c4f6

Please sign in to comment.