Skip to content
  • Michel Dänzer's avatar
    xfree86: Hook up colormaps and RandR 1.2 gamma code v6 · b4e46c04
    Michel Dänzer authored and Michel Dänzer's avatar Michel Dänzer committed
    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
    
    
    
    v2:
    * Initialize palette_size and palette struct members, fixes crash on
      server startup.
    v3:
    * Free randrp->palette in xf86RandR12CloseScreen, fixes memory leak.
    v4:
    * 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.
    v5:
    * Clean up inner loops in xf86RandR12CrtcComputeGamma (Keith Packard)
    * Move palette update out of per-CRTC loop in xf86RandR12LoadPalette
      (Keith Packard)
    v6:
    * Handle reallocarray failure in xf86RandR12LoadPalette (Keith Packard)
    
    Reviewed-by: default avatarKeith Packard <keithp@keithp.com>
    b4e46c04