compositor-drm: Refcount drm_fb
authorDaniel Stone <daniels@collabora.com>
Tue, 4 Apr 2017 16:54:26 +0000 (17:54 +0100)
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>
Fri, 7 Apr 2017 09:45:12 +0000 (12:45 +0300)
commit6e7a961d43ca4f8a4708118c2c770f3ec769c082
tree20ffc1876a9cb722afbd9cef61330e2de70e2666
parent05a5ac2b8f5a7e702913f9cf78e79673a819f4ff
compositor-drm: Refcount drm_fb

Sometimes we need to duplicate an existing drm_fb, e.g. when
pageflipping to the same buffer to kickstart the repaint loop. To handle
situations like these, and simplify resource management for dumb and
cursor buffers, refcount drm_fb.

drm_fb_get_from_bo has a path where it may reuse a drm_fb, if the BO has
been imported and not released yet. As drm_fb_unref now relies on actual
refcounting (backed up by asserts), we add a balancing drm_fb_ref() to
the path where we return a reused drm_fb.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
libweston/compositor-drm.c