Commit 0f477c6d authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Greg Kroah-Hartman
Browse files

staging/android/sync: add sync_fence_create_dma

This allows users of dma fences to create a android fence.

v2: Added kerneldoc. (Tvrtko Ursulin).

v4: Updated comments from review feedback my Maarten.

Signed-off-by: default avatarMaarten Lankhorst <>
Signed-off-by: default avatarTvrtko Ursulin <>
Cc: Maarten Lankhorst <>
Cc: Daniel Vetter <>
Cc: Riley Andrews <>
Cc: Arve Hjønnevåg <>
Reviewed-by: default avatarJesse Barnes <>
Tested-by: default avatarJesse Barnes <>
Signed-off-by: default avatarGreg Kroah-Hartman <>
parent 73465f1c
......@@ -188,7 +188,7 @@ static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
/* TODO: implement a create which takes more that one sync_pt */
struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt)
struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt)
struct sync_fence *fence;
......@@ -199,16 +199,21 @@ struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt)
fence->num_fences = 1;
atomic_set(&fence->status, 1);
fence->cbs[0].sync_pt = &pt->base;
fence->cbs[0].sync_pt = pt;
fence->cbs[0].fence = fence;
if (fence_add_callback(&pt->base, &fence->cbs[0].cb,
if (fence_add_callback(pt, &fence->cbs[0].cb, fence_check_cb_func))
return fence;
struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt)
return sync_fence_create_dma(name, &pt->base);
struct sync_fence *sync_fence_fdget(int fd)
......@@ -254,6 +254,16 @@ void sync_pt_free(struct sync_pt *pt);
struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt);
* sync_fence_create_dma() - creates a sync fence from dma-fence
* @name: name of fence to create
* @pt: dma-fence to add to the fence
* Creates a fence containg @pt. Once this is called, the fence takes
* ownership of @pt.
struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt);
* API for sync_fence consumers
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment