HWC: Minor fix in 4k2kYUVsplit feature

Increment fbZ when 4k2kyuvindex matches with fbZ,
otherwise we see momentary flicker as right half of
4k2k YUV layer and fb layer have same z-order.

Change-Id: Ia900e102b6d4670b9bfdfd4e52ef360d1d813cab
hwc: Add rotator obj to layer-rot-map if acquired

Add rotator obj to the layer-rot-map soon after its successfully
acquired. This makes sure that any object allocated is accounted
for, irrespective of whether rotator configuration succeeds or not.

Change-Id: I94102d9c607cf61b2eccdf7f2445bb07d309d35c
h/q/d: Dump ovinfo only on pipe config errors

Dump ovinfo only when validateandSet fails due to invalid pipe
configs. Failure due to insufficient resource is common and
dumping ovinfo for such cases wont provide much information.

Change-Id: I9e102cf633bb394603ea2484d80017e4b906b49a
Merge "HWC: Minor fix in 4k2kYUVsplit feature"
hwc: Display view frame needs to be set before using it.

The display view frame needs to be set before calling trimLayer api
because it uses view frame to find the scissor for display, which is
used to clip crop for out-of-bounds display frame sent by framework.
If mViewFrame is not set, scissor will be empty rect, which leads to
wrong source crop calculation.

Change-Id: I52ad4eb9037d34aff24c30fe65e3793684445264
Merge "hwc: Add rotator obj to layer-rot-map if acquired"
Merge "hwc: Display view frame needs to be set before using it."
hwc: Color layer always has zero transform.

Color layer always has zero transform because framework uses the
transform member of hwc layer to pass the color value to HAL.

Change-Id: I79fe204c558d1b6e1dd69ba635ba0bd87140b1b1
Merge "hwc: Color layer always has zero transform."
libvirtual: Fix logic to detect DRC use case.

We detect DRC based on the resolution of the external display stored
in the HAL, and the dimensions of the framebuffer(fb2) after receiving
a RESUME event. If the stored resolution is greater than that of fb2
it means fb2 was reconfigured due to DRC. This is the only case in
which we trigger the DRC path (and the MDP downscale path thereafter).

For all other cases, the RESUME event is just treated as normal and
should not result in triggering the DRC path.

Change-Id: I2c8a854434f09a840938f00b88faa59c6cb57e7f
qdutils: correct error checking of MetaData's handle mapping

In term of Linux manual, mmap() returns MAP_FAILED in case of
error, so current checking against NULL is not valid.

Change-Id: Iee6920b6478843a0c1cd62bdbe3e4b652a39c583
Merge "libvirtual: Fix logic to detect DRC use case."
Display and wfd synchronization during teardown

* Provide a binder interface call for wfd module
to inform display about the start/stop/pause/resume
of wfd session.

* This is needed for wfd-hdmi synchronization in
case of v4l2 wfd solution. If hdmi is plugged
in during v4l2 wfd session, display-hal waits in
uevent thread for wfd teardown notification from
wfd module, before going ahead with configuring
external display.

Change-Id: I9514cb5bc7ff81de0b5dd4cdf66d8286a64ba094
Merge "qdutils: correct error checking of MetaData's handle mapping"
Merge "Display and wfd synchronization during teardown"
Set priority among various display devices

* When a non-WFD virtual display device (SSD/
screenrecord) is active along with
non-hybrid WFD solution(WFD faked on
external), give preference to non-hybrid WFD
device over non-WFD virtual display device.

* This is needed only in cases when WFD is
enabled via v4l2 rather than using VDS api's.

Change-Id: I63e53baa214bdcdac19430ca30b939cdd7416cbb
Invoke a padding round in certain use-cases.

* In some use-cases, it is possible that there are
no AppBuffer layers on the external/virtual layer-list
during which all the pipes will be allocated to the
primary. When layers do comeup on external/virtual
layer-list, subsequent overlay sets fail.

* This change ensures that in such cases, we invoke a
padding round on all the displays to free up the
hw resources which can be used in subsequent cycles.

Change-Id: Ifac0b8f51a8719eb55b11010d05b8d11352db054
hwc: Set DMA state at the start of composition

* Set DMA state at the start of the composition cycle
based on the following.

Set it to LINE_MODE if the number of active rotator
sessions are 0.

Set it to BLOCK_MODE if
** A yuv-layer for any display-device requires rotation
** (or) mExtOrientation is set
** (or) mBufferMirrorMode is set

* Separate out the reset helper function into more
modular ones

Change-Id: I6a22ac4379565cd1fd2d875a7a417f4ed3ee0f1e
hwc: Handle more events from driver.

In certain cases, such as the shutdown sequence, the driver may
blank itself without any direction from SurfaceFlinger.
In such cases the HWC should make sure that no further updates on
the display occur.
Handle events from driver in a more generic way to include blank
events and leave room for any other events that need to be polled
on from the driver.

Change-Id: I0aab9f30046f07ca9c90c73cadabcadc150565c8
CRs-fixed: 627814
Merge "hwc: Handle more events from driver."