drm/modes: move reference taking into object lookup.
authorDave Airlie <airlied@redhat.com>
Fri, 15 Apr 2016 05:10:40 +0000 (15:10 +1000)
committerDave Airlie <airlied@redhat.com>
Fri, 22 Apr 2016 00:42:54 +0000 (10:42 +1000)
commit72fe90b8e72e3f759164d2b4b5c60617a8a1a93e
treeb642708fbe03ce2eabb4f021b3d82a1d2c595082
parentc7e1c59a18ef84df09c06bd484e4ee470f839f92
drm/modes: move reference taking into object lookup.

When we lookup an ref counted object we now take a proper reference
using kref_get_unless_zero.

Framebuffer lookup no longer needs do this itself.

Convert rmfb to using framebuffer lookup and deal with the fact
it now gets an extra reference that we have to cleanup. This should
mean we can avoid holding fb_lock across rmfb. (if I'm wrong let me
know).

We also now only hold the fbs_lock around the list manipulation.

"Previously fb refcounting, and especially the weak reference
(kref_get_unless_zero) used in fb lookups have been protected by fb_lock.
But with the refactoring to share refcounting in the drm_mode_object base
class that switched to being protected by idr_mutex, which means fb_lock
critical sections can be reduced."

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