msm: kgsl: Save/restore performance counters across GPU power collapse

Physical performance counters are reset on GPU power collapse.
Save the values of the performance counters when the GPU goes to
power collapse and restore them on restart.

Change-Id: I63bec7b20e7fe516bbac4901cac0af3a1c1f4959
Signed-off-by: Harshdeep Dhatt <hdhatt@codeaurora.org>
msm: kgsl: Add TSE performance counter to software hang detection

Our current hang detection logic covers rendering pass by checking for
shader performance counters but it does not cover the case where there
is long binning or resolve pass. For long binning pass shader is inactive
making our current hang detection logic faulty. Checking for TSE number of
input primitives covers binning and resolve passes and makes our hang
detection logic robust.

CRs-fixed: 521284
Change-Id: Ifdec4b53685903456feb367f64380119b1485408
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Allow GPU start to run in a high priority queue
The GPU start sequence needs to run with low latency when coming
out of slumber for the first draw command. For those cases allow the
start function to be queued into a high priority workqueue to reduce
the chance of it getting scheduled out.

Change-Id: Ic0dedbada7ef4d63b54e826862fbefdfb71a092a
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Add an input handler to power up the GPU on a touch event
msm: kgsl: Prevent device start after it is already started

Check if device is already started in high priority workqueue thread,
this check prevents calling device start after it is already started,
thereby avoiding unpredictable behavior.

Change-Id: Iffcd065f8c02746d168c8e5779d10d4b0e2404a9
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Fix the NULL context submission size

When submitting commands with a NULL context the size may not be
calculated properly. Fix this calculation.

Change-Id: Idcc37772349673da8a9b9d5127f88946ced8fff6
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: Change the pagefault policy immediately

When changing the pagefault policy the MMU setting for the pagefault
policy was not changed, add code to do that.

Conflicts:
	drivers/gpu/msm/adreno.c

Change-Id: I3b185a7f6bdda42856c777c60ae82c32b9c52eb9
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Remove unused legacy IB timeout variables

Remove unused variables from legacy IB timeout detection.

Change-Id: I4df94ee43072ccebff4045c5950edbc406de38a8
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Dump snapshot for long IB timeout

Dump snapshot when long IB timeout is detected. The GPU
command processor is halted on long IB timeout detection,
this will halt the GPU pipeline, dumping the snapshot at
this point is safe and gives us information to debug
long IB timeout.

Change-Id: I51bb73b66e11c3b6945c3dfe92af03e21e3c0e62
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
Revert "msm: kgsl: Policy change to skip entire command during fault recovery"

This reverts commit 47e39f3944226d17cb17f718847598c3331e25e3.
Revert "msm: kgsl: Skip the entire command during fault recovery"

This reverts commit e585b5e76d9c6b7be19df1e492ec6db733629293.
msm: kgsl: Enhance GFT to avoid hang->recover->hang cycle
msm: kgsl: Increase the timeout value for fault detection

Increment the timeout value for detecting faults from 50ms to
200ms. The fault detection mechanism is a backup to hardware
fault detection. 50ms is small since it has been observed that
this mechanism triggers false positives with 50ms.

CRs-Fixed: 630776
Change-Id: I8f382051e06bdc47f152309a2868092e1980604e
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Skip the entire command during fault recovery
msm: kgsl: Policy change to skip entire command during fault recovery

During fault recovery change default policy to skip entire command instead
of skipping faulting indirect buffer.

Change-Id: I3c2d159dbb3f2523a05f4bcbf65195673e26c020
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>