msm: kgsl: Delay the first devfreq status read

No reason to read status when there hasn't been any activity
yet.  Wait at least one sample period after the GPU has been
turned on before pinging devfreq to read status.

Change-Id: I65633a76f0bbf0bded51f1d6ffbb7808d57f7884
Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
msm: kgsl: Treat 0x0 as valid GPU pagetable physical address

Iommu driver could be allocating a valid GPU pagetable at
physical address 0x0, remove assumption from GPU kernel driver
that 0x0 is invalid pagetable address.

Change-Id: I213c0fbc1d90a13bef83c7d7589ad9e5729771fd
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Fix memleak in IOMMU clock disable

IOMMU clock disable on timestamp allocates memory and passes
the pointer to event created, this memory should be freed
when the event fires.

Change-Id: Ia714550ce8a05958fb6668293cd0400a0f69d4af
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
msm: kgsl: Flush the UCHE when context changes

Add commands to flush the GPU UCHE when a new context submits
commands to GPU. The ensures that the new context does not use
stale data present in UCHE.

CRs-Fixed: 607976
Change-Id: I123a323be5f3fb9d1f9f96fed5bb68b8d0d27d76
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Remove sscanf() from kgsl_pwrctrl.c

Replace sscanf() in kgsl_pwrctrl.c with a generic function to safely
convert 32 bit unsigned ints.

CRs-fixed: 563585
Change-Id: Ic0dedbad10e2264ec8fccab622d094d123b49b77
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: don't use sscanf()

Friends do not let friends use sscanf().

CRs-Fixed: 563605
Change-Id: Ic0dedbad56af5bbee4fc833701d8bc93b118efa9
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: Protect fault detect start with active count

Get the active count when enabling GFT from sysfs so the performance
counters can be properly programmed.

CRs-Fixed: 622252
Change-Id: Ic0dedbadfe56f8c66aca15fb521494a2fc00332b
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: allow creation of events from the future

For contexts created with the KGSL_CONTEXT_USER_GENERATED_TS,
allow events to be created for timestamps that have not
been issued yet. Presumably these contexts know what they
are doing.

Change-Id: Iccf2e549b38e1a11850d26ee64b7279ab0b8a1ae
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
video: mdss: Kill "pervious" logspam

Change-Id: Id81659ec6a23c3c27a60ba639793b506da4c89a5
msm: mdss: Don't call pan_idle for MSMFB_OVERLAY_PREPARE ioctl

We keep calling MSMFB_OVERLAY_PREPARE for each composition
cycle, even if there are no changes in params. Because of this
we can hit performance degradation due to pan idle wait.
This change removes pan_idle wait for prepare call.

CRs-Fixed: 600539
CRs-Fixed: 608848
Change-Id: Ie99f4dbc4671caf9bfbd49bd9b200c3180002d56
Signed-off-by: Radhika Ranjan Soni <rrsoni@codeaurora.org>
msm: mdss: refactor command mode vsync control logic

Current logic is prone to corner case when mdss_mdp_remove_vsync_handler
is called twice: once from mdss_mdp_cmd_stop and again from vsync ctrl
logic. Need to properly identify the second call and avoid resetting the
rdptr ticks which prevent from clocks being turned off properly.

Change-Id: I9eeebd0c16e67a249508980427c81fa2e339edec
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: Make notify update waits interruptible

Wait for completion in notify update call are uninterruptible
causing excessive delay during suspend cases. Making them
interruptible.

Change-Id: I1a4ff6ce3e0add21d4e46a41372b076b277d10f5
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm: mdss: properly handle panel on and off

There is some condition that panel off will be called multiple times.
In this case, it was blindly free the gpios that were already released.
This is adding the check to handle this condition.

Change-Id: I0140872be1255fe00ed5abd164a246fa57b2a245
Signed-off-by: Xiaoming Zhou <zhoux@codeaurora.org>
video: msm: Remove some cruft

Change-Id: Ie58a051b7836e5f6a7178034cd65f92c148b9bd9
msm: Fix high load average from uninterruptible waits

 * The load average on all MSMs is currently hovering at around 14
   due to uninterruptible waits in various places.
 * Convert these waits to interruptible waits to bring the load
   back down to zero at idle.

Change-Id: I14bad4af135b1594e235e2252cb484cb34d91054
msm: mdss: Program unpack pattern for pipes with solidfill

When a pipe is staged with a solidfill color, we need to also
program the correct unpack pattern for the color format. If the
unpack pattern is not specified, the corresponding color layer may
not be display correctly.

Change-Id: Ic52fe29235813faa788745dd72f82edaca2635f1
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
mdss: Add newline to VSYNC timestamp

This makes sure that the userspace correctly interprets the end
of the vsync timestamp.

Change-Id: I66f9939658b6fb7531468429c1ca3e551a4a285c
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
mdss: Notify userspace of changes to blank status

Allow userspace to poll on the blank event to avoid triggering
unnecessary updates, such as when shutting down the device.

CRs-Fixed: 627814
Change-Id: I36bb7845edba14ba0b0ddbe43eaf3d386af2d5f1
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm: mdss: fix issue of overlapping BW for two adjacent surfaces

Current code detects two adjacent surfaces as if those were overlapping,
this can impact by increasing the bandwidth calculations in this scenario.
These changes correct the algorithm to avoid the overlap in boundaries
that are only adjacent.

Change-Id: Iee43c1662c90c38dbff03991ee93884ef444fb19
Signed-off-by: Ingrid Gallardo <ingridg@codeaurora.org>
msm: mdss: add bandwidth check while performing frame level checks

Add frame level check inside overlay prepare API, for the bandwidth that
would be required by MDP to display the frame. If the bandwidth is over
the defined limits, then we need to fail the configuration to allow an
alternative composition configuration to happen instead.

Change-Id: I7721047589ce9239f1fb63c37ca5d97127c90f7e
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Saurabh Shah <saurshah@codeaurora.org>