diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-08-31 18:09:04 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-09-19 15:03:46 +0200 |
commit | afb21ea63d815d05f6081ee3efef6772a16317eb (patch) | |
tree | d0dbbad659da899e64778ae531efc11857fd6237 /include/drm/drm_framebuffer.h | |
parent | drm: cleanup drm_core_{init,exit}() (diff) | |
download | linux-afb21ea63d815d05f6081ee3efef6772a16317eb.tar.xz linux-afb21ea63d815d05f6081ee3efef6772a16317eb.zip |
drm: Move a few macros away from drm_crtc.h
Now that there's less stuff in there I noticed that I overlooked them.
Sprinkle some docs over them while at it.
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20160831160913.12991-2-daniel.vetter@ffwll.ch
Diffstat (limited to 'include/drm/drm_framebuffer.h')
-rw-r--r-- | include/drm/drm_framebuffer.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index b2554c50a903..f5ae1f436a4b 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h @@ -206,6 +206,8 @@ struct drm_framebuffer { struct list_head filp_head; }; +#define obj_to_fb(x) container_of(x, struct drm_framebuffer, base) + int drm_framebuffer_init(struct drm_device *dev, struct drm_framebuffer *fb, const struct drm_framebuffer_funcs *funcs); @@ -247,4 +249,19 @@ static inline uint32_t drm_framebuffer_read_refcount(struct drm_framebuffer *fb) { return atomic_read(&fb->base.refcount.refcount); } + +/** + * drm_for_each_fb - iterate over all framebuffers + * @fb: the loop cursor + * @dev: the DRM device + * + * Iterate over all framebuffers of @dev. User must hold the fb_lock from + * &drm_mode_config. + */ +#define drm_for_each_fb(fb, dev) \ + for (WARN_ON(!mutex_is_locked(&(dev)->mode_config.fb_lock)), \ + fb = list_first_entry(&(dev)->mode_config.fb_list, \ + struct drm_framebuffer, head); \ + &fb->head != (&(dev)->mode_config.fb_list); \ + fb = list_next_entry(fb, head)) #endif |