diff options
author | Lauri Peltonen <lpeltonen@nvidia.com> | 2014-07-17 19:21:34 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:10:40 -0400 |
commit | bcf60a22c3e8671468517d34aa37548272455c1f (patch) | |
tree | c3544f6714c291e611e33a8d0e39c5cb2c795821 /drivers/gpu/nvgpu/gk20a/sync_gk20a.c | |
parent | 55295c6087ed975be12e92f9be799269aef94678 (diff) |
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 <lpeltonen@nvidia.com>
Reviewed-on: http://git-master/r/439846
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/sync_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/sync_gk20a.c | 17 |
1 files changed, 4 insertions, 13 deletions
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( | |||
371 | return &obj->obj; | 371 | return &obj->obj; |
372 | } | 372 | } |
373 | 373 | ||
374 | int gk20a_sync_fence_create(struct sync_timeline *obj, | 374 | struct sync_fence *gk20a_sync_fence_create(struct sync_timeline *obj, |
375 | struct gk20a_semaphore *sema, | 375 | struct gk20a_semaphore *sema, |
376 | struct sync_fence *dependency, | 376 | struct sync_fence *dependency, |
377 | const char *fmt, ...) | 377 | const char *fmt, ...) |
378 | { | 378 | { |
379 | int fd; | ||
380 | char name[30]; | 379 | char name[30]; |
381 | va_list args; | 380 | va_list args; |
382 | struct sync_pt *pt; | 381 | struct sync_pt *pt; |
@@ -385,7 +384,7 @@ int gk20a_sync_fence_create(struct sync_timeline *obj, | |||
385 | 384 | ||
386 | pt = gk20a_sync_pt_create_inst(timeline, sema, dependency); | 385 | pt = gk20a_sync_pt_create_inst(timeline, sema, dependency); |
387 | if (pt == NULL) | 386 | if (pt == NULL) |
388 | return -ENOMEM; | 387 | return NULL; |
389 | 388 | ||
390 | va_start(args, fmt); | 389 | va_start(args, fmt); |
391 | vsnprintf(name, sizeof(name), fmt, args); | 390 | vsnprintf(name, sizeof(name), fmt, args); |
@@ -394,15 +393,7 @@ int gk20a_sync_fence_create(struct sync_timeline *obj, | |||
394 | fence = sync_fence_create(name, pt); | 393 | fence = sync_fence_create(name, pt); |
395 | if (fence == NULL) { | 394 | if (fence == NULL) { |
396 | sync_pt_free(pt); | 395 | sync_pt_free(pt); |
397 | return -ENOMEM; | 396 | return NULL; |
398 | } | ||
399 | |||
400 | fd = get_unused_fd(); | ||
401 | if (fd < 0) { | ||
402 | sync_fence_put(fence); | ||
403 | return fd; | ||
404 | } | 397 | } |
405 | 398 | return fence; | |
406 | sync_fence_install(fence, fd); | ||
407 | return fd; | ||
408 | } | 399 | } |