msm: mdss: remove cleanup done during overlay kickoff

Remove kickoff done from overlay kickoff, this was done to clear
potentially stale handles when the process using it has crashed. However
this case is handled in commit a3b3d215 by handling per process
resources.

Change-Id: I9c060b107c004c6cfb726ad84ae69d77461ed74f
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm: mdss: support FB memory reservation removal on 8x10

User space is allocating its own ION memory for composition
buffer, which makes the FB memory allocation in the driver
redundant.

Change-Id: I79d655bf0dac02fd2c6b9a40dfcc3cc5c6a4343a
Signed-off-by: Radhika Ranjan Soni <rrsoni@codeaurora.org>
msm: mdss: refactor ctl layer mixer programing

The layer mixer offset within ctl needs to map to the mixer allocated.

Change-Id: I6caa9d2423f4bfd326ebb4ce1080444fcc40c384
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: support wfd and rotation simultaneously

Concurrent rotation and WFD usecases need to be supported
using a single writeback hw module for low end targets.
To enable this feature, mixer, ctl and DMA pipe needs to be
shared between block and line mode operations and hardware
programing is synchronized with a shared mutex.

Change-Id: I0fe909dd07006282239c65d5fe92d270069a3920
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Introduce error checks for rotator sessions

When there are more virtual rotator sessions allocated than
DMA pipes available, rotator pipe allocations might fail and
corresponding error messages are printed which can lead to a
watchdog bark. This change silences those error messages and
also implements an extra check to avoid null pointer
dereference when a session is dequeued without a pipe.

CRs-fixed: 523701
Change-Id: I128ab85aac9e091b13a8772a43342d655c6f736f
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Allow DMA pipe sharing only on WB mixer

DMA pipe can only be shared on the writeback mixer for
concurrent line and block mode operations. Only allow
sharing if the mixer attached to the pipe is already a
writeback mixer.

Change-Id: I9a0e5144fdf87f681493cd92d9cc809836ab1a5c
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Avoid deadlock in interrupt handler

Reduce the locking scope in irq_dispatch so that
mdss_lock is not held when the irq_handler is dispatched.
The dispatched irq_handler will try to acquire mdp_lock but
another active process can already have mdp_lock and tries to
procure mdss_lock creating a deadlock situation. Not locking
with mdss_lock is acceptable as the calls will be synchronized
through mdp_lock from MDP clients.

Change-Id: I586b7e00c046dd4081b4e838e62e0a0556f4c717
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Reset hardware cursor flag on suspend

Reset hardware cursor enable flag while going
to suspend as cursor address doesn't remain
valid after iommu detaching which create
iommu page fault after resume.

Change-Id: I2fd484de72b62f39cdeaee025995afc975b3ba6e
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: Add support for BGRX format

MDSS hardware supports BGRX format, add support
of this in software.

Change-Id: Idd474afa6e05c3bb4832fd20ed68925ebf024b9e
Signed-off-by: Pawan Kumar <pavaku@codeaurora.org>
msm: mdss: parse device tree for dedicated wfd blk property

The presence of a dedicated wfd writeback block needs to be
retrieved from device tree, which can be used to determine
if WFD and rotator sessions need to be multiplexed.

Change-Id: I150b17d0ebb045aecc9c6e694632e5f89007c957
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Restrict SMP buffer reservation

Given two line latency buffer requirement for performance, in
some cases, three or more SMP blocks get reserved. This happens
typically for the usecases involving higher resolution layers
(e.g. 1080P). For these usecases required number of SMP blocks
exceed total number of SMP blocks available, thus causing SMP
reservation failures. These failures are often encountered in
8x26 target as it has in total, only seven SMP blocks available.

Restrict SMP buffer reservation to two SMP blocks, based on an
optionable device tree property, to be able to support most of
the usecases. This restriction is not applicable to horizontal
flip cases where two line latency buffer reservation is
necessary.

Change-Id: I7d57568b4b2710df0142bbc16749e56a9b492dfe
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>
msm: mdss: Modify SMP bitmap implementation to accomodate 44 MMBs

Expand current SMP bitmap implementation to allocate 44 MMBs of
APQ8084 MDSS.

Change-Id: Ib36331258646cedc1cca5285dc2c6490617f449f
Signed-off-by: Ujwal Patel <ujwalp@codeaurora.org>
msm: mdss: Always allocate SMP during pipe programming

SMP allocation should be independent of changing pipe parameters.
Always allocate SMP's during pipe programming. This avoids fetch
failures when overlay set is not repeatedly called during a rotator
session.

Change-Id: I682585986f37477f1d88d8f3462eee81143b181e
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: account for decimation when calculating SMPs

When performing decimation pixels will be skipped, thus there is no
need to allocate from limited shared memory pool to store these.

Change-Id: Icf1b6c0f8111e2e1347e15fd333980e208cce968
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
msm: mdss: enable overfetch in dual pipe scenarios

Overfetch is disabled on the borders of videos to avoid picking up
padding which may result in greenish border on right and bottom. However
this has side effect for dual pipe cases where overfetch is required for
smooth scaling effect in the middle of image. Add a flag to catch these
cases and enable overfetching in the middle.

Change-Id: I2545dbdab2c0643986fefa85990e9e820e4c3611
Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
mdss: Reduce minimum ib bandwidth

The minimum mdp ib for usecases such as portrait video is
high, causing unnecessary power increase, so it is reduced to a
optimal value for the purpose of both power saving and reducing
chances of underruns.

Signed-off-by: Huaibin Yang <huaibiny@codeaurora.org>
Signed-off-by: Naseer Ahmed <naseer@codeaurora.org>
msm: mdss: Adjust writeback mixer offset

With new targets, number of interface layer mixers have increased.
This increases existing macro values. Even though writeback mixers
have not changed, their programming needs to be adjusted.

Change-Id: I71bb6e6988d4e2bf2f66e0ecbb7ff9672d21b8dc
Signed-off-by: Shalabh Jain <shalabhj@codeaurora.org>
msm: mdss: Fix the ctx num for virtual ctl

When virtual ctl is allocated during simultaneous wb line and block mode
operation, the virtual ctl num should be the same as original ctl. This
is essential for color space conversion programing.

Change-Id: I1294a8f813e5b534cf10f9d4f721b42ce0bb6141
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Compensate for low VBP in MDP clock calculations

MDP latency is 4 lines with CAF and when the panel's vertical
Back porch value is lower than 4, the MDP clk rate needs to
be increased by 25% to compensate for the latency.

Change-Id: I732de52b4f5387d5c7992e893ea7cad5c6951811
Signed-off-by: Sree Sesha Aravind Vadrevu <svadrevu@codeaurora.org>
msm: mdss: Add plane alpha support

Clean up the blending rule to follow blend_op set from hwc.
Use modulate alpha for plane alpha when it is not 0xff.

Change-Id: Iad7217563bcae5e89fe8e50954494f6afdcb8e79
Signed-off-by: Mayank Chopra <makchopra@codeaurora.org>