gpu: nvgpu: Optimize sync fence creation

Only create sync-fences in the semaphore synchronization path
when they are actually needed (i.e requested by userspace).

Bug 1795076

Reviewed-on: http://git-master/r/1201564
(cherry picked from commit dc52d424a839e6c064c02b7f02905dd6a59a50af)
Change-Id: Ieac6aef415678d4ea982683a955897c64959436e
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1221041
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Alex Waterman
2016-08-11 16:40:35 -07:00
committed by mobile promotions
parent f919aab509
commit 9bd76b7fa0
3 changed files with 11 additions and 8 deletions

View File

@@ -605,7 +605,7 @@ static int gk20a_channel_semaphore_wait_fd(
*fence = gk20a_fence_from_semaphore(sema->timeline,
fp_sema,
&c->semaphore_wq,
NULL, false);
NULL, false, false);
else
/*
* Allocate an empty fence. It will instantly return
@@ -676,7 +676,7 @@ static int gk20a_channel_semaphore_wait_fd(
semaphore while the job is in flight. */
*fence = gk20a_fence_from_semaphore(sema->timeline, w->sema,
&c->semaphore_wq,
NULL, false);
NULL, false, false);
skip_slow_path:
*entry = wait_cmd;
@@ -734,7 +734,8 @@ static int __gk20a_channel_semaphore_incr(
*fence = gk20a_fence_from_semaphore(sp->timeline, semaphore,
&c->semaphore_wq,
dependency, wfi_cmd);
dependency, wfi_cmd,
need_sync_fence);
*entry = incr_cmd;
return 0;
}

View File

@@ -148,17 +148,19 @@ struct gk20a_fence *gk20a_fence_from_semaphore(
struct gk20a_semaphore *semaphore,
wait_queue_head_t *semaphore_wq,
struct sync_fence *dependency,
bool wfi)
bool wfi, bool need_sync_fence)
{
struct gk20a_fence *f;
struct sync_fence *sync_fence = NULL;
#ifdef CONFIG_SYNC
sync_fence = gk20a_sync_fence_create(timeline, semaphore,
if (need_sync_fence) {
sync_fence = gk20a_sync_fence_create(timeline, semaphore,
dependency, "f-gk20a-0x%04x",
gk20a_semaphore_gpu_ro_va(semaphore));
if (!sync_fence)
return NULL;
if (!sync_fence)
return NULL;
}
#endif
f = gk20a_alloc_fence(&gk20a_semaphore_fence_ops, sync_fence, wfi);

View File

@@ -52,7 +52,7 @@ struct gk20a_fence *gk20a_fence_from_semaphore(
struct gk20a_semaphore *semaphore,
wait_queue_head_t *semaphore_wq,
struct sync_fence *dependency,
bool wfi);
bool wfi, bool need_sync_fence);
struct gk20a_fence *gk20a_fence_from_syncpt(
struct platform_device *host1x_pdev,