diff options
Diffstat (limited to 'include/drm/drm_framebuffer.h')
-rw-r--r-- | include/drm/drm_framebuffer.h | 49 |
1 files changed, 37 insertions, 12 deletions
diff --git a/include/drm/drm_framebuffer.h b/include/drm/drm_framebuffer.h index 04c77eee9c20..45410ba0d4f7 100644 --- a/include/drm/drm_framebuffer.h +++ b/include/drm/drm_framebuffer.h | |||
@@ -101,8 +101,8 @@ struct drm_framebuffer_funcs { | |||
101 | * cleanup (like releasing the reference(s) on the backing GEM bo(s)) | 101 | * cleanup (like releasing the reference(s) on the backing GEM bo(s)) |
102 | * should be deferred. In cases like this, the driver would like to | 102 | * should be deferred. In cases like this, the driver would like to |
103 | * hold a ref to the fb even though it has already been removed from | 103 | * hold a ref to the fb even though it has already been removed from |
104 | * userspace perspective. See drm_framebuffer_reference() and | 104 | * userspace perspective. See drm_framebuffer_get() and |
105 | * drm_framebuffer_unreference(). | 105 | * drm_framebuffer_put(). |
106 | * | 106 | * |
107 | * The refcount is stored inside the mode object @base. | 107 | * The refcount is stored inside the mode object @base. |
108 | */ | 108 | */ |
@@ -204,25 +204,50 @@ void drm_framebuffer_cleanup(struct drm_framebuffer *fb); | |||
204 | void drm_framebuffer_unregister_private(struct drm_framebuffer *fb); | 204 | void drm_framebuffer_unregister_private(struct drm_framebuffer *fb); |
205 | 205 | ||
206 | /** | 206 | /** |
207 | * drm_framebuffer_reference - incr the fb refcnt | 207 | * drm_framebuffer_get - acquire a framebuffer reference |
208 | * @fb: framebuffer | 208 | * @fb: DRM framebuffer |
209 | * | ||
210 | * This function increments the framebuffer's reference count. | ||
211 | */ | ||
212 | static inline void drm_framebuffer_get(struct drm_framebuffer *fb) | ||
213 | { | ||
214 | drm_mode_object_get(&fb->base); | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * drm_framebuffer_put - release a framebuffer reference | ||
219 | * @fb: DRM framebuffer | ||
220 | * | ||
221 | * This function decrements the framebuffer's reference count and frees the | ||
222 | * framebuffer if the reference count drops to zero. | ||
223 | */ | ||
224 | static inline void drm_framebuffer_put(struct drm_framebuffer *fb) | ||
225 | { | ||
226 | drm_mode_object_put(&fb->base); | ||
227 | } | ||
228 | |||
229 | /** | ||
230 | * drm_framebuffer_reference - acquire a framebuffer reference | ||
231 | * @fb: DRM framebuffer | ||
209 | * | 232 | * |
210 | * This functions increments the fb's refcount. | 233 | * This is a compatibility alias for drm_framebuffer_get() and should not be |
234 | * used by new code. | ||
211 | */ | 235 | */ |
212 | static inline void drm_framebuffer_reference(struct drm_framebuffer *fb) | 236 | static inline void drm_framebuffer_reference(struct drm_framebuffer *fb) |
213 | { | 237 | { |
214 | drm_mode_object_reference(&fb->base); | 238 | drm_framebuffer_get(fb); |
215 | } | 239 | } |
216 | 240 | ||
217 | /** | 241 | /** |
218 | * drm_framebuffer_unreference - unref a framebuffer | 242 | * drm_framebuffer_unreference - release a framebuffer reference |
219 | * @fb: framebuffer to unref | 243 | * @fb: DRM framebuffer |
220 | * | 244 | * |
221 | * This functions decrements the fb's refcount and frees it if it drops to zero. | 245 | * This is a compatibility alias for drm_framebuffer_put() and should not be |
246 | * used by new code. | ||
222 | */ | 247 | */ |
223 | static inline void drm_framebuffer_unreference(struct drm_framebuffer *fb) | 248 | static inline void drm_framebuffer_unreference(struct drm_framebuffer *fb) |
224 | { | 249 | { |
225 | drm_mode_object_unreference(&fb->base); | 250 | drm_framebuffer_put(fb); |
226 | } | 251 | } |
227 | 252 | ||
228 | /** | 253 | /** |
@@ -248,9 +273,9 @@ static inline void drm_framebuffer_assign(struct drm_framebuffer **p, | |||
248 | struct drm_framebuffer *fb) | 273 | struct drm_framebuffer *fb) |
249 | { | 274 | { |
250 | if (fb) | 275 | if (fb) |
251 | drm_framebuffer_reference(fb); | 276 | drm_framebuffer_get(fb); |
252 | if (*p) | 277 | if (*p) |
253 | drm_framebuffer_unreference(*p); | 278 | drm_framebuffer_put(*p); |
254 | *p = fb; | 279 | *p = fb; |
255 | } | 280 | } |
256 | 281 | ||