mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
drm: Introduce drm_framebuffer_{get,put}()
For consistency with other reference counting APIs in the kernel, add drm_framebuffer_get() and drm_framebuffer_put() to reference count DRM framebuffers. Compatibility aliases are added to keep existing code working. To help speed up the transition, all the instances of the old functions in the DRM core are already replaced in this commit. The existing semantic patch for the DRM subsystem-wide conversion is extended to account for these new helpers. Reviewed-by: Sean Paul <seanpaul@chromium.org> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Link: http://patchwork.freedesktop.org/patch/msgid/20170228144643.5668-5-thierry.reding@gmail.com
This commit is contained in:
parent
ad09360750
commit
a4a69da06b
7 changed files with 80 additions and 45 deletions
|
@ -101,8 +101,8 @@ struct drm_framebuffer_funcs {
|
|||
* cleanup (like releasing the reference(s) on the backing GEM bo(s))
|
||||
* should be deferred. In cases like this, the driver would like to
|
||||
* hold a ref to the fb even though it has already been removed from
|
||||
* userspace perspective. See drm_framebuffer_reference() and
|
||||
* drm_framebuffer_unreference().
|
||||
* userspace perspective. See drm_framebuffer_get() and
|
||||
* drm_framebuffer_put().
|
||||
*
|
||||
* The refcount is stored inside the mode object @base.
|
||||
*/
|
||||
|
@ -204,25 +204,50 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
|
|||
void drm_framebuffer_unregister_private(struct drm_framebuffer *fb);
|
||||
|
||||
/**
|
||||
* drm_framebuffer_reference - incr the fb refcnt
|
||||
* @fb: framebuffer
|
||||
* drm_framebuffer_get - acquire a framebuffer reference
|
||||
* @fb: DRM framebuffer
|
||||
*
|
||||
* This functions increments the fb's refcount.
|
||||
* This function increments the framebuffer's reference count.
|
||||
*/
|
||||
static inline void drm_framebuffer_reference(struct drm_framebuffer *fb)
|
||||
static inline void drm_framebuffer_get(struct drm_framebuffer *fb)
|
||||
{
|
||||
drm_mode_object_reference(&fb->base);
|
||||
drm_mode_object_get(&fb->base);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_framebuffer_unreference - unref a framebuffer
|
||||
* @fb: framebuffer to unref
|
||||
* drm_framebuffer_put - release a framebuffer reference
|
||||
* @fb: DRM framebuffer
|
||||
*
|
||||
* This functions decrements the fb's refcount and frees it if it drops to zero.
|
||||
* This function decrements the framebuffer's reference count and frees the
|
||||
* framebuffer if the reference count drops to zero.
|
||||
*/
|
||||
static inline void drm_framebuffer_put(struct drm_framebuffer *fb)
|
||||
{
|
||||
drm_mode_object_put(&fb->base);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_framebuffer_reference - acquire a framebuffer reference
|
||||
* @fb: DRM framebuffer
|
||||
*
|
||||
* This is a compatibility alias for drm_framebuffer_get() and should not be
|
||||
* used by new code.
|
||||
*/
|
||||
static inline void drm_framebuffer_reference(struct drm_framebuffer *fb)
|
||||
{
|
||||
drm_framebuffer_get(fb);
|
||||
}
|
||||
|
||||
/**
|
||||
* drm_framebuffer_unreference - release a framebuffer reference
|
||||
* @fb: DRM framebuffer
|
||||
*
|
||||
* This is a compatibility alias for drm_framebuffer_put() and should not be
|
||||
* used by new code.
|
||||
*/
|
||||
static inline void drm_framebuffer_unreference(struct drm_framebuffer *fb)
|
||||
{
|
||||
drm_mode_object_unreference(&fb->base);
|
||||
drm_framebuffer_put(fb);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -248,9 +273,9 @@ static inline void drm_framebuffer_assign(struct drm_framebuffer **p,
|
|||
struct drm_framebuffer *fb)
|
||||
{
|
||||
if (fb)
|
||||
drm_framebuffer_reference(fb);
|
||||
drm_framebuffer_get(fb);
|
||||
if (*p)
|
||||
drm_framebuffer_unreference(*p);
|
||||
drm_framebuffer_put(*p);
|
||||
*p = fb;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue