• Michel Dänzer's avatar
    xfree86: Hook up colormaps and RandR 1.2 gamma code v6 · b4e46c04
    Michel Dänzer authored
    Instead of breaking the former when the driver supports the latter,
    hook them up so that the hardware LUTs reflect the combination of the
    current colourmap and gamma states. I.e. combine the colourmap, the
    global gamma value/ramp and the RandR 1.2 per-CRTC gamma ramps into one
    combined LUT per CRTC.
    Fixes e.g. gamma sliders not working in games.
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=27222
    * Initialize palette_size and palette struct members, fixes crash on
      server startup.
    * Free randrp->palette in xf86RandR12CloseScreen, fixes memory leak.
    * Call CMapUnwrapScreen if xf86RandR12InitGamma fails (Emil Velikov).
    * Still allow xf86HandleColormaps to be called with a NULL loadPalette
      parameter in the xf86_crtc_supports_gamma case.
    * Clean up inner loops in xf86RandR12CrtcComputeGamma (Keith Packard)
    * Move palette update out of per-CRTC loop in xf86RandR12LoadPalette
      (Keith Packard)
    * Handle reallocarray failure in xf86RandR12LoadPalette (Keith Packard)
    Reviewed-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
xf86RandR12.c 64.5 KB