sync: reorder sync_fence_release

Previously fence's pts were freed before the were the fence was removed from the
global fence list.  This led to a race with the debugfs support where it would
iterate over sync_pts that had been freed.

Change-Id: Ia3ddbf77de42ca593fc2dc353b5d04e42ddf3946
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: optimize fence merges

If the two fences being merged contain sync_pts from the same timeline,
those two pts will be collapsed into a single pt representing the latter
of the two.

Change-Id: Iced7ebb7e5a17a0c8b1a2969ba3388a4edb9ecaf
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: add internal refcounting to fences

If a fence is released while a timeline that one of it's pts is on is being
signaled, it is possible for that fence to be deleted before it is signaled.
This patch adds a refcount for internal references such as signaled pt
processing.

Change-Id: Ie8605e6fd2ac026c207220a03d84e1c1078ec719
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: add reference counting to timelines

If a timeline is destroyed while fences still hold pts on it, the reworked
fence release handler can cause the timeline to be freed before all it's points
are freed.

Change-Id: I1cd8ddb638eded7db9db446ff6b37f3dd165d6c4
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: change wait timeout to mirror poll semantics

Change-Id: Ib38e6d339d41885a33027752690d65a52b6897f6
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: fix erase-o in sync_fence_wait

Change-Id: I189707cf658a9f1f2943515c891b43961994e774
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: clean up compiler warnings

Change-Id: I8a2ec5db652c61fd04571402067b37273b91e78f
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: dump sync state to console on timeout

Change-Id: I74bca6b4a2afa7ed5b1f5233c5165d2edddf269a
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: use correct signed type when handling SYNC_IOC_WAIT

Change-Id: Ic7d5adf9b145765e52b23186b8c3c793ccf29be7
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
sync: improve timeout dumps

Change-Id: I3b378d63c324c7b5862dd214f380b5e91131cc2a
Signed-off-by: Erik Gilling <konkers@android.com>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
Add make_defconfig script

tools for save defconfig
$ ./make_defconfig.sh mako-perf_defconfig
it will update in arch/arm/configs

Change-Id: Ic4946b4ac020faf7026bde216b480994ff9a71a8
Update copyright to The Linux Foundation

Change-Id: I6bf4042269dbd94398f6f4e10c711955508fedc7
Signed-off-by: Duy Truong <dtruong@codeaurora.org>