msm: kgsl: Don't do intensive memory recovery when allocating big pages

We don't want to incur too much overhead when allocating big pages
so don't attempt to retry, perform reclaim, or run memory compaction
on high-order allocations.

Change-Id: Ic0dedbadb354c6faea34abec36aee268ac0f2c34
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Insert kgsl idle for iommu-v1 when pagetables are changed.

An idle is needed for iommu-v1 before programming both tlb registers
and the pagetable register. Without this idle faults are observed on
2D core because a process uses another processes pagetable.

Change-Id: Ief14cd79b8e7ffaed413da49dc4b9e8416233186
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Add NULL check for next_event hook

KGSL driver needs to check that the function pointer
is not NULL before calling the hook. next_event
is an optional function not implemented by the 2d
core. This fix ensures that optional and unimplemented
function will not invoked by the driver.

Change-Id: I687b028260e3ec304d973c6a5bded0a8fdbfb73b
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm: kgsl: Don't consider active count if not in active state

Don't consider active_cnt variable if not already in ACTIVE state.
The active count variable does not necessarily exactly indicate the
number of open handles to GPU for switching power state. Hence,
only wait for active count to reach zero before switching to SUSPEND
state if, the current state is ACTIVE.

CRs-fixed: 483154
Change-Id: Ie025a1873cfb9237bdfba89204f4c2116549eba4
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
gpu: msm: Allow retries for 0 order allocation

When allocating order 0 pages we allow the allocator to retry
the allocation to ensure we can take advantage of pages that
are being reclaimed. This will help avoid unnecessary out
of memory errors from kgsl clients.

Change-Id: Iec2a0a1fe10302c320a58cef90ae1ee7e35d71ee
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
msm: kgsl: Protect the mem_entry list during deletion

Use the spinlock to prevent corruption of the mem_entry list during
deletion. Otherwise the mem_entry list may be modified by another
thread at the same time resulting in memory corruption.

Change-Id: I5728a8b925753d5fda82413615e5ebaf0366dfd8
CRs-fixed: 489224
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: kgsl: Submit a draw command on resume

For A305, submit an extra draw command while resuming the GPU from
SLUMBER state. This fixes corruption seen when the screen is
turned on.

Change-Id: Iafed90b617b0a700ac3f2afcb6d9ecadca590914
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
gpu: ion: Do fallback when allocating large sizes

The preferred allocation of memory for kernel data structures in
ION is to use kmalloc. This is mainly for performance reasons. However,
we are not guaranteed to be able to allocate large sizes. So to keep
the code performing well and at the same time allow for larger allocations,
implement a fallback mechanism for allocation of memory for ION kernel data
structures.

CRs-Fixed: 488521
Change-Id: I8c6a13ad74cce69f590920d28c01a58f7a540fd2
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
[Resolved merge conflict]
Signed-off-by: Chintan Pandya <cpandya@codeaurora.org>
msm: kgsl: Always resume the GPU regardless of its state

Make sure we resume the GPU regardless of its current
state. If the device is not in suspend state restart the
device and  print an error message.

Change-Id: I9e71cbe27d360dc06513c54f3a734aaea5b10d2b
Signed-off-by: Suman Tatiraju <sumant@codeaurora.org>
msm: kgsl: generate descriptive names for kgsl-timeline

Generate names for kgsl-timelines using the following format:
<device>-<thread name>(<tid>)-<proc name>(<pid>)-<context id>

This makes it possible to identify the context of a timeline in the
sync dump, which makes it much easier to identify which context has
a GPU timeout.

Change-Id: I0ce0614a53a93fd81094d92c9bef7053e6d416d2
Git-commit: e3348f389f715cb2143a708ec6796d3f65e03821
Git-repo: https://www.codeaurora.org/gitweb/quic/la/?p=kernel/msm.git
Signed-off-by: Fred Fettinger <fred.fettinger@motorola.com>
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: show timestamp in sync dump

Improve the debug information printed for kgsl points and timelines.

kgsl_sync_pt_value_str:
  - show timestamp passed to kgsl_add_fence_event()
kgsl_sync_timeline_value_str:
  - show most recent timestamp passed to kgsl_sync_timeline_signal()
  - show last retired timestamp according to kgsl_sync_get_timestamp()

Change-Id: I93fe408b06de054b11e05784cd7175ed3fcb76ad
Git-commit: 595e213985f63d6aa484c966a4f4a710b31ca209
Git-repo: https://www.codeaurora.org/gitweb/quic/la/?p=kernel/msm.git
Signed-off-by: Fred Fettinger <fred.fettinger@motorola.com>
Signed-off-by: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
msm: kgsl: Remove extra call to sync_fence_put()

sync_fence_put is called twice and cause NULL pointer dereference.

Change-Id: Ia29e676af28d9040d1ba1ee8669f1306cc8b4035
Signed-off-by: Alex Wong <waiw@codeaurora.org>
msm_fb: Correct R and G offsets for correct mapping

R and G colors are swapped when ARGC test cases are executed.
Correct the color mapping to right register offset to fix
the color swapping issue.

CRs-Fixed: 491215

Change-Id: I4997acce577bdbbdf39e22502a678dbecf0bfc37
Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
msm_fb: Increase base fence timeout

The earlier value of 1 second caused unnecessary warnings on
heavy workloads by the GPU.

Change-Id: Ib4a5b098267251d5c63c4d8d2a2f51b339acc1d2
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
msm: rotator: Add proper checks for enabling Fast YUV

For rotator version 2.0 and above, there is support for fast
YUV which gives better rotator performance. However, there are
few constraints related to height under which fast YUV cannot be
enabled when 90 degree rotation is enabled. Make sure
to add proper checks before enabling fast YUV.

Change-Id: Iafd204a6e4ef09e1151d01d8fde35359b7c3b7a5
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm: rotator: Enable support for 2-pass fast YUV mode

Add support for 2-pass rotator operation for downscaling
and 90 degree rotation when rotator operates in fast YUV
mode. 2-pass is supported for 420 H2V2 formats.

Change-Id: Ib8ce802a5a8aabe10c88422e3b8d82708c5b05d4
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>
msm_fb: display: Add pseudo-planar 422 H1V2 support in the MDP4

Rotator outputs pseudo-planar 422 H1V2 for interleaved inputs
on 90 degree rotation. Add changes to support MDP_Y_CRCB_H1V2
in MDP4.

CRs-Fixed: 371303
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>

Conflicts:

	drivers/video/msm/mdp4_overlay.c

Change-Id: I730a3196df8d0c204e6334c2c8b9199d15cbb16a
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm_fb: display: Fix interleaved 422 input format register settings

Check to update chroma sample information in source format register is
based on fetch plane value, which does not take into account for
interleaved 422 input format. Remove this check and set chroma sample
values for RGB formats as well.

CRs-Fixed: 501035
Change-Id: If8fd47b6d47b326efd1cb70ce9701ac1d457dcfd
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: rotator: Add pseudo-planar 422 H1V2 dst format for MDP4

Rotator outputs pseudo-planar 422 H1V2 for interleaved inputs
on 90 degree rotation.Add changes to support MDP_Y_CRCB_H1V2,
MDP_Y_CBCR_H1V2 in MDP4.

CRs-Fixed: 371303
Change-Id: I42ea86992fc77cd335437a47611e9f640f30ed25
Signed-off-by: Mayank Goyal <goyalm@codeaurora.org>
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: rotator: Pass ION flags correctly for 2-pass buffer allocation

With updated ION interface, ION_SECURE needs to be passed as a
separate flag. Also, 2-pass buffer for secure session needs to be
allocated from CP heap instead of non-secure heap.

CRs-fixed: 502038
Change-Id: I8c5f945dc4d90ce640872e2cd0505ac32e82011d
Signed-off-by: Padmanabhan Komanduru <pkomandu@codeaurora.org>