msm: mdss: enable vsync event during continuous splash

Currently when continuous splash screen is enabled the vsync
event reports are delayed until first frame update. This blocks
boot animation. To fix this issue, after user space enables
vsync through vsync_ctrl, mdp driver will start sending vsync
events.

CRs-fixed: 567649
Change-Id: Ifb35e3479805e595d950ab7c38c26de201aa2d16
Signed-off-by: Ray Zhang <rayzhang@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>

Conflicts:
	drivers/video/msm/mdss/mdss_mdp_ctl.c
mdp3: Wait for proper vsync when updating display frame

This fixes an issue where we would report that dma is displaying
new frame, but in fact were really still displaying the old
frame.

Change-Id: I99dc89b2341481ea42f9cce451b9b2833dd1f700
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: Fix race condition for vsync irq enable/disable

Disable and enable of vsync happens in separate thread, which
may lead to a race condition where enable/disable may
happen at the same time and resulting irq in disable state.
Add lock to properly synchronize the enabling/disabling
of vsync interrupts to fix race condition.

Change-Id: Ib52bea5ca7a3612c866a4a962f09725a77e40563
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: set vsync clock rate

Vsync clock rate is not set when vsync clock is enabled.
This cause command mode TE logic not works.

Change-Id: Ibf7dd07e53b2cd76ef30f13133368000c79ae149
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
mdp3: Enable sw vsync when dma is not active

Recently in an attempt to enhance sync event reporting we
prevented sw vsync when dma is turned of from toggleing display
off and on.

Change-Id: I71c9be55d36dc92e513d9f5ead4d1e42157285c6
Signed-off-by: Terence Hampson <thampson@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: refactor command mode vsync control logic

Current logic is prone to corner case when mdss_mdp_remove_vsync_handler
is called twice: once from mdss_mdp_cmd_stop and again from vsync ctrl
logic. Need to properly identify the second call and avoid resetting the
rdptr ticks which prevent from clocks being turned off properly.

Change-Id: I9eeebd0c16e67a249508980427c81fa2e339edec
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>
msm: mdss: implement overlay prepare ioctl

Overlay prepare will allow a full frame with multiple overlays to be
configured at once and perform frame level checks before being pushed to
display. This function guarantees that if the call is successful, the
frame can be displayed successfully on the screen when display commit is
called.

Change-Id: I276b6fe3e0a872a2e93170f3cea1002d3ce0dac9
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Anusha Koduru <kanusha@codeaurora.org>

Conflicts:
	include/linux/msm_mdp.h
msm: mdss: add retire fence support

Retire fence timeline should follow the actual panel vsync more closely.
For video mode the retire fence can be signaled along with the release
timeline with +1 offset, since this is signaled at vsync.
In case of command mode the panel vsync can be different from buffer
release timeline. To handle the command mode panel vsyncs better, create
a new timeline for the retire fence signaling.

Change-Id: If8a1eb717d733ca215275a8be4f0054091dbc147
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: houst0nn <houstonn@gmail.com>

Conflicts:
	drivers/video/msm/mdss/mdss_fb.c