msm: kgsl: Use the correct units for ADRENO_IDLE_TIMEOUT

In a few spots the ADRENO_IDLE_TIMEOUT value (measured in milliseconds)
was used directly for jiffy calculations resulting in timeouts that were
1000/HZ times longer than they should have been.  Use msecs_to_jiffies
for these situations.

CRs-Fixed: 448226
Change-Id: Ic0dedbad33630706d909931bf616bd69399f7ff1
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
msm: kgsl: set userspace memory type on each memdesc

Userspace passes a set of values indicating how it
uses each buffer it allocates, which were previously
ignored. These are useful hints for debugging and
profiling applications. These flags will be exposed
through ftrace and debugfs in later patches.

Change-Id: Ie26c26e413c074dcd5dfa24d355443ee47c3cd6a
Signed-off-by: Shubhraprakash Das <sadas@codeaurora.org>
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>
msm: kgsl: add userspace memory type to ftrace events

Add a "usage" field to memory allocation, mapping and
free ftrace events.

Change-Id: I673a9593650d5285b0abc8c94de8f9f80d3d449e
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl_trace.h
msm: kgsl: add per-process memory info to debugfs

Add a file for each process in debugfs named, kgsl/proc/<pid>/mem
which contains information about all memory allocations the process
has made.

Change-Id: Ice3f039d92cc1b1cdb5a6192808441ddfdf8abfb
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
Signed-off-by: Rajeev Kulkarni <krajeev@codeaurora.org>

Conflicts:
	drivers/gpu/msm/kgsl_debugfs.c
kgsl_iommu.c: Fix warning: 'get_iommu_unit' defined but not used
[-Wunused-function]
error, forbidden warning: kgsl_iommu.c:31

Change-Id: I7c469042804be0e269e3579ce13a9af914d6dbe1
vidc: Adjust core timeout based on input frame size

Video core is dropping certain IDR frames due to timeout.
This is resulting in video corruption. Computing the core
timeout based on input frame size and programming it for
each input frame fixes the issue.

Change-Id: I75d5039bc09f9be6a3028461ee4a2f13064bf53a
CRs-fixed: 370570
Signed-off-by: Rajeshwar Kurapaty <rkurapat@codeaurora.org>
vidc: fix wrong number of slices in slice delivery mode

The slices completed is not matching with the expected number
of slices in frame done. The fix is available in July firmware
release and this commit will have the corresponding video driver
changes.

Change-Id: Ic0c3c7ce4f9fdbcd6e8bed852a93dcc533d83a02
CRs-fixed: 380629
Signed-off-by: Maheshwar Ajja <majja@codeaurora.org>
Signed-off-by: Neha Pandey <nehap@codeaurora.org>
vidc:1080p: Add check for supported video resolution

1080p core can support max resolution upto 1920x1280.
Some of the video clips have a resolution more than
the supported resolution. Changes were made to check
for the supported resolution and stop the playback if
they exceed

Change-Id: Ia3fa9c38eef60d23644e54873849d528377ff722
CRs-Fixed: 362228
Signed-off-by: Mohan Kumar Gubbihalli Lachma Naik <mgubbi@codeaurora.org>
msm_fb: display: silent blending error warning message

If there had no any pipe blending stage changes, then do not
call belnding set up to avoid unnecessary warning messges.

CRs-fixed: 467556
Change-Id: I07520b3b0917375c41405e736dcb9eb8a3daddc1
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: fix the suspend/resume hang caused by wait4vsync stuck

wait_for_completion in wait4vsync stucks after multiple suspend/resume
tests. The cause is that when show_event timeout happens, or vsync isr
is disabled for long time, wait_vsync_cnt resets to zero, and in vsync
isr complete_all has no chance to be called which caused mdp hang. So
complete_all needs to be called whenever show_event has timeouts.

Change-Id: I124899ff95fd5550d2759d215f16fa9cb8c0c211
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
msm_fb: display: fix iommu page fault when iommu buffer freed

There has possibility that pipe commit come very close to next vsync.
This may cause two consecutive pipe_commits happen within same vsync
period which cause iommu page fault when previous iommu buffer is
freed since mdp stil fetching it. Set ION_IOMMU_UNMAP_DELAYED flag
at ion_map_iommu() to add delay un mapping iommu buffer to fix this problem.
Otherwise four buffer mechanism is needed to avoid this problem..
Also ion_unmap_iommu() may take long time to free an ion buffer. Move
mdp4_overlay_iommu_unmap_freelist(mixer) called after stage_commit()
to increase chance to have pipe_commit (up to stage_commit) is completed
within same vsync period
This patch also fix an potential race condition at wait_for_completion
between show_event thread and wait4vsync thread.

Change-Id: I089950ac61c0bd3c4207b8925817577e42fbb258
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay_lcdc.c
msm_fb: display: Do clock control within mdp4_hw_init

Since mdp4_hw_init() access mdp registers, mdp clock control
within mdp4_hw_init() is necessary.

CRs-fixed: 455506
Change-Id: I768f468314fc920029b4c88e49ef6a74f6b74f58
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
mms_fb: display: init pipe default configure as solidfill

Initialize mdp pipes default config as solid fill so that
there will have no memory fetch if pipe are staged into
mixer while flush bits are left behind and set at next vsync.
This is will prevent mdp iommu page fault from happening
at address 0x00000000 during resume.

Change-Id: Ide944ec1d069629f1ae2ecd0daf49c69ce2af2eb
Signed-off-by: Kuogee Hsieh <khsieh@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: mdp: Revert MDP Port split changes

Revert MDP changes to avoid bus overflow
seen in camera usecases.

Change-Id: I1c687750bd22c8f64ab28a500562cbfbcb6a6048
Signed-off-by: Kiran Kumar H N <hurlisal@codeaurora.org>
Signed-off-by: Praveen Ac <praveenac@codeaurora.org>
msm_fb: display: check FB_ACTIVATE_VBL bit only

FB_ACTIVATE_VBL bit is set to enable TE logic at pan_display
and unset to disable TE logic at pan_display for smart panel.
This patch checks for FB_ACTIVATE_VBL bit set only instead of
value.

CRs-fixed: 433399
Change-Id: I6fc913c6752fcca6a27c783c45ab318065217973
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: check active queue before signal timeline

This patch make sure active queue is not empty before signal
timeline.

Crs-fixed: 453745
Change-Id: I450c0923a67bdc90d06249e3ba83edb0b3b4b319
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: fix fence fd list be put twice

msm_fb_wait_for_fence() will put fence fd list if sync_fence_wait()
failed. After that same fd list wil be put one more time. This
cause a fd put twice and cause system crash at the time fd
was closed.

Change-Id: If6a358e051c98841e34c23d81098243003ef0836
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>

Conflicts:
	drivers/video/msm/msm_fb.c
Revert "msm: kgsl: add per-process memory info to debugfs"

This reverts commit 341c191634b0d58b33686fdf568e35b54bd82e85.
msm_fb: display: exit properly when rotator max session reached

When rotator session reach maximum, it should exit without calling
put_img since no get_img had been called.

CRs-fixed: 466462
Change-Id: I951570227ebd81da6dad19c1b897cde84f8d0451
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>