fix fd leak in memtrack.msm8960

Close smaps_fd when exiting function.

Bug: 11007903
Change-Id: I4a9fcd1e84aae195d229e5dd11f99ccb9f6f5006
display: Properly handle NO_IOMMU case

 * Enable it by default for msm8660 too.

Change-Id: Icbd5de1e7f020285ff6101c34286ca8863b11040
libhwcomposer: Log and dump app layers of screen frames

Log a frame-by-frame succession of HWComposer layers' data and write
their buffers, if any, into raw or png files based on system property
values.

Change-Id: Icceccf5fff5ab4d78dbc6c28c11210b8837ddfd9
display: Clean up binder interface

The current binder implementation is inflexible when it comes to
adding new input/output parameters. It also needs a lot of
boilerplate code written when adding a simple enable/disable type
command.

Instead, let clients specify the parcels they want to pass and
unparcel them at the end points only.
Please note that it is assumed that all commands coming in
need the same permission checks. If this is no longer the case,
some commands need to be split out on the receiver end in
IQService.cpp.
This change also simplifies the code end clients need to write.
They should be able to include QServiceUtils and call a single
function to set the binder up and make the call.

Change-Id: I4db66f2427ecf16d7a6264462ae85815217a16b1
qdutils: Add display config to qdutils

This API is meant for system level users that need to get/set
various display attributes that are normally not available via
the regular Android framework channels.
Initially the APIs exposed are to check HDMI status, get display
attributes and set HSIC data.
Only physically connected displays are supported for now.

Change-Id: Ia783ce2ab0c4599a54c992171e01e2f0504550dc
hwc: Calculate viewframe from layers display frame information.

Calculate view frame of  each display from the displayframe of all
the application layers.

Change-Id: I9ba4076b7b4419bd3559417fad28b4e1de6acff3
hwc: Add binder interface to get the visibleRegion

- This binder interface can be used by clients to know the
  active visible region for a display(pri/ext/virt)
- When external orientation is used, return the destFrame of
  the FrameBuffer layer, as its the viewFrame

Change-Id: I7cfd149c76c16b9a3031103c89b1932d44bcbecd
hwc: Reset layer-to-rotator map and fences on configuration failure

When a rotator or mdp configuration for a display fails, reset the
layer-to-rotator mappings for that display and reset the release
fences for the rotator objects used for that display.

Note: The rotator itself is offline and not tied to any mixer. It is
from the mappings that we deduce which rotator object was used for
layers of which display. Also we don't delete rotator objects held
for a specific display, since during stability runs, failures could
repeat each round and we end up allocating and deallocating memory
unnecessarily. The rotator objects will be deleted automatically
when not required anymore.

Change-Id: I9a67f02574be30be3b96b3575f60530cb1c89e10
hwc: mdpcomp: Make all pipes available if a frame fails

Make all pipes in overlay available, if programming a frame (list)
fails. The failure could be due to commit failure, in which case the
overlay itself will make pipes available.

The failure can also be owing to lack of pipes, since we don't allow
switching pipes across mixers any more. This is particularly a problem
for split-panels. This fix addresses this latter case.

Change-Id: Ieac7ae7d03e5b9a93c7245fa160c8933593c2e09
hwc: Update rotator object handling in error cases

Earlier, on configuration errors, we simply drained the fences held
by current rotator objects and went to GPU comp. The rotator objects
were deleted in the subsequent rounds, if they remained unused.

If we don't use GPU comp on failure but use other strategies, then we
need to mark the rotator objects for a display for reuse, so that
other strategies can use them.

Also any failure resets on overlay or rotator need to happen from
functions that call configuration helpers rather than the  helper
themselves. Leaving cleanup to black-box helpers is not desirable.

Change-Id: I59b5b1bb774b82ee85a037e934c9d2d023db30af
hwc: remove displaying unused pipe in dump if set overlay fails

  If overlay set is failed, "pipe book is updated" with correct
  used state, but dump does not check the used state of the pipe
  and display the pipe info.

Change-Id: I6631311df30401f40efc5e626747d4fc4fcb64fe
display: Various cleanups, fix legacy camera heap

 * Add explicit support for camera heap, if requested
 * Bring in line with kk_2.7
 * Don't push to MM heap for NO_IOMMU for display buffers

Change-Id: I30a8280099aa82e9b3e9754a4a68ad6a81f705f7
Revert "libhwcomposer: print a log if there is any delay in vsync read."

This reverts commit 624cef4052af2995c6360bca71f6acbf529cbe3a.
This log is misleading as it does not print the actual vsync time
when vsync is disabled then enabled. It prints accumulated time
from vsync disable to next vsync enable.

Change-Id: I0ca3c9bc1e07a048e4563254ab83a3dd6b8c55ec
hwc: Remove need for intermediate buffer for c2d composition

A-Family device NON PRO 8960 uses copybit composition. The
intermediate buffers allocated are not needed when we can
compose onto fb frame.

Change-Id: I13fd2deb328a3ef4b6738cfe7030fe67ea7bd6c6

Conflicts:
        libhwcomposer/hwc_copybit.cpp
        libhwcomposer/hwc_utils.cpp
libhwcomposer: Disable mixed mode on plane alpha downscaling

When mixed mode is enabled while a layer contains
plane alpha and requires downscaling, part of the
layer containing plane alpha is exhibited as black area.

Change-Id: If47fa773846cbead3d6b2cad06ea80872233a908
hwc: Invalidate on receiving PANEL_ALIVE=0 status

Invalidate on receiving PANEL_ALIVE=0 status, otherwise
during static wallpaper, panel will be reset only after
next screen update.

Change-Id: I6f5264367c8bd889b9103ed74641ac4a60538b57
CRs-Fixed: 591454
hwc: Force rotator for resolution change only if one yuv

Force rotator for resolution change only if there is one
YUV layer on primary display.

CRs-Fixed: 609450

Change-Id: I8f17de491ccfbbbfa6885eb9a35037edb2ef1b87
Merge remote-tracking branch 'cm/cm-11.0' into kitkat

Conflicts:
	libhwcomposer/hwc_utils.cpp

Change-Id: I6d74d3e3102aec60b14c795fd646849e8be47f7f