From 9bd76b7fa08672181c2a0cce747a59664e226964 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Thu, 11 Aug 2016 16:40:35 -0700 Subject: 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 Reviewed-on: http://git-master/r/1221041 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c | 7 ++++--- drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 10 ++++++---- drivers/gpu/nvgpu/gk20a/fence_gk20a.h | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) (limited to 'drivers/gpu/nvgpu') diff --git a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c index e4972610..98363c88 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c @@ -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; } diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index fbbaa2a7..596dc549 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c @@ -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); diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h index ff00bcf1..35488ea3 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.h @@ -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, -- cgit v1.2.2