bcmdhd: Enable the P2P interface

Change-Id: Ibe708048919dc0cdcc1a683b3ec0dff7cff0593a
d2: Enable KSM and compaction

Change-Id: Id2328bc5856029d8e1de9fd019afa129e72408d0
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>
msm: kgsl: release the wakelock when going to suspend

This change is needed only if slumber is disabled
CRs-Fixed: 355216
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
(cherry picked from commit 48e727689b8fabbb44f20e86f1ad6a04b8111e0a)

Change-Id: I5183e9e409f494757e44a919b87d3b078ac9ea7d
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: kgsl: disable early suspend and late resume for 2d cores.

The powerrail off during slumber is causing a GPU hang

CRs-Fixed: 355216
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
(cherry picked from commit 2bd5c33b0c7a47fffc089ced6d14efc0369a5bdc)

Change-Id: I6a1d933abaca690124170dbda2a3ccc0cb1879b3
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: kgsl: fix cleanup code in kgsl_ioctl_map_user_mem()

ion handles need to be handled differently than pmem or
ashmem handles.

CRs-Fixed: 359268
Change-Id: I20637644f247859245fbba80e5bc6b50fd896403
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: kgsl: convert timestamp_cmp logic to use unsigned logic

The meaning of timestamps becomes difficult to understand when
converting between unsigned and signed values. Values that
were seperated by 0x80000000 also returned inconsistent
results.

CRs-Fixed: 355752

Conflicts:

	drivers/gpu/msm/kgsl.h

Change-Id: I5d5d1ad64ef120da8769d72ac69dde37f8f5c6ae
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>

Conflicts:

	drivers/gpu/msm/kgsl.h
base: genlock: remove BIT macro usage

The BIT macro is not defined for !_KERNEL_ resulting in compile errors.

CRs-fixed: 356263
Change-Id: Ib2acd913033fccca63716d6585a51707c72debf0
Signed-off-by: Jeff Boody <jboody@codeaurora.org>
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm_fb: HDMI: Do not add HDCP reauth timer during probe

Currently all HDMI/HDCP timers are initialized in the driver's
probe function with a maximum possible expiration value. However,
the 32-bit jiffies value is initialized in the kernel so as to
wrap 5 minutes after boot. This results in the HDCP timer being
fired 5 minutes after boot even though reauthentication is not
necessary. This change fixes this issue by not starting the HDCP
reauth timer during probe. The timer is only started when an
authentication failure is detected from an existing valid HDCP
session.

CRs-Fixed: 352080
Signed-off-by: Aravind Venkateswaran <aravindh@codeaurora.org>
(cherry picked from commit ca15287e50fe00dd6526fdc166cb526298099fb2)

Change-Id: Ia3e240c3c0c32b6ef9fa2c58e48a5cadb64791b8
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
(cherry picked from commit b44b96003a28d22433731b7d53db57cc5641a052)
video: msm: wfd: Don't signal HDMIDaemon to mirror on FB1

Remove obsolete code that signalled HDMIDaemon to mirror the
display on FB1.

Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
CRs-Fixed: 352830
(cherry picked from commit 4102d704243cf0ff297cdbe8d5b731da4c0bb9d5)

Change-Id: I07fabb754a49fe398813e864067f96c66a47f489
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: vidc: Metadata memory release issue.

Metadata memory is not freed when there is
memory allocation failure in ddl open. Fixed
this issue by freeing the metadata memory.

CRs-Fixed: 353109
Change-Id: I3f6fd93498aea0ce78092bd3a28cf08625b0ca77
Signed-off-by: Anil Gahlot <anilg@codeaurora.org>
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
(cherry picked from commit af296715bd5db6c38997d1171d079331c8650287)
(cherry picked from commit 572e147402717bb0c77ecc807659d05a617e370f)
vidc: Check for proper buffer handle before free.

Check for proper buffer handle and client handle
before unmapping and freeing the buffer.

CRs-Fixed: 351100
Change-Id: I88f5e142839f12cc19360dbe26a8d4e6a7ec99de
Signed-off-by: Deepak Kotur <dkotur@codeaurora.org>
(cherry picked from commit 974a96c1634659213f7d226fa5092398ddd46398)
(cherry picked from commit 222e467f121840d69ff2701682bc7ece7420a502)

Conflicts:

	drivers/video/msm/vidc/common/dec/vdec.c
	drivers/video/msm/vidc/common/init/vidc_init.c

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
(cherry picked from commit a46d7d966ce99a55a5806f48de50d407c1dbb77a)
msm_fb: display: disable pan display and memory access to fb1 and fb2

The native fb1 and fb2 framebuffer memory is not used and not
allocated on the board file. So on the driver side, pan display ioctl
or other operations on fb1 or fb2 framebuffer memory is checked and
invalidated.

(cherry picked from commit ca61dbb1d9f0d8fe2c4d5871d9934379708c1091)

Change-Id: Ie3e85e20f5675f9cfe02c4587f0fe119e8d57e76
CRs-fixed: 357242
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
(cherry picked from commit 722c3f5d85f95a5f6bf6b94dfb39cc8813ceb572)

Conflicts:

	drivers/video/msm/msm_fb.c

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
(cherry picked from commit c5bbffec2019ad4f4f574f0719a1a98d4c7fa5f7)
msm: board-8960: Disable idle standalone PC

On 8960, standalone PC could be enabled by mpdecision if it isn't
enabled by the init scripts. Disable standalone power collapse mode by
removing the table entries in rpm resources and cpuidle.

Change-Id: I8dda27e5f1c2093ff3f769e9d790165e92e01ff5
Signed-off-by: Mahesh Sivasubramanian <msivasub@codeaurora.org>
(cherry picked from commit d1d288e3fc7c896695ee75149994a3999bffa0d6)
gpu: ion: Fix fragmentation message log condition

If an ion allocation fails because of memory fragmentation a debug
message should be printed. However, the logic that decides whether
the debug message should be printed or not is incorrect causing
the debug message to not be printed when it should.

CRs-fixed: 359593
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 099501a01beda17a8b5be3ebc13d51791d96a269)

Change-Id: Ic91b9e97852b37461f4df503b2940714a344bdc2
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
gpu: ion: Leave fmem in c-state until unsecured

When the last buffer is freed from a heap that uses fmem we call
into fmem to transition the memory from c-state to t-state. However,
if the heap has been secured for content protection transitioning
the memory from c-state to t-state could cause undefined behavior
in fmem.

Add checks to ensure that a secured heap will not transition to
t-state until heap is unsecured.

CRs-fixed: 359593
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
(cherry picked from commit 20f3b6d7591986db8ff46a7f7e333b3c30db04e8)

Change-Id: I0d58b82bb119f4d621a3ddf1891dc477322ad532
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
arm: vfp: Bounce undefined instructions in vectored mode

Certain ARM CPU implementations may not raise a floating-
point exception whenever deprecated short-vector VFP
instructions are executed. Change the VFP exception
handling code to emulate short-vector instructions even
if FPEXC exception bits are not set.

Signed-off-by: Stepan Moskovchenko <stepanm@codeaurora.org>
(cherry picked from commit 00a13be874f230159a6b7f8cc9d0ff23bc1b7d05)

Change-Id: I3ac7a72488fe0250c370a3ef2c6790dbdfec8488
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
(cherry picked from commit b2b963a537bef699b0f154073476711e6f734c47)

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: kgsl: Store process mem entries in a rbtree

The list of memory objects attached to a process gets searched quite
a lot during normal operation of the driver.  For processes with a
lot of memory allocations, the linear search through the list is O(N)
and uses a lot more CPU during critical loops than it should. Change
the mem entry list to a rbtree for faster search speeds.

Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl.c
(cherry picked from commit c9559e461e3df1b828218421430a38c9d7a38ca4)

Change-Id: I844f7907823e2e53d8b588dc186defd7b2194694
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: kgsl: rework ib checking

Separate ib parse checking from cffdump as it is useful
in other situations. This is controlled by a new debugfs
file, ib_check. All ib checking is off (0) by default,
because parsing and mem_entry lookup can have a performance
impact on some benchmarks. Level 1 checking verifies the
IB1's. Level 2 checking also verifies the IB2.

Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno.h
	drivers/gpu/msm/adreno_pm4types.h
	drivers/gpu/msm/adreno_ringbuffer.c
(cherry-picked from commit d0ab6adeeae7dd039069fd93e6649777aff23668)

Change-Id: Iea0b282d6b532016a358934c1323b8a8e415d3df
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
msm: kgsl: Use kzalloc to allocate scatterlists of 1 page or less

The majority of the scatterlist allocations used in KGSL are under 1
page (1 page of struct scatterlist is approximately 1024 entries
equalling 4MB of allocated buffer).  In these cases using vmalloc
for the sglist is undesirable and slow.  Add functions to check the
size of the allocation and favor kzalloc for 1 page allocations and
vmalloc for larger lists.

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

Change-Id: Ib520a5c19f5b8e12698a368456f1753a31c927e1
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>

Conflicts:

	drivers/gpu/msm/kgsl_sharedmem.c