randr12: Add compatibility for XF86VidMode gamma ramps.

Fixes screensaver fadeout effects.

Also make all RandR 1.2 compatibility code for XF86VidMode operate only on the
CRTC associated with the compatibility output, not all CRTCs at once.
This commit is contained in:
Michel Dänzer 2009-07-21 14:34:47 +02:00
commit 9dc8106ba0
2 changed files with 45 additions and 12 deletions

View file

@ -999,6 +999,18 @@ xf86ChangeGammaRamp(
CMapScreenPtr pScreenPriv;
CMapLinkPtr pLink;
if (xf86_crtc_supports_gamma(pScrn)) {
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
if (crtc->gammaSize != size)
return BadValue;
RRCrtcGammaSet(crtc, red, green, blue);
return Success;
}
if(CMapScreenKey == NULL)
return BadImplementation;
@ -1057,8 +1069,16 @@ xf86ChangeGammaRamp(
int
xf86GetGammaRampSize(ScreenPtr pScreen)
{
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
CMapScreenPtr pScreenPriv;
if (xf86_crtc_supports_gamma(pScrn)) {
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
return crtc->gammaSize;
}
if(CMapScreenKey == NULL) return 0;
pScreenPriv = (CMapScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
@ -1076,10 +1096,28 @@ xf86GetGammaRamp(
unsigned short *green,
unsigned short *blue
){
ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
CMapScreenPtr pScreenPriv;
LOCO *entry;
int shift, sigbits;
if (xf86_crtc_supports_gamma(pScrn)) {
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
if (crtc->gammaSize < size)
return BadValue;
if (!RRCrtcGammaGet(crtc))
return BadImplementation;
memcpy(red, crtc->gammaRed, size * sizeof(*red));
memcpy(green, crtc->gammaGreen, size * sizeof(*green));
memcpy(blue, crtc->gammaBlue, size * sizeof(*blue));
return Success;
}
if(CMapScreenKey == NULL)
return BadImplementation;