video: msm_fb: Ensure backlight is scaled atomically

Ensure that when backlight scaling ratio or backlight level is being
changed that the operation execute atomically. This prevents a backlight
level change from being overwritten when it interrupts a backlight scale
update.

CRs-Fixed: 404017
Change-Id: I708513cfcec558c5d65f21f189dd52331fdf0f4f
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit ce328861aa1f4fa489e9abfc9d1e02b13af2ba47)
msm_fb: display: Add timeout for waiting on update

Content Adaptive BackLight userspace algo waits on UPDATE_NOTIFY to
get the screen updates. When turning off CABL, this blocking ioctl
causes the CABL threads to wait until next screen update, which may
take indefinite time.

Add timeout value to the wait_for_completion call, to make ioctl
call blocking for at most timeout value.

CRs-Fixed: 384026
Change-Id: I6715a36020c24ddd09823bd54d4321900429a6b9
Signed-off-by: Kinjal Bhavsar <kbhavsar@codeaurora.org>
(cherry picked from commit 1b6843a3a56e60e73305c66369f8ad806353e22d)
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
video: msm: Send ETIMEDOUT on update-notify timeout

Send the ETIMEDOUT errno when the update-notify wait_for_completion times
out. This is required to be able to properly handle the different failure
cases in the functions that use the update notify ioctl.

Change-Id: I0e46b0b0c89f6b2e5beb3fc0ed18ebbb75dfa434
Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
(cherry picked from commit b640c29b8b3b4a0733924a6e4ad0665d5218a7dc)
msm: kgsl: Turn off the CP_DEBUG dynamic clock

The CP dynamic clock seems to be glitchy when the CP clocks are turned
back on after a power event. Turn off said dynamic clock control at
init time. The impact of leaving the dynamic clock control off is
negligible since the CP clock is only on when the CP is actually in
use.

CRs-fixed: 402119 409253 413224
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
(cherry picked from commit ed201aa291dfe13629d8c6cfa1d6e6f229b0c3c2)

Conflicts:

	drivers/gpu/msm/adreno_ringbuffer.c

Change-Id: I6e32bac8f577011518489baaf3ee993b11401ed6
Signed-off-by: Ramakrishna Prasad N <crpn@codeaurora.org>
Merge "msm: kgsl: Turn off the CP_DEBUG dynamic clock"
msm_fb: display: add checking y direction for alpha drop

Alpha is dropped when scaling with non repeat pixel method.
Both x and y direction of scaling need to be cehcked for
alpha dropped.

(cherry picked from commit f0d08071a4e97c9018b8e8def498e07720201da8)

Change-Id: Ia35f711f8876a44aa27cafde557c350c2bd47b53
Signed-off-by: Kuogee Hsieh <khsieh@codeaurora.org>
msm_fb: display: add mdp clk rate calculation for low vbp

For the panels that have low v_back_porch, if h/w FIR scaling is used,
during vbp time, mdp clk should be fast enough to output a line from 4
input lines. MDP rate equation for very small scaling, e.g. 1 or 2
pixels' upscaling or downscaling cannot cover this case, where
underruns are seen on those panels.

(cherry picked from commit e9d4bc826ca849b873f9e91bda68004aa7d78b25)

Change-Id: I21bcd9e0f66ff84d711915042f2aa8ed90efb78f
Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Merge "msm_fb: display: add checking y direction for alpha drop"
Merge "msm_fb: display: add mdp clk rate calculation for low vbp"
msm: kgsl: Ensure correct GPU patch ID is set.

Correct the patch ID that is returned by newer versions of
the GPU hardware.  This ensures the correct firmware is used
for the GPU.

Change-Id: I5c29d28a88f8f2e34ea0b6962b74358a55939f86
Signed-off-by: Akshat Saha <asaha@codeaurora.org>
Merge "msm: kgsl: Ensure correct GPU patch ID is set."
gpu: ion: avoid race condition while checking virtual address.

Grab and release mm_struct semaphore before doing cache
operation leads to race condition. In order to avoid that,
the semaphore is released after cache operations.

CRs-Fixed: 418933
Change-Id: I220afbec23884a1ac190220e59223b0f6ed6986f
Signed-off-by: Utsab Bose <ubose@codeaurora.org>
Merge "gpu: ion: avoid race condition while checking virtual address."
msm_fb: display: Fix blend configuration for command mode panels

For command mode panels, blend registers does not get configured
as per the use case. This leads to incorrect blending of layers
resulting in lower layers (eg. wallpaper or buttons in video
playback) to show above the upper ones, making overall user
experience to go bad. In order to resolve the issue, blend registers
are now configured properly by as per the use case.

(cherry picked from commit 17e116a8ba55957248cf799de54997cf249e14c2)

Change-Id: Ia122bee6ec8afeae872573e148bf495e5d2f46b1
CRs-Fixed: 410029
CRs-Fixed: 415553
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
Merge "video: msm_fb: Ensure backlight is scaled atomically"
Merge "msm_fb: display: Fix blend configuration for command mode panels"
vidc: Error handling for memory heap mapping.

Memory heap should be unsecured if secure call is successful.
This change will make sure that an unsecure will be called
only if securing of the memory heap went through fine.

CRs-Fixed: 393041
Change-Id: I49dd81d1846fc6936518c750a32921c8498ddb95
Signed-off-by: Gopikrishnaiah Anandan <agopik@codeaurora.org>
Signed-off-by: Riaz Ur Rahaman <riazr@codeaurora.org>
Merge "vidc: Error handling for memory heap mapping."
Update copyright to The Linux Foundation

Change-Id: I9506b5d7f3ff2f133deed37adce9e3ec34d4eac9
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
Merge "Update copyright to The Linux Foundation"