summaryrefslogtreecommitdiff
path: root/hw/xfree86/modes/xf86RandR12.c
diff options
context:
space:
mode:
authorMichel Dänzer <daenzer@vmware.com>2009-07-21 14:34:47 +0200
committerMichel Dänzer <daenzer@vmware.com>2009-07-21 14:34:47 +0200
commit9dc8106ba095474fea1474622b0f0162c8fd5aa4 (patch)
treed8ffbbcdea01f41b5d22c657038a54e195a78279 /hw/xfree86/modes/xf86RandR12.c
parent268e227ba06c027f5c56b1aaee5dcc6a2034403f (diff)
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.
Diffstat (limited to 'hw/xfree86/modes/xf86RandR12.c')
-rw-r--r--hw/xfree86/modes/xf86RandR12.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/hw/xfree86/modes/xf86RandR12.c b/hw/xfree86/modes/xf86RandR12.c
index 0de21e253..c2465bce3 100644
--- a/hw/xfree86/modes/xf86RandR12.c
+++ b/hw/xfree86/modes/xf86RandR12.c
@@ -1718,13 +1718,11 @@ gamma_to_ramp(float gamma, CARD16 *ramp, int size)
static int
xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
{
- int i, size = 0;
CARD16 *points, *red, *green, *blue;
ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- rrScrPrivPtr rp = rrGetScrPriv(pScrn->pScreen);
-
- for (i = 0; i < rp->numCrtcs; i++)
- size = max(size, rp->crtcs[i]->gammaSize);
+ xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
+ RRCrtcPtr crtc = config->output[config->compat_output]->crtc->randr_crtc;
+ int size = max(0, crtc->gammaSize);
if (!size)
return Success;
@@ -1737,13 +1735,10 @@ xf86RandR12ChangeGamma(int scrnIndex, Gamma gamma)
green = points + size;
blue = points + 2 * size;
- for (i = 0; i < rp->numCrtcs; i++) {
- gamma_to_ramp(gamma.red, red, rp->crtcs[i]->gammaSize);
- gamma_to_ramp(gamma.green, green, rp->crtcs[i]->gammaSize);
- gamma_to_ramp(gamma.blue, blue, rp->crtcs[i]->gammaSize);
- RRCrtcGammaSet(rp->crtcs[i], red, green, blue);
- memset(points, 0, 3 * size * sizeof(CARD16));
- }
+ gamma_to_ramp(gamma.red, red, size);
+ gamma_to_ramp(gamma.green, green, size);
+ gamma_to_ramp(gamma.blue, blue, size);
+ RRCrtcGammaSet(crtc, red, green, blue);
xfree(points);