msm_fb: display: fix incorrect MDP formats components unpack pattern

Many of MDP input formats don't have correct unpack pattern, so image
displayed on screen is not in the actual format set.

CRs-fixed: 339114,337040
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
(cherry picked from commit c5638f898324df37e40e402d208b0e97337d536b)

Change-Id: I66a404db039502d0511cd3d7dc34e81c0eca1d61
Signed-off-by: Gopal G Goberu <ggober@codeaurora.org>
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: kgsl: set the dma_address field of scatterlists

Ion carveout and content protect heap buffers do not
have a struct page associated with them. Thus
sg_phys() will not work reliably on these buffers.
Set the dma_address field on physically contiguous
buffers.  When mapping a scatterlist to the gpummu
use sg_dma_address() first and if it returns 0
then use sg_phys().

Change-Id: Ie5f19986446be4383dfbfffa2534136b592e8e46
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
(cherry picked from commit 582fe31d2719b45fd0accf85bf2351f1a15b97b7)
msm: audio: qdsp5v2: Update PCM driver to use pmem memory (squashed commit)
msm: rotator: provide dst format based on src format (squashed commit)

We must apply the changes from upstream manually since the source file is
located at drivers/video/msm/ instead of drivers/char/.
msm: rotator: move the source to drivers/char/ as upstream did
msm_fb: update headers to match with new QCOM libs
msm: rotator: updated to latest CAF version
pmem: fix buddy free memory corruption bug

    Enforce explicit upper limit for buddy index during memory free
    operations. This index is generated during memory free operations of
    the buddy bestfit allocator. The index points to each free buddy that
    should be coalesced into a greater free memory area. The upper limit
    now enforced is the number of entries in the current PMEM region.

    Without this fix, pmem_buddy_bestfit_free would continue to corrupt
    bytes in ever higher addresses, by power of 2, of memory until
    stopped by the high bit being set in the currently examined byte.
    Unless the high bit was set immediately at the first invalid byte,
    this could have caused memory corruption past the current pmem region
    metadata in kernel memory space.

    One manifestation of this problem was a corner case where
    non-existent buddies were incorrectly coalesced.

    In a 12MB region, the buddy free for 8MB tried to coalesce the freed
    buddy metadata with a non-existent 8MB buddy which actually belonged
    to the following region. This caused the order number in the metadata
    belonging to the following region to be incorrectly incremented past
    the region boundary. Soon after, there was a subsequent invalid
    allocation in that following region past the region boundary.

    Signed-off-by: Stephen Biggs <sbiggs@quicinc.com>
pmem: source renamed to be consistent with upstream
msm: vidc: add missing encoding levels
msm:kgsl: set state as requested state when in NAP

Fix the state to requested state so that when both ISR and
timer fire at the same time, the state is set as SLEEP

CRs-Fixed: 340484
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
(cherry picked from commit 9b6110bb38c7acf61e065ec206b62b1e1f089908)

Change-Id: Ie625aba09feddf495647be2844dc0a4014605141
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
hack to rip out "+" trailing in local string
UPDATE: Multiple kernel patches [Code Aurora]
msm: kgsl: increase valid timestamp range

The existing timestamp_cmp function returns a different
result depending on the order of the input parameters due to
having an asymetric valid window. When no rollover is
detected the window is 2^31 but when a rollover is detected
the window is 25000. This change makes the rollover window
symmetric at 2^31.

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

Conflicts:

	drivers/gpu/msm/kgsl.h

Change-Id: I22dcc773438df32f105dc8bd069051c48fde5018
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: kgsl: flush outer cache for alloc_page() pages

The outer cache needs to be flushed for these pages
after they are allocated so that the GPU and CPU
have a consistent view of them.

CRs-Fixed: 346921
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
(cherry picked from commit 7018a21bf2b52f1296557d1f6ec9ed64e9169de7)

Change-Id: Id5c11ab8d856fc270330fd3258baa51b8efca192
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
msm: kgsl: Resolve conflicts in state changes

Only check requested state once, and fully transition to that
specific state.  This will resolve any conflicts arising from
changes to the requested_state as the state transition occurs.

Signed-off-by: Lucille Sylvester <lsylvest@codeaurora.org>
(cherry picked from commit e4a7c1a365ea32aebfe3995e13fc63ca8c2916c5)

Change-Id: I9d351d9d7e479389e473fc6e54d9d06d7ef200b9
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>
Revert "msm: audio: qdsp5v2: Update PCM driver to use pmem memory (squashed commit)"

This reverts commit 0ee4e0fb5ef4dc06509952a6dc3fc45d4215192e.
msm_fb: new version backported from primou 3.o kernel

Change-Id: I1cefad019f03f61dc65c56f255cdec2a1f89874c
semaphore: fix compiling error
msm: kgsl: Allocate physical pages instead of using vmalloc

Replace vmalloc allocation with physical page allocation. For most
allocations we do not need a kernel virual address. vmalloc uses up
the kernel virtual address space. By replacing vmalloc with physical
page alloction and mapping that allocation to kernel space only
when it is required prevents the kgsl driver from using unnecessary
vmalloc virtual space.

CRs-Fixed: 346921

Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
(cherry picked from commit 8cb835b656ae2c3faa79af4f374563d344b46d4a)

Conflicts:

	drivers/gpu/msm/kgsl_sharedmem.c

Change-Id: I88e1eb282cc4822970811728d00b1096188f64e9
Signed-off-by: Ram Kumar Chakravarthy Chebathini <rcheba@codeaurora.org>