diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2016-11-25 15:32:30 +0000 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-11-29 10:22:08 +0100 |
commit | 389f78b361fcdc52a9dbb5382c3922d80b52ed9f (patch) | |
tree | b0d3804f2c02c83be798b028be5aec0a48d8ed59 /include/drm/drm_framebuffer.h | |
parent | b2383fa3592061cda53b1650bf538b1d82add816 (diff) | |
download | linux-stable-389f78b361fcdc52a9dbb5382c3922d80b52ed9f.tar.gz linux-stable-389f78b361fcdc52a9dbb5382c3922d80b52ed9f.tar.bz2 linux-stable-389f78b361fcdc52a9dbb5382c3922d80b52ed9f.zip |
drm: Introduce drm_framebuffer_assign()
In a couple of places currently, and with the intent to add more, we
update a pointer to a framebuffer to hold a new fb reference (evicting
the old).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/20161125153231.13255-2-chris@chris-wilson.co.uk
Diffstat (limited to 'include/drm/drm_framebuffer.h')
-rw-r--r-- | include/drm/drm_framebuffer.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index b3141a0e609b..1ddfa2928802 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h @@ -251,6 +251,24 @@ static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) } /** + * drm_framebuffer_assign - store a reference to the fb + * @p: location to store framebuffer + * @fb: new framebuffer (maybe NULL) + * + * This functions sets the location to store a reference to the framebuffer, + * unreferencing the framebuffer that was previously stored in that location. + */ +static inline void drm_framebuffer_assign(struct drm_framebuffer **p, + struct drm_framebuffer *fb) +{ + if (fb) + drm_framebuffer_reference(fb); + if (*p) + drm_framebuffer_unreference(*p); + *p = fb; +} + +/* * drm_for_each_fb - iterate over all framebuffers * @fb: the loop cursor * @dev: the DRM device |