msm_fb: display: add out of range check for display sizes

MDP pipe or mixer size registers have 12-bit number, so boundary
checks are needed for those parameters. If not, input req sizes could
be very large 32 bit unsigned numbers, e.g. 0xffffffff, unsigned
operations may have overflow to pass all later checks, causing MDP
underruns or hang issues.

CRs-fixed: 380469
Change-Id: I096d7022ede21d54266b46a140782ab0348dd54b
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Siddhartha <agrawals@codeaurora.org>
msm_fb: display: vsync driven screen update II

Fix whitespace issues from the patch titled
msm_fb: display: vsync driven screen update

Change-Id: I96bf0210c20667486e48f5e20b7525cade098020
Signed-off-by: Siddhartha <agrawals@codeaurora.org>
msm_fb: display:  free writeback buffer at correct time

When mdp pipe is freed at end of video play back, Writeback
buffer is freed while mdp still fetchs data from it. This cause
system crashed and blue screen shows on screen. This patch
will free writeback buffer at correct time.

Change-Id: I46a5031c13d86f943d6604713e1841b482dffe96
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: enable MDP interrupts base on panel interface

Enable necessary MDP interrupts base on panel to avoid
triggering dma_s isr handler.

Crs-fixed: 331668
Change-Id: I139a6193338a1b0a7c9cc7869e3ea1b3f9a65c4d
Signed-off-by: kuogee hsieh <khsieh@codeaurora.org>
Signed-off-by: Siddhartha <agrawals@codeaurora.org>
video: msm: Add user-defined backlight scaling

Add method for scaling backlight based off of a user provided ratio and
minimum level for the scaling to be applied.

Change-Id: I494bdd4545e9e02602faa01bed820120cd96298f
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit f0fd8e7323ea0f60539918528a4cfa1edb39b828)

Conflicts:

	drivers/video/msm/msm_fb.c
video: msm: wfd: Add turbo mode support

Add support for userspace to push the video core clock to maximum
supported by hardware.

Change-Id: I47295d0fc67d32302312600a90359be23e3fc2c2
CRs-Fixed: 361108
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
msm: fix vfe stop sequence.

Fix sequence of register writes during vfe stop. The interrupts
need to be disabled before CAMIF is stopped and AXI
needs to be halted. This ensures that there are no spurious
interrupts.

Change-Id: I3a6813d6cdd2f722fd72b3654fd66fe9721310c8
Signed-off-by: Ankit Premrajka <ankitp@codeaurora.org>
Signed-off-by: Roja Rani Yarubandi <rojay@codeaurora.org>
video: msm: wfd: Send signal HDMI observer to mirror on  FB2.

 - Send KOBJ_ONLINE, KOBJ_OFFLINE events to HDMI observer
   to mirror on  FB2.

This reverts commit 4102d704243cf0ff297cdbe8d5b731da4c0bb9d5.

Change-Id: Ie5f0c4528ee43edf5ff8145520723a8095c0f542
Signed-off-by: Srinu Gorle <sgorle@codeaurora.org>
video: msm: wfd: Delay fill_buffer until START_DONE

VCD requires we do not give any output buffers to be given until
START_DONE is received. In the case that buffers are given, it
introduces race conditions in the vidc with respect to the SPS/PPS
buffer, which vidc assumes to be present on the first fill_buffer but
actually isn't present until START_DONE.

Change-Id: Ie4dec3ed41e0f248175fb7d9719b458d3b699539
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
msm_fb: display: fix iommu leaking

Fixed iommu map buffer dropped after overlay unset by saving
origianl iommu list before zero out overlay pipe structure.

Change-Id: I498dd4cf62e93f4571883fe20a0298e9fad4ccab
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: free dtv iommu buffer

Free iommu buffer after pipe is committed to hardware.

Change-Id: I00506d6fd55d99fec7921c02953fd755a7536d3e
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
 msm_fb: display: clear correct pending isr

Clear correct pending isr during irq enable/disable
to avoid un expected side effects

Change-Id: I5e7afc778cb8d5feda40f359ff2aae6493dc7cd2
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: fix fake iommu buffer drop

During pipe free, some content of pipe is backed up and then after
pipe is zeroed out, the content get restored, in between there should
be no actions to change the content since any change will be wiped out
by the restore.

Change-Id: Ia6da0162d1f9b614682e1fc36edab1db003b42ab
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm_fb: display: add stage commit before kickoff to WFD

Since stage commit had been splited out of stage up fucnction,
it needed to be called to stage pipes into mixer befroe
kickoff mixer. Add this function into overlay writeback for WFD.

Change-Id: I11e4486d92b89a15e58531033d474b3137b5935a
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: upgrade MDP blt mechanism

Upgrade  mdp blt mechanism so that future patches can be
applied without confliction.

Change-Id: I7fef96e2f9e2ad12fa8918f40caf1c6a44f8bf37
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay_lcdc.c
msm_fb: display: vsync support for HDMI as primary

When HDMI is primary, dtv is associated with node 0. In this case,
DTV vsync and ctrl need to be called for node 0.

CRs-Fixed: 383877
Change-Id: I425cddf453dd159259883e71f92c32918ca8e6c7
Signed-off-by: Ajay Singh Parmar <aparmar@codeaurora.org>