diff options
| author | Daniel Stone <daniels@collabora.com> | 2015-04-20 14:22:55 -0400 |
|---|---|---|
| committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2015-05-12 05:02:31 -0400 |
| commit | 6bcacf51d050d412e5c302e0dd5e582212c5f7be (patch) | |
| tree | 956a2c92002fd70ab7dfbe44534892009f677222 /include/drm | |
| parent | 8fb6e7a579670d5b71fc0d5641c1523b3df612e8 (diff) | |
drm: Add reference counting to blob properties
Reference-count drm_property_blob objects, changing the API to
ref/unref.
Signed-off-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
[danvet: Squash in kerneldoc fixup from Daniel Stone.]
[danvet: Squash in Oops fix from Thiery Reding.]
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'include/drm')
| -rw-r--r-- | include/drm/drm_crtc.h | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index 55ed8f9f45be..5626191f3af0 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
| @@ -216,6 +216,8 @@ struct drm_framebuffer { | |||
| 216 | 216 | ||
| 217 | struct drm_property_blob { | 217 | struct drm_property_blob { |
| 218 | struct drm_mode_object base; | 218 | struct drm_mode_object base; |
| 219 | struct drm_device *dev; | ||
| 220 | struct kref refcount; | ||
| 219 | struct list_head head; | 221 | struct list_head head; |
| 220 | size_t length; | 222 | size_t length; |
| 221 | unsigned char data[]; | 223 | unsigned char data[]; |
| @@ -1365,6 +1367,13 @@ struct drm_property *drm_property_create_object(struct drm_device *dev, | |||
| 1365 | int flags, const char *name, uint32_t type); | 1367 | int flags, const char *name, uint32_t type); |
| 1366 | struct drm_property *drm_property_create_bool(struct drm_device *dev, int flags, | 1368 | struct drm_property *drm_property_create_bool(struct drm_device *dev, int flags, |
| 1367 | const char *name); | 1369 | const char *name); |
| 1370 | struct drm_property_blob *drm_property_create_blob(struct drm_device *dev, | ||
| 1371 | size_t length, | ||
| 1372 | const void *data); | ||
| 1373 | struct drm_property_blob *drm_property_lookup_blob(struct drm_device *dev, | ||
| 1374 | uint32_t id); | ||
| 1375 | struct drm_property_blob *drm_property_reference_blob(struct drm_property_blob *blob); | ||
| 1376 | void drm_property_unreference_blob(struct drm_property_blob *blob); | ||
| 1368 | extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); | 1377 | extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property); |
| 1369 | extern int drm_property_add_enum(struct drm_property *property, int index, | 1378 | extern int drm_property_add_enum(struct drm_property *property, int index, |
| 1370 | uint64_t value, const char *name); | 1379 | uint64_t value, const char *name); |
| @@ -1528,14 +1537,6 @@ static inline struct drm_property *drm_property_find(struct drm_device *dev, | |||
| 1528 | return mo ? obj_to_property(mo) : NULL; | 1537 | return mo ? obj_to_property(mo) : NULL; |
| 1529 | } | 1538 | } |
| 1530 | 1539 | ||
| 1531 | static inline struct drm_property_blob * | ||
| 1532 | drm_property_blob_find(struct drm_device *dev, uint32_t id) | ||
| 1533 | { | ||
| 1534 | struct drm_mode_object *mo; | ||
| 1535 | mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_BLOB); | ||
| 1536 | return mo ? obj_to_blob(mo) : NULL; | ||
| 1537 | } | ||
| 1538 | |||
| 1539 | /* Plane list iterator for legacy (overlay only) planes. */ | 1540 | /* Plane list iterator for legacy (overlay only) planes. */ |
| 1540 | #define drm_for_each_legacy_plane(plane, planelist) \ | 1541 | #define drm_for_each_legacy_plane(plane, planelist) \ |
| 1541 | list_for_each_entry(plane, planelist, head) \ | 1542 | list_for_each_entry(plane, planelist, head) \ |
