From bcf60a22c3e8671468517d34aa37548272455c1f Mon Sep 17 00:00:00 2001 From: Lauri Peltonen Date: Fri, 18 Jul 2014 02:21:34 +0300 Subject: gpu: nvgpu: Add gk20a_fence type When moving compression state tracking and compbit management ops to kernel, we need to attach a fence to dma-buf metadata, along with the compbit state. To make in-kernel fence management easier, introduce a new gk20a_fence abstraction. A gk20a_fence may be backed by a semaphore or a syncpoint (id, value) pair. If the kernel is configured with CONFIG_SYNC, it will also contain a sync_fence. The gk20a_fence can easily be converted back to a syncpoint (id, value) parir or sync FD when we need to return it to user space. Change gk20a_submit_channel_gpfifo to return a gk20a_fence instead of nvhost_fence. This is to facilitate work submission initiated from kernel. Bug 1509620 Change-Id: I6154764a279dba83f5e91ba9e0cb5e227ca08e1b Signed-off-by: Lauri Peltonen Reviewed-on: http://git-master/r/439846 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/sync_gk20a.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/sync_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c index 1f2eae1a..da9a0f5e 100644 --- a/drivers/gpu/nvgpu/gk20a/sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/sync_gk20a.c @@ -371,12 +371,11 @@ struct sync_timeline *gk20a_sync_timeline_create( return &obj->obj; } -int gk20a_sync_fence_create(struct sync_timeline *obj, +struct sync_fence *gk20a_sync_fence_create(struct sync_timeline *obj, struct gk20a_semaphore *sema, struct sync_fence *dependency, const char *fmt, ...) { - int fd; char name[30]; va_list args; struct sync_pt *pt; @@ -385,7 +384,7 @@ int gk20a_sync_fence_create(struct sync_timeline *obj, pt = gk20a_sync_pt_create_inst(timeline, sema, dependency); if (pt == NULL) - return -ENOMEM; + return NULL; va_start(args, fmt); vsnprintf(name, sizeof(name), fmt, args); @@ -394,15 +393,7 @@ int gk20a_sync_fence_create(struct sync_timeline *obj, fence = sync_fence_create(name, pt); if (fence == NULL) { sync_pt_free(pt); - return -ENOMEM; - } - - fd = get_unused_fd(); - if (fd < 0) { - sync_fence_put(fence); - return fd; + return NULL; } - - sync_fence_install(fence, fd); - return fd; + return fence; } -- cgit v1.2.2