fmem: interact properly with DMM

On a system with both FMEM and DMM, FMEM must veto
memory hotremove of section(s) FMEM occupies when
in C-state and allow it (after cleaning up metadata)
in T-state (and then change to O-state).

It must also change back to T-state when all sections
FMEM uses have been powered on.

Change-Id: I9766a07305d1e3e2c6ff48e1cbf6933765b751f8
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
fmem: hotplug notifier should do nothing if fmem is inactive

If fmem discovers it has no memory to manage, it will
stay in an uninitialized state. However, this is
not discovered until long after the hotplug notifier
is set up (which must be in the fmem_init function).

Since fmem has not been initialized, the hotplug notifier
runs and incorrectly causes memory hotremove to fail, as
it bases its decision on uninitialized data.

The fix is for the hotplug notifier to just return
immediately if fmem is in the uninitialized state.

Change-Id: Ia647470d64fe1926be404af419f5f516e6b59c05
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
fmem: add missing zcache_put after zcache_get

The code to flush all objects was missing a needed
zcache_put after a zcache_get.

Change-Id: I03ad33ee74b42567d8c0598bd5c2af7e455ca097
CRs-Fixed: 350617
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
FMEM: allocate non-fixed FMEM from memory pool

On platforms whose FMEM is not at a fixed place
and which don't have DMM (such as 7x27a), FMEM
and the EBI memory pool would incorrectly overlap,
and the same memory would be used both as FMEM
and as memory allocated by allocate_contiguous_memory()
at the same time leading to crashes and strange behavior.

There are some unsolved problems related to
allocating FMEM from unstable memory, so we have
decided not to do this any longer. This decision allows
us to simply allocate non-fixed FMEM from the
EBI memory pool (this will prevent FMEM's memory
from being used by another allocator at the same time).
In this case FMEM will appear to "overlap" with
the memory pool, but this now OK as FMEM is allocated
from it.

This also re-enables FMEM on 7x27a and 8625, which
had been disabled due to the above-mentioned bug.

CRs-Fixed: 354254
Change-Id: I8e0bba332c7ddcac1d280de9642078fdfe61bbcc
Signed-off-by: Larry Bassel <lbassel@codeaurora.org>
fmem: Use alignment property from platform data

Change-Id: I5d3e5f2c022937cd721befdd67a9d2f8f927608e
d2: Import FMEM changes to board files

Change-Id: Ie47d4578c77be72704f431d0255aaf41bcfd197c
msm: display: Increase timeout value for fence waiting

In some benchmark use case, graphic engine is extremely
busy, need increase the fence waiting timeout value.

Change-Id: I3c483f98fa86030b283edd8a79e7b70fa1c06335
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm: display: check get_unused_fd_flags return val

Not checking the error code, which might be negative, will cause us to wrongly
reference fdt[fd] by using the error code, causing kernel panic in fd_install.

Change-Id: I1f8e68e74bdbdd5b81bc3450f7d93b5cd96c9439
Signed-off-by: Iliyan Malchev <malchev@google.com>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm_fb: display: Consolidate commit ioctls

Overlay commit and display commit were two separate
ioctls doing similar things. This change consolidates
the two into one display commit ioctl. With this, we
can use the RGB0 pipe with an IOMMU framebuffer.

Change-Id: I2b51e16a6678e6cec1bd3e56a00a476addb1296f
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm_fb: display: remove background invert alpha option for alpha drop pipe

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: I9412141b28a46ed3b58079a56969e79dea4ed57c
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm_fb: display: add per stage alpha drop detection

Currently, alpha drop detection is done per frame which
means multiple blending stages share same alpha drop status
which does not reflect the alpha effect truly on each blending
stage. This patch enforces that the alpha drop detection
is done per blending stage so that alpha effect is applied
properly at each blending stage.

Change-Id: I2f456623c696192cf3388a635584a4a49d4720a0
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm_fb: display: mdp4 version assigned at board file

The mdp4 version reflects mdp's capability and is referred to at
many places. Currently, it is acquired by reading mdp version
register. Since the MDP version is defined in the board file,
this patch uses that version at probe time.

Change-Id: Iae2db1fb8609cb80f3705b5e47d3fefedc15fec5
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@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_fsb: handle pipe-allocation errors

In mdp4_overlay_writeback_on, return -EIO is pipe allocation fails.

Change-Id: I66e73fd342d2c45c55ece5f15d1109d64a089015
Signed-off-by: Iliyan Malchev <malchev@google.com>
video: msm: Remove BLT_MODE_CHANGE_ISSUE

 * Fixed upstream

Change-Id: Ifb76056e58ce669dbb2af0625b25e5543994601b
msm_fb: display: add options to switch blt mode for dsi video

Currently switching mdp blt mode is done in dmap done isr which could
cause mdp hang for some panels/targets. One option is added: turning
off timing generator when switching blt mode, to avoid hang issues.

Change-Id: I92cbee7c070a17d20527815ef841d2cfbb06b5cc
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm_fb: display: Fix flickering when BLT is enabled/disabled

The transition of BLT enable and disable start at the beginning
of vsync. This ensures that the transition is completed within the
same vsync period. We Wait for DMA-P done after turning off the
timing generator and do not prefill the frame.

Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: fix dsi controller hang up during blt enable/disable

Wait for 2 ms to make sure both dsi lanes are in stop state and
fifo are empty before reseting dsi controller.

Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: Add option to enable/disable mixer commit

Adds support to enable or disable mixer commit during pipe staging operations.
Depending on the current activity, this selection can be made.

Change-Id: Ia2f5dbab58f73ef4de90abf7f278332d8d73df46
Signed-off-by: Pradeep Jilagam <pjilagam@codeaurora.org>
Signed-off-by: Ajay Dudani <adudani@codeaurora.org>
Signed-off-by: Iliyan Malchev <malchev@google.com>
msm_fb: display: wfd with vsync driven frame push

To improve performance, hardware vsync event at mdp driver
is passed to framework so that both composition and frame
update are aligned at vsync event. This patch will upgrade
wfd to incorporate vsync driven frame push in consistence
with other interfaces.

Change-Id: If088826ec387446301f1f6acc311d909edb04163
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
(cherry picked from commit d74db5fcf24a223570137087aa5632593b315fcc)