gpu: nvgpu: create sync_fence only if needed
authorDeepak Nibade <dnibade@nvidia.com>
Wed, 7 Oct 2015 10:50:07 +0000 (15:50 +0530)
committermobile promotions <svcmobile_promotions@nvidia.com>
Mon, 21 Dec 2015 15:51:56 +0000 (07:51 -0800)
commit5e6f517439ef215bcd5ee514881f68d3d3020948
tree9c8e7657ad37dcbf42652b6466755efa6dfed575
parent871804c5a944b1b2879bd2e57dace22e2c02af59
gpu: nvgpu: create sync_fence only if needed

Currently, we create sync_fence (from nvhost_sync_create_fence())
for every submit
But not all submits request for a sync_fence.

Also, nvhost_sync_create_fence() API takes about 1/3rd of the total
submit path.

Hence to optimize, we can allocate sync_fence
only when user explicitly asks for it using
(NVGPU_SUBMIT_GPFIFO_FLAGS_FENCE_GET &&
NVGPU_SUBMIT_GPFIFO_FLAGS_SYNC_FENCE)

Also, in CDE path from gk20a_prepare_compressible_read(),
we reuse existing fence stored in "state" and that can
result into not returning sync_fence_fd when user asked
for it
Hence, force allocation of sync_fence when job submission
comes from CDE path

Bug 200141116

Change-Id: Ia921701bf0e2432d6b8a5e8b7d91160e7f52db1e
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/841584
(cherry picked from commit e8a4b80c4b7cca656cee5a85a50e4bde6097a7bd)
Reviewed-on: http://git-master/r/921947
Tested-by: Nikhil Joshi <nikhilj@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
drivers/gpu/nvgpu/gk20a/cde_gk20a.c
drivers/gpu/nvgpu/gk20a/channel_gk20a.c
drivers/gpu/nvgpu/gk20a/channel_gk20a.h
drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.c
drivers/gpu/nvgpu/gk20a/channel_sync_gk20a.h
drivers/gpu/nvgpu/gk20a/fence_gk20a.c
drivers/gpu/nvgpu/gk20a/fence_gk20a.h