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 | |
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')
-rw-r--r-- | randr/randrstr.h | 12 | ||||
-rw-r--r-- | randr/rrcrtc.c | 35 |
2 files changed, 45 insertions, 2 deletions
diff --git a/randr/randrstr.h b/randr/randrstr.h index b868144d5..be596d4e8 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -173,6 +173,9 @@ typedef Bool (*RRCrtcSetProcPtr) (ScreenPtr pScreen, typedef Bool (*RRCrtcSetGammaProcPtr) (ScreenPtr pScreen, RRCrtcPtr crtc); +typedef Bool (*RRCrtcGetGammaProcPtr) (ScreenPtr pScreen, + RRCrtcPtr crtc); + typedef Bool (*RROutputSetPropertyProcPtr) (ScreenPtr pScreen, RROutputPtr output, Atom property, @@ -245,6 +248,7 @@ typedef struct _rrScrPriv { RRScreenSetSizeProcPtr rrScreenSetSize; RRCrtcSetProcPtr rrCrtcSet; RRCrtcSetGammaProcPtr rrCrtcSetGamma; + RRCrtcGetGammaProcPtr rrCrtcGetGamma; RROutputSetPropertyProcPtr rrOutputSetProperty; RROutputValidateModeProcPtr rrOutputValidateMode; RRModeDestroyProcPtr rrModeDestroy; @@ -586,6 +590,14 @@ RRCrtcGammaSet (RRCrtcPtr crtc, CARD16 *blue); /* + * Request current gamma back from the DDX (if possible). + * This includes gamma size. + */ + +extern _X_EXPORT Bool +RRCrtcGammaGet(RRCrtcPtr crtc); + +/* * Notify the extension that the Crtc gamma has been changed * The driver calls this whenever it has changed the gamma values * in the RRCrtcRec 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) { |