Message ID | 1417636147-29664-2-git-send-email-jbarnes@virtuousgeek.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi, On 12/03/2014 07:49 PM, Jesse Barnes wrote: > From: Maarten Lankhorst <maarten.lankhorst@canonical.com> > > This allows users of dma fences to create a android fence. I couldn't figure out the motivation here vs. just exporting sync_fence_create ? Regards, Tvrtko > Cc: Daniel Vetter <daniel@ffwll.ch> > Cc: Jesse Barnes <jbarnes@virtuousgeek.org> > Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com> > --- > drivers/staging/android/sync.c | 13 +++++++++---- > drivers/staging/android/sync.h | 3 ++- > 2 files changed, 11 insertions(+), 5 deletions(-) > > diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c > index 7bdb62b..0ee333e 100644 > --- a/drivers/staging/android/sync.c > +++ b/drivers/staging/android/sync.c > @@ -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, > - fence_check_cb_func)) > + if (fence_add_callback(pt, &fence->cbs[0].cb, fence_check_cb_func)) > atomic_dec(&fence->status); > > sync_fence_debug_add(fence); > > return fence; > } > +EXPORT_SYMBOL(sync_fence_create_dma); > + > +struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) > +{ > + return sync_fence_create_dma(name, &pt->base); > +} > EXPORT_SYMBOL(sync_fence_create); > > struct sync_fence *sync_fence_fdget(int fd) > diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h > index a21b79f..50052e4 100644 > --- a/drivers/staging/android/sync.h > +++ b/drivers/staging/android/sync.h > @@ -250,8 +250,9 @@ void sync_pt_free(struct sync_pt *pt); > * @pt: sync_pt to add to the fence > * > * Creates a fence containg @pt. Once this is called, the fence takes > - * ownership of @pt. > + * a reference on @pt. > */ > +struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt); > struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt); > > /* >
Hey, On 14-01-15 15:09, Tvrtko Ursulin wrote: > > Hi, > > On 12/03/2014 07:49 PM, Jesse Barnes wrote: >> From: Maarten Lankhorst <maarten.lankhorst@canonical.com> >> >> This allows users of dma fences to create a android fence. > > I couldn't figure out the motivation here vs. just exporting sync_fence_create ? Keeping the api compatible with android. They were the first users of sync_fence_create, the conversion of android userspace fences to use fences in kernelspace was done later. ~Maarten
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 7bdb62b..0ee333e 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -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, - fence_check_cb_func)) + if (fence_add_callback(pt, &fence->cbs[0].cb, fence_check_cb_func)) atomic_dec(&fence->status); sync_fence_debug_add(fence); return fence; } +EXPORT_SYMBOL(sync_fence_create_dma); + +struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt) +{ + return sync_fence_create_dma(name, &pt->base); +} EXPORT_SYMBOL(sync_fence_create); struct sync_fence *sync_fence_fdget(int fd) diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h index a21b79f..50052e4 100644 --- a/drivers/staging/android/sync.h +++ b/drivers/staging/android/sync.h @@ -250,8 +250,9 @@ void sync_pt_free(struct sync_pt *pt); * @pt: sync_pt to add to the fence * * Creates a fence containg @pt. Once this is called, the fence takes - * ownership of @pt. + * a reference on @pt. */ +struct sync_fence *sync_fence_create_dma(const char *name, struct fence *pt); struct sync_fence *sync_fence_create(const char *name, struct sync_pt *pt); /*