framebuffer: add a pollable sysfs entry for display status

Wakeup the userspace poll on change of display status. The
userspace then may take action to change the
power/performance characteristics of the device.

Change-Id: I9bd11f3d895d3d83230104f5d8dcd1deeaa754cd
Signed-off-by: Amar Singhal <asinghal@codeaurora.org>
Revert "msm: compile v4l2 files for 8x60."

This reverts commit bb0fba6a0aeedd1e5c200f1903c848051e9a8ab1.

Change-Id: I431b6ab6961880c7bc327d65fe7a314763eccd58
Signed-off-by: Roja Rani Yarubandi <rojay@codeaurora.org>
drivers: gpu: msm: change merge from ICS_C to JB_C.

https://review-android.quicinc.com/#/c/144219

Also allows drawctxt_draw_workaround to take a context

Signed-off-by: Matthew Trusten <mtrusten@codeaurora.org>
(cherry picked from commit 0ccd273ad09a403bc7b1be72156e4f6d39cc70f9)

Change-Id: I1fc33313cbb26a0137ca3edaaf14edd6841ac08e
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Idle the GPU after recovery in recovery routine

Before returning from recovery routine, wait for the GPU to
become completely idle to ensure that recovery passed

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 1088bdb727a0360e0acf38b4420a259877deb125)

Change-Id: Ida471d10188f55f7a5f70bb2427fdac27c8d767d
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit 776c108db6c62578a0ee618f96088649baf76bd8)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Start the sleep timer after recovery has completed

Start the sleep timer if recovery from hang is successful.
This prevents GPU from entering low power states during
recovery.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit df609308d9cdd5ebc4605d09be4fdda420e1a434)

Change-Id: I7034ad26b12175fc704656eced5ea6cf7b57413c
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit f7593196a0fb7a1563bed6b96297c3c3d1b77e68)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Always add a start identifier to a command sequence

Add command sequence start identifier for commands submitted from
kgsl as well since this will be used during recovery. We will just
try recovery and not try to differentiate between commands from
kgsl or from user space.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit c3ad5803d537142ae15841afefba0831e9ed6134)

Change-Id: Ibe363682e4ea405a81fae77d5b5bfeccbad97edc
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit b13c30dd3ad88b5a5dd128f4824876f82e695b5b)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Introduce recovery data structure for hang recovery

Create a new data structure that holds all the information required
for recovering from hangs. This data structure is initialized as soon
as hang is detected because if the GPU is under DOS attack then by
the time we start recovery the recovery data may have changed.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit ba6c70b85941267c552b154be1729aef4e944da6)

Change-Id: Idcd7de7a02b4d57735c2186db9307a22bfd1a6b6
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit a5667011435a34bedb0916abc80e3337da68f28f)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Use recovery data structure to extract valid commands

Use the data set in the recovery structure when extracting
valid commands from the ringbuffer instead of reading
it from the device/memory.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit adb1602262d7a8cf988ef1ced622ea6cc1aecc99)

Change-Id: I5b4f263c34c09bc724e875866806971931060d52
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit ae6b074d30e3d1d3cad362f80ed5eb4c84f7e001)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Create a separate function to extract valid commands

Create a separate function that extracts valid commands from good
contexts and invalid commands from bad contexts during recovery

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 1d577fe6fc5cdf768c5f3fe59b56adcd0e86db19)

Change-Id: I03e787657d37a13cf2c915677ba05b87b5a5731c
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit 9790eadcb74289fe3114c8cf2ba6d4d8a4920bfd)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Separate function to detect last command in recovery

Make the code more readable by writing a separate function to
detect the end of last command that is assumed to be successfully
executed by the GPU

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit bb7b32a2cd7c42783f608fa750b7cb23821a587e)

Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit 59c917c7d6e36e5daf9820dc12a3f7c5bd508e2a)

Conflicts:

	drivers/gpu/msm/adreno_ringbuffer.h

Change-Id: Ia9065c8cf83c3404d82a2cf0865e1f0398be69da
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Turn on preamble to enable replay of commands

Turn on the preamble of the IB sequence in which hang is assumed
to have happened so that the bad sequence can be replayed.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 2a85f1fb19278fa530cb31dca0198583b77fc8be)

Change-Id: Ie3f70f2c8f273f73f5ed525f911bb2914b6bebce
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit 53b95e6361dc7925374d375ea83cb6f51af59282)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Do not restore per context timestamp states

We do not have to restore the per context timestamp states during
recovery as this data is irrelevant after recovery.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 1caba1c8066b77d3955300c95a9be2489418b094)

Change-Id: I2ebf10cb9fca40fdff9f02978bdcda18dd771871
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit 5ef7b562609b5b1ac3159f9dfca6d9922ac66186)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Write a separate function to set the reset status

Write a separate function that sets the reset status of each
context after recovery.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 29ed38ee8491fd873b304f3d2edad2a4a0395017)

Change-Id: Ic4a70823cb35637794a281142181d93b689d3b6e
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit 51d5c7fb21d7d603a085c331bf2d29b5b6754ec3)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Mark the hung context in recovery before extraction

Mark the context that has caused a hang in recovery before
calling the extraction function. This updates the context
state correctly early in recovery.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit b9f1e831b78da1192c189aab507272298ae9eb9b)

Change-Id: I8a3078ca76d7f447d5ca104ba98b34d46a4409aa
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit 790998de09e2fc4a091da9444bad52d222776390)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: Expire timestamps after recovery

Expire the global timestamp and timestamps of contexts that have
cause at the end of recovery. This will prevent any users waiting
on timestamps of hung contexts to return without waiting.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 5f085f45b19b1fd209eef1cb02b2bb68ad40f505)

Change-Id: I916bf41bad7b2e33c5fe0a885c3ea4e132974541
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit c1f92ca72dc3819c93a6bbee21d0af8354919465)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: In recovery search for command stream after global eop

In recovery search for the timestamp of the command stream after
global eop instead of searching for the command stream of the
global eop and then moving the pointer forward till the start of
the command stream following global eop. This is because if the
ringbuffer is full then the global eop timestamp may have been
overwritten, so its more reliable to search for the timestamp
that occurs after global eop.

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 6f6ecb3ef3eb66ef8e07ae8473682f8b36091376)

Change-Id: I21e28acade3d6f431a00b8825845dbf4b8cb7008
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit f96febefc320b9c6007f2c167428a7c85e8d56b0)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm: kgsl: After timeout check if timestamp has retired

When a thread times out while waiting for a timestamp, check once
whether the timestamp which it was waiting for has expired or not
before treating it as an error

Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
(cherry picked from commit 54396e5406b5fecdd1a0e347dab953967d0e9318)

Change-Id: Iaf8fef4881ca0510ac44b437d82b1382ce602097
Signed-off-by: Tarun Karra <tkarra@codeaurora.org>
(cherry picked from commit cb579bd248409c6892f4eecd0bf93383b66b375d)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm_fb: display: set pipe src and dst size same in solid fill mode

When a mdp pipe is in solid fill mode, the pipe outputs constant color
and pipe itself does not fetch data from memory, so pipe src size
should not matter. However, when src size is greater than dst size in
solid mode which means downscaling, underrun happens. In this
situation, setting src size to be same as dst size can remove underrun.

CRs-fixed: 368478
Change-Id: Ie3ffc34486129cddcc872fe6e5317873db985b97
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm_fb: display: Set timing generator after register flush

Timing generator was getting started before the register flush.
Stale values were sometimes causing IOMMU page faults on bootup.

Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
Change-Id: Ia671c3603e383af94197a23a8e5e5f32274a9978
msm_fb: display: add dcs command list for dsi command mode

DSI dcs commands and mdp pixel stream share same dsi link.
Add dcs command list to serialize sending dcs command and mdp
pixel stream to avoid contention which may cause dsi controller
to stall.

Change-Id: Ia1c75ba4773f9332d897273fc1f6922c28333d3e
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>