base: genlock: Use a signed long for the result from wait_timeout

interruptible_wait_timeout returns a signed long, so make sure that
we use a signed long to hold the result. Using an unsigned value would
horribly misinterpet an error such as -ERESTARTSYS.

CRs-Fixed: 341347
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit be669bc92358653a46c63f2352e6d981f9ed3bdf)

Change-Id: Ifcf555f8719f9c74fdb6d8b5cf2a32582988335b
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
base: genlock: allow synchronization with a single gralloc handle

In order to support synchronization in a process with a single
gralloc handle we require the ability to write lock a buffer
while it is already read locked by the same handle. This change
extends the concept of an exclusive write lock or recursive read
locks to a genlock handle (rather than the genlock lock).
Genlock cannot provide deadlock protection because the same
handle can be used simultaneously by a producer and consumer.
In practice an error will still be generated when the timeout
expires.

CRs-fixed: 356263
Change-Id: I322e7fadc8b43287f53b211242b176d3de731db2
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
base: genlock: protect kref counting with spinlock

A race condition exists where the attach may not kref_get
before the kref_put finished. The genlock_file_lock was
originally added to protect against this case however it
was not protecting the kref.

CRs-fixed: 359649
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
(cherry picked from commit d6f534fc51eb5fc23d08dacceecd42a4b98747a6)

Change-Id: I4115ea1cc39ebe38ad0032ebf86871ac9d23a312
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
(cherry picked from commit 295371180c3c46c0078ad247a53e1c8364aeee1b)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
base: genlock: add magic to protect attach from non-genlock file

It is possible for user space to attempt to attach a valid fd that
does not correspond to a genlock file. This change adds a magic to
the kernel private data that is used for validation.

CRs-fixed: 359649
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
(cherry picked from commit 507a9d3354b24e7cc7f22e9695339de6df317fc1)

Change-Id: Ice93bfc904f61431688f03027a4090ceb7b9289a
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
(cherry picked from commit 6856721e05a2e97130a654884a16cf8d79753d58)

Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
msm_fb: Avoid multiple disable calls for vsync interrupt

For LCDC and DSI Video mode panels, there seem to be multiple
disable calls for Vsync interrupt term. Change to avoid this
issue by proper synchronization of vsync term and DMA term.

Change-Id: Iaf11ba92cc7db55c6196add2d7dea581cb29fc8a
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp_dma_dsi_video.c
msm_fb: Release semaphore when display Unblank fails

When continuous splash is enabled, the display subsystem will be
turned on during first pan display after boot up. During this
process, we acquire a semaphore. Release the semaphore if display
init fails and the function has to return early.

CRs-fixed: 441973
Change-Id: I4c8ba0b5e7710a6f3d409be619d5014b3ee32e5b
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm: display: Reset BG_alpha register while alpha blending

Reset BG_alpha register when pre-multiplied alpha is not
set for a layer during blit request.

CRs-fixed: 351158
Change-Id: If103af384d59c3349cb2ef556a497c709d9280a2
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm_fb: Correct the chroma offset calculations for Yamato format

In the PPP blit operations, when the source image format is
Yamato, there is chroma offset calculations going wrong in
the case when a frame is split into parts and blit is done
separately. Correct the chroma offset calculations in this
case.

CRs-fixed: 366908
Change-Id: I867024632fda9f64a569150e0b6389d55614cd3a
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm_fb: Fix chroma offset calculation for YUV as source format

For frame composition using MDP, fix the calculation of source
chroma offset pointer to be programmed to MDP hardware whenever
the crop 'y' value is non-zero. This prevents green lines/chroma
shift and other artifacts from being seen on the panel.

CRs-fixed: 438027
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
(cherry picked from commit 396e4abfd12cd1feeef71fddff5d6752ee136632)

Change-Id: I8b47d22d5d660d1c4fe6acd3ae2a5db9c6393e7c
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
gpu: msm: Bulk update kgsl to 3.11

Squashed commit of jb_chocolate up to

Author: Tarun Karra <tkarra@codeaurora.org>
Date:   Thu Sep 20 13:27:20 2012 -0700

    msm: kgsl: In kgsl release do not idle if device is in HUNG state

Change-Id: I8b5f3acd7358255c090a45dbb6972b50c3b34534