video: msm: Fix build (bad resolution)
msm_fb: display: turn vsync irq off at suspend

Turn off vsycn irq at suspend to prevent vsync irq firing
before vsycn enabled ioctl called at resume.

Change-Id: I2428cdeb5cf7008e50f6d8dabfad52416db2fff7
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb : display : Block RGB downscale in MDP 4.0 and 4.1

Downscale is not allowed on RGB pipes in MDP 4.0 and 4.1. Hence,
fail the OVERLAY_SET ioctl for such configurations.

Signed-off-by: Pradeep Jilagam <pjilagam@codeaurora.org>
(cherry picked from commit 3545573720822ce97ec37586f10fdf74a6d4f090)

Change-Id: I8445c18ac21cb7322eb9eb4c802623df5da07eb7
Signed-off-by: Gopal Goberu <ggober@codeaurora.org>
video: msm: Dynamically toggle histogram interrupt (adapted)

Make histogram enable/disable functions also enable/disable the histogram
"interrupt enabled" bit on the MDP enabled interrupts register.

CRs-Fixed: 398556
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Change-Id: I56f811e88cf3fd44ae0a2df8a6e5de32ba9a0c1c

Adapted to htc msm7x30 (priou) base by @synergydev
video: msm: Defer histogram reset to workqueue (Adapted)

Currently, when an underrun occurs, a reset request is sent to the
histogram hardware. This has been observed to cause a hang in the histogram
collection cycle. The fix for this hang is to instead rely on the existing
checks for histogram validity in the histgram read worker. When the
underrun occurs, the histogram is invalidated, which in turn causes the
histogram read worker to reset the histogram collection when it attempts to
read its contents.

Change-Id: I66d33ddedef76fdcb6c4a3d8095c0e8ca695e33d
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>

Adapted for htc msm7x30 (primou) base by @synergydev
video: msm: Ensure idle state before enabling histogram (Adapted)

Disable interrupt, set state flags to false, cancel histogram collection,
and clear the workqueue before attempting to enable the histogram. This
guarantees that this is the only configuration of the histogram running.

Change-Id: I222932db40494724b3efdb2e5bea08a849095c1e
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>

Adapted for htc msm7x30 (primou) base by @synergydev
msm: rotator: Add pseudo-planar 422 H1V2 dst format for MDP4

For interleaved 422 inputs, rotator outputs MDP_Y_CRCB_H1V2
format on 90 degree rotation. Add support as destination format
for MDP4.

CRs-Fixed: 371303
Change-Id: Ie0f98d40f58bf2cb9bc3298a94cae9c4e89b2f7a
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Add pseudo-planar 422 H1V2 support in the MDP4

Rotator outputs pseudo-planar 422 H1V2 for interleaved inputs
on 90 degree rotation. Add changes to support MDP_Y_CRCB_H1V2
in MDP4.

CRs-Fixed: 371303
Change-Id: I8083bf44f9e2addf9e8732268147c1c3f6c0e2af
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Program source address registers correctly

Scale filter FIR uses the adjacent pixels as part of the
processing. Source address registers should be program such that
they point to the first valid pixel so that non-ROI pixels are
ignored. This is done by making source x,y offsets to zero and
adding the computed offset to source address.

CRs-Fixed: 380020
Change-Id: I998fdd46f39dc67f32c422ec209da59d1add2e95
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
video: msm: Enable mdp clock for histogram and histLUT

Enable the mdp clock for histogram and histogram LUT to ensure that the
clock remains enabled when they are being accessed.

Change-Id: Ic744f2ee96b64442f23ba19aa1c38552c0dad83a
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
msm_fb: display: remove extra dmap irq disable

Both irq enable and disable need to be called symmetrically.
Remove an extra dmap irq disable call.

Change-Id: Ic51003c50431ebe46a9fc540163cda77a1c91797
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: add pipe commit ioctl (Adapted)

currently, pan display serves as pipe commit. However it
may spend long time pending on cosole_lock() which cause
flickering on HDMI. Add pipe commit ioctl to allow commit
from overlay in addition to pan_display.

CRs-fixed: 391564
Change-Id: I163b5d96f727b70b4d5693e9a414b59339818998
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Adapted for htc msm7x30 (primou) base by @synergydev
msm_fb: display: empty pending queue during suspend

Overlay_play() adds a pipe into pending queue and pan_display()
will commit those pipes to hardware and empty queue. This patch
will make sure queue is empty at suspend so that no unexpected
pipes will be commited to hardware by pan_display() at resume.
Otherwise, iommu page fault may happen.

Change-Id: Iafdf469c6cdbf5d469c9dee114555a8d1adb9c66
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: Timeout pan display if time greater than 100ms

Timeout if pan display is taking more than 100ms to complete. This
will unblock the userspace thread and continue. This will solve
the hang issues.

Change-Id: Ica6a395b0e992263567633d6dc93a92ee1fa59cf
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
(cherry picked from commit 7c270369ccb7eca4934d6005b1960ac7ec2ed2fc)
msm_fb: display: remove background invert alpha option for alpha drop pipe (Adapted)

When the blended background pipe has dropped alpha and it is going to
be blended with foreground pipe on the next stage,
MDP4_BLEND_BG_ALPHA_FG_CONST is taken. Foreground alpha constant is
0xFF, so we need to use this alpha value to show background, instead
of its inverted value.

Change-Id: I1fe0572f9bb54db6280bcc44117a21b8c0d8b07a
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm_fb: display: add fput_light to frame buffer

Frame buffer's (fb0) ref_count need to be balanced. overlay_play()
increase fb0's ref_count (fget_light). This patch will decrease fb0's
ref_count by calling fput_light after commit.

Change-Id: I34ea738bf21d0858b7361ec8e289464a217a1231
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: check base layer pipe at irq handler

There is a corner case when overlay and dmap interrupts
are fired before base layer pipe is allocated. Therefore
Check for base layer pipe before performing any operations.

Change-Id: Ib188d575044f5479672503508042c8c1e9c759c4
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: Use background alpha for all destination alpha enable cases (Adapted)

Use background alpha for modulation in all the cases where source alpha
is not available.

CRs-fixed: 366834
Change-Id: I300c04181ee3fa4f305a26a3e17e7eac2572564c
Signed-off-by: Kalyan Thota <kalyant@codeaurora.org>
msm_fb: display: add checking y direction for alpha drop

Alpha is dropped when scaling with non repeat pixel method.
Both x and y direction of scaling need to be cehcked for
alpha dropped.

Change-Id: Iba0df5a85011f179199c13ffdebac911e5c14c3c
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm: rotator: add YUV444 interleave format support

Add support for H1V1 interleave (YUV444) to rotator
in msm_rotator_get_plane_sizes().

Change-Id: I57ff5236b7e9329b72f9983da9874de938a821a2
Signed-off-by: Kyong Hwa Bae <kbae@codeaurora.org>