hwc: Avoid redoing GPU comp under certain conditions

* When the ambient light changes, pp-daemon will invoke multiple
screen-refresh cycles for LUT convergence needed for
PP algorithms.

* When this happens during static screen usecase, there would
be frequent switches from gpu-comp(due to idlescreen-fallback)
to mdpcomp and back. This results in increase in power numbers
due to increased composition cycles.

* To resolve this, do the following:

a) If frame 'n' is composed using GPU and frame 'n+1' is same
as frame 'n' in terms of input layers contents, avoid any
composition needed for frame 'n+1'. Mark the composition type
for all the layers as HWC_OVERLAY and push the GPU composed
content of frame 'n' for 'n+1' too.

b) Donot do (a) if the any of the incoming layers is marked as
skip or HWC_GEOMETRY_CHANGED flag is set in layer list.

c) Limit (a) to only primary and when secondary is not connected
so that display output expectations during secondary pause-resume
can be met.

* This saves ~10ma during static screen usecase when ambient
light is frequently changing.

Change-Id: I6ca4ab3bf194ffe71191cc661086a14d3e2c26b3
2 files changed