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: Ie1639fe75718038c8149e519952f7085dede4c0a
Signed-off-by: Jeremy Gebben <jgebben@quicinc.com>
(cherry picked from commit 33bceb148eaadf18ea91378dd9b9ac5861b36a09)

Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
Revert "msm: kgsl: fix 2d IB processing"

This reverts commit b7237ae5947769d1e4220bf857036d719404643e.

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

This reverts commit 80429f2e22d111b1b1a5b36ff823a80af7644ce9.

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

This reverts commit bd4ce97c73d6f7a26e8fde518d6270ae86736acd.

Change-Id: I9857ab02b7fe0e980203888f8f4365df8318c1e1
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: fix 2d IB processing

The 2d hardware handles ringbuffer and IB commands as
a series of gotos. At the end of each IB, there must
be a goto command back to the ringbuffer, which must
be "monkey patched" into the IB by the driver.
Fix this code to use a proper kernel mapping.

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

(cherry-picked from commit d27b09f388bab25f7e15ed9c5ca5eb1203c85492)

Change-Id: Ie41b50f2bd33d3e854e179ad4ada075422bfa77f
Signed-off-by: Zhoulu Luo <zluo@codeaurora.org>
driver: gpu: msm: cleanup