• Mario Kleiner's avatar
    xfree86: Let xf86RandR12CrtcComputeGamma() deal with non-power-of-2 sizes. · 9124ef09
    Mario Kleiner authored
    
    
    The assumption in the upsampling code was that the crtc->gamma_size
    size of the crtc's gamma table is a power of two. This is true for
    almost all current driver + gpu combos at least on Linux, with typical
    sizes of 256, 512, 1024 or 4096 slots.
    
    However, Intel Gen-11 Icelake and later are outliers, as their gamma
    table has 2^18 + 1 slots, very big and not a power of two!
    
    Try to make upsampling behave at least reasonable: Replicate the
    last gamma value to fill up remaining crtc->gamma_red/green/blue
    slots, which would normally stay uninitialized. This is important,
    because while the intel display driver does not actually use all
    2^18+1 values passed as part of a GAMMA_LUT, it does need the
    very last slot, which would not get initialized by the old code.
    
    This should hopefully create reasonable behaviour with Icelake+
    but is untested on the actual Intel hw due to lack of suitable
    hw.
    Signed-off-by: Mario Kleiner's avatarMario Kleiner <mario.kleiner.de@gmail.com>
    9124ef09