|
29 | 29 | /** |
30 | 30 | * DOC: Overview |
31 | 31 | * |
32 | | - * DRM synchronisation objects (syncobj) are a persistent objects, |
33 | | - * that contain an optional fence. The fence can be updated with a new |
34 | | - * fence, or be NULL. |
| 32 | + * DRM synchronisation objects (syncobj, see struct &drm_syncobj) are |
| 33 | + * persistent objects that contain an optional fence. The fence can be updated |
| 34 | + * with a new fence, or be NULL. |
35 | 35 | * |
36 | 36 | * syncobj's can be waited upon, where it will wait for the underlying |
37 | 37 | * fence. |
|
61 | 61 | * @file_private: drm file private pointer |
62 | 62 | * @handle: sync object handle to lookup. |
63 | 63 | * |
64 | | - * Returns a reference to the syncobj pointed to by handle or NULL. |
| 64 | + * Returns a reference to the syncobj pointed to by handle or NULL. The |
| 65 | + * reference must be released by calling drm_syncobj_put(). |
65 | 66 | */ |
66 | 67 | struct drm_syncobj *drm_syncobj_find(struct drm_file *file_private, |
67 | 68 | u32 handle) |
@@ -229,6 +230,19 @@ static int drm_syncobj_assign_null_handle(struct drm_syncobj *syncobj) |
229 | 230 | return 0; |
230 | 231 | } |
231 | 232 |
|
| 233 | +/** |
| 234 | + * drm_syncobj_find_fence - lookup and reference the fence in a sync object |
| 235 | + * @file_private: drm file private pointer |
| 236 | + * @handle: sync object handle to lookup. |
| 237 | + * @fence: out parameter for the fence |
| 238 | + * |
| 239 | + * This is just a convenience function that combines drm_syncobj_find() and |
| 240 | + * drm_syncobj_fence_get(). |
| 241 | + * |
| 242 | + * Returns 0 on success or a negative error value on failure. On success @fence |
| 243 | + * contains a reference to the fence, which must be released by calling |
| 244 | + * dma_fence_put(). |
| 245 | + */ |
232 | 246 | int drm_syncobj_find_fence(struct drm_file *file_private, |
233 | 247 | u32 handle, |
234 | 248 | struct dma_fence **fence) |
@@ -269,6 +283,12 @@ EXPORT_SYMBOL(drm_syncobj_free); |
269 | 283 | * @out_syncobj: returned syncobj |
270 | 284 | * @flags: DRM_SYNCOBJ_* flags |
271 | 285 | * @fence: if non-NULL, the syncobj will represent this fence |
| 286 | + * |
| 287 | + * This is the first function to create a sync object. After creating, drivers |
| 288 | + * probably want to make it available to userspace, either through |
| 289 | + * drm_syncobj_get_handle() or drm_syncobj_get_fd(). |
| 290 | + * |
| 291 | + * Returns 0 on success or a negative error value on failure. |
272 | 292 | */ |
273 | 293 | int drm_syncobj_create(struct drm_syncobj **out_syncobj, uint32_t flags, |
274 | 294 | struct dma_fence *fence) |
@@ -302,6 +322,14 @@ EXPORT_SYMBOL(drm_syncobj_create); |
302 | 322 |
|
303 | 323 | /** |
304 | 324 | * drm_syncobj_get_handle - get a handle from a syncobj |
| 325 | + * @file_private: drm file private pointer |
| 326 | + * @syncobj: Sync object to export |
| 327 | + * @handle: out parameter with the new handle |
| 328 | + * |
| 329 | + * Exports a sync object created with drm_syncobj_create() as a handle on |
| 330 | + * @file_private to userspace. |
| 331 | + * |
| 332 | + * Returns 0 on success or a negative error value on failure. |
305 | 333 | */ |
306 | 334 | int drm_syncobj_get_handle(struct drm_file *file_private, |
307 | 335 | struct drm_syncobj *syncobj, u32 *handle) |
@@ -388,6 +416,15 @@ static int drm_syncobj_alloc_file(struct drm_syncobj *syncobj) |
388 | 416 | return 0; |
389 | 417 | } |
390 | 418 |
|
| 419 | +/** |
| 420 | + * drm_syncobj_get_fd - get a file descriptor from a syncobj |
| 421 | + * @syncobj: Sync object to export |
| 422 | + * @p_fd: out parameter with the new file descriptor |
| 423 | + * |
| 424 | + * Exports a sync object created with drm_syncobj_create() as a file descriptor. |
| 425 | + * |
| 426 | + * Returns 0 on success or a negative error value on failure. |
| 427 | + */ |
391 | 428 | int drm_syncobj_get_fd(struct drm_syncobj *syncobj, int *p_fd) |
392 | 429 | { |
393 | 430 | int ret; |
|
0 commit comments