xf86RandR12: Fix XF86VidModeSetGamma triggering a BadImplementation error
Commitb4e46c0444
("xfree86: Hook up colormaps and RandR 1.2 gamma code") dropped the providing of a pScrn->ChangeGamma callback from the xf86RandR12 code. Leaving pScrn->ChangeGamma NULL in most cases. This triggers the BadImplementation error in xf86ChangeGamma() : if (pScrn->ChangeGamma) return (*pScrn->ChangeGamma) (pScrn, gamma); return BadImplementation; Which causes X-apps using XF86VidModeSetGamma to crash with a X protocol error. This commit fixes this by re-introducing the xf86RandR12ChangeGamma helper removed by the commit and adjusting it to work with the new combined palette / gamma code. Fixes:b4e46c0444
("xfree86: Hook up colormaps and RandR 1.2 gamma code") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
a58dd678bf
commit
02ff0a5d7e
|
@ -1924,6 +1924,35 @@ xf86RandR12LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compatibility pScrn->ChangeGamma provider for ddx drivers which do not call
|
||||||
|
* xf86HandleColormaps(). Note such drivers really should be fixed to call
|
||||||
|
* xf86HandleColormaps() as this clobbers the per-CRTC gamma ramp of the CRTC
|
||||||
|
* assigned to the RandR compatibility output.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
xf86RandR12ChangeGamma(ScrnInfoPtr pScrn, Gamma gamma)
|
||||||
|
{
|
||||||
|
RRCrtcPtr randr_crtc = xf86CompatRRCrtc(pScrn);
|
||||||
|
int size;
|
||||||
|
|
||||||
|
if (!randr_crtc)
|
||||||
|
return Success;
|
||||||
|
|
||||||
|
size = max(0, randr_crtc->gammaSize);
|
||||||
|
if (!size)
|
||||||
|
return Success;
|
||||||
|
|
||||||
|
init_one_component(randr_crtc->gammaRed, size, gamma.red);
|
||||||
|
init_one_component(randr_crtc->gammaGreen, size, gamma.green);
|
||||||
|
init_one_component(randr_crtc->gammaBlue, size, gamma.blue);
|
||||||
|
xf86RandR12CrtcSetGamma(xf86ScrnToScreen(pScrn), randr_crtc);
|
||||||
|
|
||||||
|
pScrn->gamma = gamma;
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
static Bool
|
static Bool
|
||||||
xf86RandR12EnterVT(ScrnInfoPtr pScrn)
|
xf86RandR12EnterVT(ScrnInfoPtr pScrn)
|
||||||
{
|
{
|
||||||
|
@ -2123,6 +2152,7 @@ xf86RandR12Init12(ScreenPtr pScreen)
|
||||||
rp->rrProviderDestroy = xf86RandR14ProviderDestroy;
|
rp->rrProviderDestroy = xf86RandR14ProviderDestroy;
|
||||||
|
|
||||||
pScrn->PointerMoved = xf86RandR12PointerMoved;
|
pScrn->PointerMoved = xf86RandR12PointerMoved;
|
||||||
|
pScrn->ChangeGamma = xf86RandR12ChangeGamma;
|
||||||
|
|
||||||
randrp->orig_EnterVT = pScrn->EnterVT;
|
randrp->orig_EnterVT = pScrn->EnterVT;
|
||||||
pScrn->EnterVT = xf86RandR12EnterVT;
|
pScrn->EnterVT = xf86RandR12EnterVT;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user