msm: mdss: Store AD backlight notification function

Store Assertive Display backlight notification function while locked to
prevent race condition where AD is disabled while lock is released,
setting function pointer to NULL.

Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Add backlight notification support for PP features

Notify post-processing features whenever there is a backlight change, so
that PP feature can update accordingly.

Signed-off-by: Ping Li <quicpingli@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Update BL on first AD update

First AD update is not updating with current backlight value. Initialize
last_bl variable so that first request updates backlight along with user
specified input.

Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Use primary display backlight in WB AD case

When AD is configured to run on the writeback display, it needs to use the
primary display's backlight configuration for getting, setting, and being
alerted to backlight changes since the writeback display does not have a
backlight to itself.

Signed-off-by: Carl Vanderlip <carlv@codeaurora.org>
Signed-off-by: Ping Li <quicpingli@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: refactor pipe list management

A pipe can only belong to either used list or cleanup list, to ensure
this refactor the list management by having only a single list head in
pipe structure. Also add a better name for the lock that should be used
for ensuring atomic access to these lists to prevent incorrect use of
these locks.

This also ensures that a pipe can only be freed on the fb device it was
allocated and prevents unexpected behavior when this is not the case.

Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: acquire list_lock before calling free pipe

If unblank call and display thread tries to free pipe
list at the same time; one of the caller might hit the
null free list and leads to crash. Acquire list_lock
before calling the free pipe API.

Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: handle race condition between ov_off and ov_commit

Handle race condition between ov_off and ov_commit by
acquiring the ov_lock in off API. This gives the exclusive
behavior between ov_off and ov_commit call.

Signed-off-by: Dhaval Patel <pdhaval@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: wb: Ensure iommu reference is available in wb terminate

In static screen case on command mode, when wifi display is
disconnected, buffers don't get free as there is a probability
that iommu is not attached. Ensure that iommu is attached when
wifi display terminate is called.

Signed-off-by: Jeevan Shriram <jshriram@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: IOMMU ref count implementation

Currently MDP is attaching/detaching iommu based on
bus bandwidth requests. This can lead to performance
issues, so implement ref count on iommu such that
iommu is attached where needed.

Signed-off-by: Jayant Shekhar <jshekhar@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: handle get buffer failure gracefully

If unable to map a buffer, set the pipe in a non-buffer mode which would
cause it to go to a black solid fill. This is better than fetching from
a stale address or a buffer with a different frame configuration.

Signed-off-by: Adrian Salido-Moreno <adrianm@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
msm: mdss: Use generic data type for rect

Moves rect data type to a common header. Add helper macro
to compare rect values.

Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
arm/dts: hammerhead: Disable fancy display features

No HAL support for partial updates, it's a noop. ULPS
is not completely bug-free.

Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>