• Ville Syrjälä's avatar
    drm/i915: Add 10bit gamma mode for gen2/3 · 67630bac
    Ville Syrjälä authored
    Some gen2/gen3 parts have a 10bit gamma mode, on some pipes.
    Expose it.
    
    The format is different to the later i965+ style in that we
    store a 10bit value and a 6 bit floating point slope for each
    entry. Ie. the hardware extrapolates the intermediate steps
    from the current LUT entry, instead of interpolating between
    the current and next LUT entries. This also means we don't store
    the last LUT entry in any register as it is defined by the previous
    LUT entry's value+slope.
    
    The slope has limited precision though (2 bit exponent + 4 bit
    mantissa), so we'd have to allow for more error in the state checker
    for the last entry and we have to make sure userspace doesn't
    pass in something where the slope is simply to steep. In theory
    we should perhaps check the slope for every interval, but we don't
    do that for any other interpolated gamma mode and I suspect they
    may also have some internal limit on the slope. I haven't confirmed
    that theory though. Anyways, for ease of implementation we shall
    just ignore the last entry in the state checker. If all the other
    entries match anyway then that seems like a good indication that
    the hardware was programmed as expected.
    
    v2: Redo the state checker logic a bit
        Rebase due to other changes
    v3: Fix C8 readout
    v4: Use REG_FIELD_PREP()
    Acked-by: default avatarUma Shankar <uma.shankar@intel.com>
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20221114153732.11773-20-ville.syrjala@linux.intel.com
    67630bac
i915_pci.c 36.6 KB