• Ville Syrjälä's avatar
    drm/i915: Preload LUTs if the hw isn't currently using them · 0ccc42a2
    Ville Syrjälä authored
    The LUTs are single buffered so in order to program them without
    tearing we'd have to do it during vblank (actually to be 100%
    effective it has to happen between start of vblank and frame start).
    We have no proper mechanism for that at the moment so we just
    defer loading them after the vblank waits have happened. That
    is not quite sufficient (especially when committing multiple pipes
    whose vblanks don't line up) so the LUT load will often leak into
    the following frame causing tearing.
    
    However in case the hardware wasn't previously using the LUT we
    can preload it before setting the enable bit (which is double
    buffered so won't tear). Let's determine if we can do such
    preloading and make it happen. Slight variation between the
    hardware requires some platforms specifics in the checks.
    
    Hans is seeing ugly colored flash on VLV/CHV macchines (GPD win
    and Asus T100HA) when the gamma LUT gets loaded for the first
    time as the BIOS has left some junk in the LUT memory.
    
    v2: Deal with uapi vs. hw crtc state split
        s/GCM/CGM/ typo fix
    
    Cc: Hans de Goede <hdegoede@redhat.com>
    Fixes: 051a6d8d ("drm/i915: Move LUT programming to happen after vblank waits")
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20191030190815.7359-1-ville.syrjala@linux.intel.comTested-by: default avatarHans de Goede <hdegoede@redhat.com>
    Reviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
    0ccc42a2
intel_atomic.c 15.9 KB