msm: display: Buffer sync point support

Add MSMFB_BUFFER_SYNC ioctl for the communication of
the acquired and released fence fd between kernel and hwc.

Wait for acquired fence before pan display.
Signal the previous released fence after pan display

(cherry picked from commit fd384f86cd5214a9359c56dc93affe95f2d802a4)

Change-Id: I30a7b33f523acc6e42978c8cbd0fa526808a06ed
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c
	drivers/video/msm/msm_fb.h
	include/linux/msm_mdp.h
msm: display: add sync point support in overlay commit

Wait for fence signaled before commit, signal previous
fence after commit done. Same as pan display

(cherry picked from commit e622fc13cb58becfc077a830421e471abcc08140)

Change-Id: Ic7f95de86c5776a17ab1e5b7457e2dfb1108b576
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c
msm: display: make pan display as a non-blocking call

Schedule a workqueue, do the current job in the workqueue handler.
Block the second entry if the first one has not finished

(cherry picked from commit c760154faefd4772824cc2b032f5375f4ff1b75e)

Change-Id: I38d5487a9002d08449f865b35720adb54e158f5b
Signed-off-by: Ken Zhang <kenz@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c
msm: display: add display commit ioctl

Display commit ioctl will do what pan_display
can do, addtionally has customized setting, such
as non-blocking call.

(cherry picked from commit d88df9d27e44fc35d16c7a4ea92508db1df12d8f)

Change-Id: I17e781c96f93f3d937020392e3bb7f090283a0b2
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c
	include/linux/msm_mdp.h
msm: rotator: sync point support

Wait for fence before do rotate
Put the fence and fd after fence is signaled

(cherry picked from commit 78c7b6971a12a541c7bd55cb4998bf1bf285609e)

Change-Id: Ia9092a9d19e5c8390a05cef7bdf908732bbbf8d6
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: display: fence fd releasing

Release the fence fd after the fence has been signaled.

(cherry picked from commit 67945f986c46d592e26faba303b8b694397432a4)

Change-Id: Idc79eda3cbb518938d83a6c86a9af96db7f4675e
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: display: buf sync enhancement

Support wait for fence when flag is set

(cherry picked from commit 0745ebc4d82b4676da9b5ab8490824f6f9faa31b)

Change-Id: I2096103149874b3c7db90c38df59a1c767146994
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: display: allow fb open even in suspend state

resume might be coming later, allow fb open sucessfully, only
panel driver needs be delayed

(cherry picked from commit 89380aac14332dd3ff39a3f0904bfed117458abc)

Change-Id: Id24112f5bba7ba6290113987ebcc8ba6e4256419
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c
msm: display: Do not create release fence in suspend

When in suspend state, display operation will be stopped,
fence will not be signaled

(cherry picked from commit effec4d54954e67c91ba50eb228ecf56025d78ab)

Change-Id: Icbdd30995fa6662f28b003880c79d384d6f3b482
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: display: panel recovering from suspend

In suspend state, fb_open cannot turn on panel, need save this info
for resume.
In suspend state, blank setting needs be cached to be used at resuming.

(cherry picked from commit 9f7c82eaed91b9950d5ff5b1bbc77c6221a98afb)

Change-Id: I222f706774d0eed61a1cba6e8154ffd2337c2563
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: fb: make the pan task interruptible

(cherry picked from commit f35e93e2bbd636b25888d4283b17791b6f98fa78)

Change-Id: Ica9fea1b3523ba7c3e4e335ef9b0a54fbf1c8136
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: display: add more checking to ensure display is idle

Before execute operation on display, make sure it is complete idle
Because non-blocking display update has been introduced, need make sure
display update has finished in all entrances except the ones for
initialization.

(cherry picked from commit 43d62bf4b61cbaf52677126a4899ff8b489cdd76)

Change-Id: I18bee54c950404bea7ab89c9575c888e4c015935
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm: display: add mutex for display driver entries

In some cases, display driver is called by multiple threads, this
will cause re-entrance problem. For example, one thread is
calling display commit, the other turns off the display. In order
to serialize the operation, mutex is added to most APIs.
Only the ones for initialization won't be added.

(cherry picked from commit 12c51684416bf5cc14d645fb741eea8d3d6627fa)

Change-Id: I84359d2e89930b61f5a0641b5e3078f9846c60ab
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	drivers/video/msm/msm_fb.c
msm: display: sync point handling in blanking

Release all fences when go to blank

(cherry picked from commit 2575a4aa634aec1c198dd8bc851c5a002dff2278)

Change-Id: I9d6a1f4ccd97b188497866b7f27cd9d3f84c94fc
Signed-off-by: Ken Zhang <kenz@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
updating ION headers to support JB_chocolate kernel and mr 1 HAL

(cherry picked from commit 9dd583b5dfafaf5077e72b89df3708b99c0cb679)

Change-Id: I92de796d0697f70db19a42fd0381782b0eac5f7e
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
msm_fb: display: matching MDP IOCTL numbers with userspace

(cherry picked from commit 923093ce7da6ca017ebe7e40cb8d812cedbc3066)

Change-Id: Icbcedc4c809ae61af2737b9919fe03b4efa58e46
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>

Conflicts:

	include/linux/msm_mdp.h
msm_fb: display: Protecting error condition if pipe alloc fails

(cherry picked from commit 4904a6e1f0ec57c0f1e240afc00314154317bc9c)

Change-Id: I4c41184fbbe2d40bdd36d40dd21d9a98adb2a76a
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>
Signed-off-by: Siddhartha Agrawal <agrawals@codeaurora.org>