• Daniel Vetter's avatar
    drm: fix fb leak in setcrtc · 5cef29aa
    Daniel Vetter authored
    Drivers are allowed (actually have to) disable unrelated crtcs in
    their ->set_config callback (when we steal all the connectors from
    that crtc). If they do that they'll clear crtc->fb to NULL.
    
    Which results in a refcount leak, since the drm core is keeping track
    of that reference.
    
    To fix this track the old fb of all crtcs and adjust references for
    all of them. Of course, since we only hold an additional reference for
    the fb for the current crtc we need to increase refcounts before we
    drop the old one.
    
    This approach has the benefit that it inches us a bit closer to an
    atomic modeset world, where we want to update the config of all crtcs
    in one step.
    
    This regression has been introduce in the framebuffer refcount
    conversion, specifically in
    
    commit b0d12325
    Author: Daniel Vetter <daniel.vetter@ffwll.ch>
    Date:   Tue Dec 11 01:07:12 2012 +0100
    
        drm: refcounting for crtc framebuffers
    Reported-by: default avatarRussell King <linux@arm.linux.org.uk>
    Cc: Russell King <linux@arm.linux.org.uk>
    Cc: stable@vger.kernel.org
    Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
    Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
    5cef29aa
drm_crtc.h 39.2 KB