Revert "msm: mdss: missing updates from upstream"

This reverts commit 27fde24c0c43d487c5fdd42ac39aa326634c042f.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
Revert "msm: mdss: keep clocks on during kickoff operation"

This reverts commit b856744c6d63a1233c98b438b20e4dd2187ad059.

Signed-off-by: Dan Trifan <jimsth@gmail.com>
mdss: mdp: Add support for partial panel updates

This change programs MDP only for the output resolution (ROI)
set by the client. All staged pipes are cropped to fetch data
only for the resolution programmed.

Change-Id: If06fb36c6ebe167ba369b11a622ab5feaf52172a
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
mdp: mdss: Honor ROI only for interface mixers

When partial update is enabled and we have a valid ROI, crop
source and destination rectangles against ROI only those pipes configured
for interface mixers.

Change-Id: I75111998a43f796f9315b25709e78a568fb1ec0c
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Add support to get/set secure flag via an ioctl

Add support to get/set secure flag for WB session through an ioctl.
This is required for WB clients such as AD/WFD, enabling them to modify
or query the secure flag depending on requirements e.g. secure video
playback when using AD.

Change-Id: I852b6f79b31b5ba027d9a5c11561c562023cb99f
Signed-off-by: Tatenda Chipeperekwa <tatendac@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: fb: Copy & send unsigned value for notify update

Copy unsigned long from userspace and modify the data fields
before copying back unsigned long data to userspace. This
keeps the datatypes of all operands homogeneous without
data leaks from kernel to user space.

CRs-Fixed: 526286
Change-Id: Ie4673563170c3459019dd6a5f1f55376f6e560c7
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
Signed-off-by: Manoj Rao <manojraj@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: keep clocks on during kickoff operation

There is deadlock scenario where work thread to turn clocks off is
trying to acquire DSI's mdp_busy lock while holding clk_mtx to turn
mdp clocks on.  Meanwhile kickoff thread holds mdp_busy lock and
trying to acquire clk_mtx to turn on clock.
This patch ensure that clocks are kept on and work thread is not
scheduled while kickoff is in progress so that deadlock will not happen.

Change-Id: Iceb5db431a7f9f0e1f56a0e3c1ced2d08d762b86
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Nirmal Abraham <nabrah@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Handle case when pipe is not idle during cleanup.

When pipe is not idle during cleanup, MDP can go into an unrecoverable
state, which can lead into other issues. If it gets to this point we
need to recover even if it means changing display contents for a
fraction of time. To handle this follow recovery sequence:
1. Setup the pipes that are not idle to solid fill mode so that nothing
   is fetched from memory on these pipes.
2. Stage them into mixer, flush and wait for a vsync to happen and reset
   sequence to take effect on these.
3. Finally, reattach the current frame pipes to restore display back to
   normal.

Change-Id: If545b56bf32a46699871381d86e80c1980ec3cc7
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: release secure UI buffer as soon as pipe is destroyed

When secure UI session is in progress, need to make sure that the
buffers are released as soon as pipe is freed to make sure secure
session can be properly terminated without any secure UI buffers
remaining as mapped.

CRs-Fixed: 619802
Change-Id: Ia2fa87f3182efc170304a53eb8d6b3f614355245
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
mdp: mdss: Tune bandwidth and clock based on ROI

Calculate bandwidth and MDP clock requirement considering
the ROI submitted for a frame. When doing partial frame update
for smart panels, the data actually fetched for a pipe is not
always the full resolution of the buffer programmed. Use the
ROI passed to find out the region of fetching and calculate the
bandwidth and clock values accordingly.

Change-Id: I01f24f8fd9a42a2c4d705b8eb0a7658e79884175
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Acquire shared lock after getting frame on wfd

Currently there is a deadlock when wfd and rotation is done
simultaneously and trying to acquire the shared lock. To
prevent this, acquire shared lock after rotated frame is
ready for wfd.

Change-Id: I3865f02c345ddadd985ee35134454a789936a79a
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Initialize right mixer ROI for split control

This change initializes ROI of the right mixer on dual DSI panels
to its complete resolution. This will ensure that the right mixer
composes to its full resolution when partial update feature is not
enabled / applicable.

CRs-Fixed: 556185
Change-Id: I3c2f2b9a220dc223ef66475d6f6cbfc18c4a67db
Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: display: only release kickoff when no cleanup pipe

If there is some pipe to clean up, need wait for it be done to
make sure the pipe can be used for the second cycle and recover
mode can be executed.

Change-Id: Ifb3fdb152bc4bbf367b3d272aa0c88b1a0650c19
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Neti Ravi Kumar <ravineti@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: MDP clock optimization for single layer video playback

MDP core clock bumping is not required for single layer video
playback in 8x26 targets. Hence add revision check to avoid fudge
factor.

Change-Id: I1b0ccb4ef50514f705845b0218fa6ca0d28c1779
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>
msm: mdss: Fix mdp clock rate assignment when apply fudge is false

When apply fudge is false, currently mdp clock rate can take
garbage values, hence assign the calculated clock rate without
applying any fudge factors.

Change-Id: I7c9d34024ab94b05160b50560ab136c0c8b7781d
Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Dan Trifan <jimsth@gmail.com>