libqdutils: Add synchronization to idle invalidator

Protect invalidator data from accessing multiple threads
asynchronously. Composition thread and idle invalidator
threads could access at same time. Add locking to protect
invalidator class  member variables.

Change-Id: I568ec367958c88f70f7aa4e6917abd53830adfd3
hwcomposer: Fix a crash with MDP composition.

Reset the current frame data before returning from MDP
composition prepare to avoid accessing previous frame data
in MDP composition draw phase. Avoid the number of app layers
going beyond the layer count limit in MDP composition.

Change-Id: I2a3035ad5cb1731060b9359ccdbe9fe0c07e843c
CRs-fixed: 510683
hwcomposer: Reset LayerRotMap if MDP configure fails

For some reason if overlay pipe allocation fails reset the LayerRotMap
to avoid calling rotator sync ioctl which we should not call.

Change-Id: Ibe31d22a18bf48201ab8f20009489c6dc5e04a28
Crs-Fixed: 505003
hwcomposer: Add adb property to disable Mixed Mode

This change adds adb property support to disable mixed mode in
MDP Comp. Will be helpful in debugging issues to narrow down the
root cause.

Change-Id: I49b737bb8755dc3a35db2e1ea8ccb2043135d2b0
hwcomposer: Fix a deadlock with debug enabled.

If debug property for MDP composition is enabled,
we call dump function from composition thread.
Make sure we are not holding the MDP composition
lock before calling dump function as this also tries
to acquire the same lock and causes a dead lock.

Change-Id: I05e5fd58be096f1ab683d796cc1beb4972c2168f
gralloc: Fixes for software composition

Check that the buffer is actually an ion buffer
before calling clean. This is needed for the case
where the physically contiguous framebuffer is mapped.
That framebuffer memory is used for bringup.

Change-Id: I2db84d4bfc3465d995f12e0860be3cafa0d4a81b
gralloc: Do not map framebuffer memory unless needed

The SurfaceFlinger opens the framebuffer module even when it
isn't necessary. It does this for some legacy hals.
Due to this we unnecessarily mmap the fb memory in gralloc.
Do not map this unless the property to use the framebuffer
memory is set.

We do further operations in fb_device_open based on the result of
mapFrameBuffer. However, if mapFrameBuffer is never done, we
could end up with a random crash when using the info values in
fb_device_open. Defaulting to an error value avoids this.

Change-Id: Ib4ebfdf9a63af0dabb53170342181bac0360baeb

Change-Id: I1e51f814611a3f2eb73f36d75e14d8725ca98474
hwc: Minor bug fixes

- Since SF doesnot send blank/unblank event to hwc for
virtual display, handle them as part of primary
- Close acquireFenceFd's of the layers before returning from hwc_set
in case of display commit failure.
- Change in getAspectRatioPosition function to handle portrait and
landscape panels.

Change-Id: I089c56f61352c21bf76ff2b0104f586d611c3013
hwc: wfd: Call commit even if in pause

We need to call commit on wfd even if in paused state so that pipes
which are unset are actually unstaged from driver

Change-Id: Id71de8b80c44a632989de154a2387380d8fa66f0
hwc: Fix locking in external connect and composition.

The external configuring flag should be set after holding locks.
Before opening FB for HDMI/WFD, composition should give up any
open external FB resources.

Locks should be held by composition for the entire duration.

Change-Id: I703f69f156c665bf422613567c00aae340f3ee12
gralloc: Add workaround for Jellybean camera drivers

* Arcee is smarter than I am, and discovered that we can simply swap
  two fields to ensure compatibility with Jellybean camera drivers
  having the metadata fields in the private_handle_t struct.
* Enable this by defining QCOM_BSP_CAMERA_ABI_HACK.

Change-Id: I2cd267dd5550404cf2e61d76fb805e780cd99d3c
hwc: Configure framebuffer before other layers.

If framebuffer needs to be configured, configure it before all the
other layers in mdp composition. This helps in cases where we are
out of SMPs and framebuffer configuration fails owing to that.
Framebuffer being the fallback path, should always get highest
priority when reserving SMP blocks

Change-Id: Ie7a6903d1b9fb98b308689c81522571449bf2e8e
Merge "hwc: Minor bug fixes"
Merge "libqdutils: Add synchronization to idle invalidator"
Merge "hwcomposer: Fix a crash with MDP composition."
Merge "hwcomposer: Reset LayerRotMap if MDP configure fails"
hwc: Clear rotator map if overlay allocation fails

This fixes the GPU fallback path in case overlay set fails.

Bug: 9322550
Change-Id: I515204f41169debd8428b4fc48be392ecdd9ff48
Signed-off-by: Iliyan Malchev <malchev@google.com>
overlay: Add tolerance to downscale factor

In certain corner cases for 1080p panels, round doesn't get us
the right downscale factor resulting in MDP attempting to go into
blt mode. Add a tolerance for failure.

Bug: 9322550
Change-Id: I2be4715955d9e248fc63e408dc4a2cdf493152f6
Signed-off-by: Iliyan Malchev <malchev@google.com>
hwc: Add support for smooth streaming feature.

Update the source video width and height set by the video decoder
for the secure video smooth streaming usecase from the gralloc
metadata.

Change-Id: I73a3804d90557034604142481a232787dbc08f23
Acked-by: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>
Signed-off-by: Lajos Molnar <lajos@google.com>
Bug: 9533458
hwc: Punt video layers with plane alpha

This fixes a transition issue when exiting youtube while the
video is playing.

Bug: 9486278
Change-Id: I0259b2dc9ccbf302b13d8ae40e62765820d94860
Signed-off-by: Iliyan Malchev <malchev@google.com>