h/q/d: Optimize framebuffer layer update

While doing mixed mode composition, update only the region of the
framebuffer where layer contents are cached or updated. Avoids
MDP fetch for non-visible contents of FB.

Change-Id: I20997d79e02a6bac60d7333c28c6dde134263197
qdutils: Refactor idletimeout fallback mechanism.

1. Use kernel timer interrupt to signal about the timeout to
   Invalidator thread and fallback to GPU composition.
2. This implementation avoids waking up the Invalidator thread for
   every idletimeout value during continuous update.

Change-Id: I4370f10a0ca06b5cb1e7bdcb047e9c8daec51afb
hwc: mdpcomp: Remove pipe estimation blocks

Pipe estimation was necessary when the unavailability from overlay
led to GPU fallback.
With the new design, hwc uses the next best strategy, so failure
to grab a pipe from overlay is ok.

Change-Id: Id20d2e6fd24aeb5af3ab84ec9dd8c52f6bbbef8b
hwc: Remove bandwidth checks

Bandwidth checks will be done in the driver as part of resource check
which makes the existing checks in hwc redundant.

Change-Id: I39eb7de63618e8ea5981f9e1a1159224831f314a
hwc: Iterative Load based comp

While performing load based mixed composition, iterate from max
stages of mixer to at least 2.
Get rid of modes that preferred GPU or MDP. This new mode will
include both plus the missed out batches.

Change-Id: Ideb06a2332fe2f59968367d28df848be01f4aedc
display: Remove klockwork warnings and errors.

Remove all klockwork warnings and errors for libgralloc,
libhwcomposer, liboverlay, libqdutils, libqservice, libvirtual,
libexternal libraries to avoid buffer overflow and memory leaks.

Change-Id: I078143bcbcf5e4b342156bd8305a644566f7cc4b
common: Do not link to ABL lib

The library is not used in the code. If used in the future, it
can be linked to with dlopen.

Change-Id: I5af0847f0838f26c3c7f39375d3f082b1d3b8a6c
hqd : Use proper type casts

    * Remove compilation errors
    * Use proper type casts

Change-Id: I1d44c2a2362a1fdd4d6e412ea816d4078e8355c9
:
overlay: rotator: Remove previous allocation for a session

When ION was not ref counted, we needed to maintain the previous
session memory until the new one was taken by MDP. ION being
ref counted now, it is not necessary to maintain previous memory
allocation.

Change-Id: I102df065bb288a661d509912f4c7b894505df393
HWC/copybit: Add ceil value for downscale value

We are dividing (in downscaling case )the src rect value
to get intermediate value of dst. And due to rounding we
may not get exact ratio of src and tmp dst in kernel or
else where.Hence using ceil value.

CRs-Fixed: 618847
Change-Id: I8b95c3e00e83ff986d95e063d5927a3c57a13ff6
hwc : Skip panel reset sequence if panel is already off

Do not proceed with panel recovery sequence if panel is already off.
Proceeding with reset sequence, if panel is already off, results in
race conditions.

One e.g., there is race condition between early suspend triggered
by pressing power key and panel recovery triggeredby ESD uevent.
If pressing power key happens exactly at kernel DSI driver is
reporting ESD uevent, it's likely that panel will be unexpectedly
on by ESD uevent after having blanked the screen by early suspend.

This change avoids unintentional panel recovery in the case above.

Change-Id: I19022691ec3c178f62f392913435ddc032ee1ab2
CRs-Fixed: 613155
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: Reset FB Z order to -1 instead of 0

In Video-only mode FB Z-order of 0 was being used, incorrectly,
because the value was reset to 0 and wasn't changed subsequently.

Reset to -1 to prevent this. Any MDP comp strategy that needs to use
FB should set it's Z order appropriately.

If cache based mode has no MDP comp layers, fail so that other
strategies can be used, rather than succeeding with FB Z as 0, which
will at most allow GPU comp to be used.

Change-Id: Ifdae2cd5f8d8ff0e10447b1fed6ee1671260f311
HWC: Use proper typecast to avoid scaling issues

Multiplying double with integer may scale up/down original value.

Change-Id: I2aa002a434d287df69d34de7e4fea3d56bcfbfaa
hwc: hwc_sync - populate correct fences for BLIT

Previously, the acquire and release fences for BLIT
composition were populated using same logic as Overlay,
but BLIT composition consists of separate BLIT step
before screen refresh, and app buffers are no longer
required after BLIT. So holding the buffers for both
the steps is unnecessary and impacts performance.

This change adds condition for BLIT in fence population
logic in hwc_sync and populates the right fences for the
App Buffers and Display Refresh during BLIT composition.

Change-Id: I9998a7052c0375acb32a174bdf0469d2a88f79e8