• Xi Ruoyao's avatar
    drm/i915: Ensure plane->state->fb stays in sync with plane->fb · 319c1d42
    Xi Ruoyao authored
    plane->state->fb and plane->fb should always reference the same FB so
    that atomic and legacy codepaths have the same view of display state.
    However, there are some places in kernel code that directly set
    plane->fb and neglect to update plane->state->fb. If we never do a
    successful update through the atomic pipeline, the RmFB cleanup code
    will look at the plane->state->fb pointer, which has never actually
    been set to a legitimate value, and try to clean it up, leading to
    BUG's.
    
    Add a quick helper function to synchronize plane->state->fb with
    plane->fb and call it everywhere the driver tries to manually set
    plane->fb outside of the atomic pipeline. In this function, use
    drm_atomic_set_fb_for_plane instead of writing plane->state->fb
    directly to keep the reference count right.
    
    This is modified from Matt Roper's patch to drm-intel-nightly with
    commit id
    
    commit afd65eb4
    Author: Matt Roper <matthew.d.roper@intel.com>
    Date:   Tue Feb 3 13:10:04 2015 -0800
    
        drm/i915: Ensure plane->state->fb stays in sync with plane->fb
    
    However this bug exists in mainline kernel too, so I created this to fix
    it in mainline kernel.
    
    A minor change is to use drm_atomic_set_fb_for_plane instead of update
    reference count manually.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=88909
    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=93711Signed-off-by: default avatarXi Ruoyao <xry111@outlook.com>
    Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
    [Jani: included the patch notes in the commit message]
    Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
    319c1d42
intel_display.c 388 KB