diff options
author | Maarten Maathuis <madman2003@gmail.com> | 2008-12-17 16:56:26 +0100 |
---|---|---|
committer | Maarten Maathuis <madman2003@gmail.com> | 2008-12-17 17:03:12 +0100 |
commit | 91f73b79b7ae64e5b846d1efeb470bb61a913720 (patch) | |
tree | be97d9678e27abb1399bfc98fb927f40cef1f561 /randr/rrcrtc.c | |
parent | 1556815d34cecb4b4b62d2a4ce813b1435a937ec (diff) |
randr: Improve per-crtc gamma support.
- The Gamma values from the monitor section are now used during initial config.
- The old colormap system is disabled when gamma set hook is available.
- Gamma values are now persistent for the lifetime of the xserver.
- This requires no driver changes and should be driver ABI compatible.
Diffstat (limited to 'randr/rrcrtc.c')
-rw-r--r-- | randr/rrcrtc.c | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index b504b0c9b..d8aa37b9c 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -480,6 +480,29 @@ RRCrtcGammaSet (RRCrtcPtr crtc, } /* + * Request current gamma back from the DDX (if possible). + * This includes gamma size. + */ +Bool +RRCrtcGammaGet(RRCrtcPtr crtc) +{ + Bool ret = TRUE; +#if RANDR_12_INTERFACE + ScreenPtr pScreen = crtc->pScreen; +#endif + +#if RANDR_12_INTERFACE + if (pScreen) + { + rrScrPriv(pScreen); + if (pScrPriv->rrCrtcGetGamma) + ret = (*pScrPriv->rrCrtcGetGamma) (pScreen, crtc); + } +#endif + return ret; +} + +/* * Notify the extension that the Crtc gamma has been changed * The driver calls this whenever it has changed the gamma values * in the RRCrtcRec @@ -1141,7 +1164,11 @@ ProcRRGetCrtcGammaSize (ClientPtr client) crtc = LookupCrtc (client, stuff->crtc, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; - + + /* Gamma retrieval failed, any better error? */ + if (!RRCrtcGammaGet(crtc)) + return RRErrorBase + BadRRCrtc; + reply.type = X_Reply; reply.sequenceNumber = client->sequence; reply.length = 0; @@ -1169,7 +1196,11 @@ ProcRRGetCrtcGamma (ClientPtr client) crtc = LookupCrtc (client, stuff->crtc, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; - + + /* Gamma retrieval failed, any better error? */ + if (!RRCrtcGammaGet(crtc)) + return RRErrorBase + BadRRCrtc; + len = crtc->gammaSize * 3 * 2; if (crtc->gammaSize) { |