]> git.baikalelectronics.ru Git - kernel.git/commit
drm: push modeset_lock_all into ->fb_create driver callbacks
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Mon, 10 Dec 2012 23:09:12 +0000 (00:09 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 20 Jan 2013 21:17:04 +0000 (22:17 +0100)
commitc37add70ab120d0a93700ea008ba38637f8b0eb1
tree4044c56d57bd6f47ae5c1bbd31d9b36ca77ed417
parent4bac72bfbccf8f9ce972af1d75e71e5bf9459924
drm: push modeset_lock_all into ->fb_create driver callbacks

And drop it where it's not needed. Most driver just lookup the gem
object, allocate an fb struct, fill in all the useful fields and then
register it with drm_framebuffer_init.

All of these operations are already separately locked, and since we
only put the fb into the fpriv->fbs list _after_ having called
->fb_create, we can't also race with rmfb. We can otoh race with other
ioctls that put the framebuffer to use, but all drivers have been
reorganized already to call drm_framebuffer_init last in the fb
creation sequence.

So essentially, we can completely remove any modeset locks from the
addfb ioctl paths. Yeah!

Also, reference-counting is solid - we get a reference from fb_create
which we transfer to the fpriv->fbs list. And after unlocking the
fpriv->fbs_lock we don't touch the framebuffer any longer. Furthermore
drm_framebuffer_init has added a 2nd reference for the idr lookup, and
any access through that table will do it's own refcounting.

Reviewed-by: Rob Clark <rob@ti.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_crtc.c