]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm: check that ->set_config properly updates the fb
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Fri, 14 Jun 2013 22:13:15 +0000 (00:13 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 25 Jun 2013 03:04:10 +0000 (13:04 +1000)
Historically drm lacked fb refcounting, so the updating of crtc->fb
was done by the lower levels at a point convenient to get their own
refcounting (e.g. refcounts for the underlying gem bo, pinning
refcounts) right. With the introduction of refcounted fbs the drm core
handled the fb refcounts, but still relied on drivers to update the
crtc->fb pointer (this approach required the least invasive changes in
drivers).

Enforce this contract with a WARN_ON.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_crtc.c

index c9f9f3ded9e1a6f7772362b1d0e4a518b3fe4d4f..a7dc1e266c989de11bdc6ca06fa7f5ff20b04293 100644 (file)
@@ -1980,6 +1980,9 @@ int drm_mode_set_config_internal(struct drm_mode_set *set)
 
        ret = crtc->funcs->set_config(set);
        if (ret == 0) {
+               /* crtc->fb must be updated by ->set_config, enforces this. */
+               WARN_ON(fb != crtc->fb);
+
                if (old_fb)
                        drm_framebuffer_unreference(old_fb);
                if (fb)