mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
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
This commit is contained in:
committed by
Daniel Vetter
parent
b2383fa359
commit
389f78b361
@@ -1246,18 +1246,14 @@ void
|
|||||||
drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
|
drm_atomic_set_fb_for_plane(struct drm_plane_state *plane_state,
|
||||||
struct drm_framebuffer *fb)
|
struct drm_framebuffer *fb)
|
||||||
{
|
{
|
||||||
if (plane_state->fb)
|
|
||||||
drm_framebuffer_unreference(plane_state->fb);
|
|
||||||
if (fb)
|
|
||||||
drm_framebuffer_reference(fb);
|
|
||||||
plane_state->fb = fb;
|
|
||||||
|
|
||||||
if (fb)
|
if (fb)
|
||||||
DRM_DEBUG_ATOMIC("Set [FB:%d] for plane state %p\n",
|
DRM_DEBUG_ATOMIC("Set [FB:%d] for plane state %p\n",
|
||||||
fb->base.id, plane_state);
|
fb->base.id, plane_state);
|
||||||
else
|
else
|
||||||
DRM_DEBUG_ATOMIC("Set [NOFB] for plane state %p\n",
|
DRM_DEBUG_ATOMIC("Set [NOFB] for plane state %p\n",
|
||||||
plane_state);
|
plane_state);
|
||||||
|
|
||||||
|
drm_framebuffer_assign(&plane_state->fb, fb);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(drm_atomic_set_fb_for_plane);
|
EXPORT_SYMBOL(drm_atomic_set_fb_for_plane);
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
* drm_for_each_fb - iterate over all framebuffers
|
||||||
* @fb: the loop cursor
|
* @fb: the loop cursor
|
||||||
* @dev: the DRM device
|
* @dev: the DRM device
|
||||||
|
|||||||
Reference in New Issue
Block a user