hwc: Use layerIndex while populating hw layers

Use layerIndex instead of dpy while populating layers from the layer
list of each display.

Change-Id: I6bb4401482afc859447b58fcb6c5daa11a23fcd8
(cherry picked from commit bd9e66710bec76c16d8d45a6c1a4b58691a391a7)
Merge remote-tracking branch 'github/cm-11.0' into HEAD
Merge branch 'cm-11.0' into stable/cm-11.0
Revert "gralloc: Align NV21 to 32 pixels"

This reverts commit a29cb492524c4e8362197d6ae062b2ac75e2e5d6.

Revert "gralloc: Fix NV12 and NV21 stride"

This reverts commit 9a5c21236bebcb4b3e860fc27f039e6dab3fc5ba.

Change-Id: Ice081bb54f7f31d457f0ea32c1aa8c75ed5e9b9c
(cherry picked from commit f814d6bd9688d7d8f9e6d576f4f4a26d719f3428)
display: Revert some problematic changes for now.

 * Some devices are going to experience a vast array of problems while
   attempting to utilize these new features. Let's just revert for now
   to stop the insanity.

Revert "hwc: Rotate RGB layer using MDP Rotator"

This reverts commit 063d593d0de0390b1b830105373a9a83db4f2e52.

Revert "overlay: Change max rotator sessions to 4 and log level"

This reverts commit f658ca58fe5341e8867a76447bd361c066db345f.

Revert "hwc/overlay: Fix decimation / bwc bugs"

This reverts commit ef0cc725f855a1cbf1cfa5a79d6e048f2f554e27.

Change-Id: Id8dad791ee94d489b1e3763518f893e281f9dcc2
(cherry picked from commit 231f87b24f702d475365ab37becc1d4903218ca9)
hwc: Close release fence fd on buf sync ioctl failure

This change closes the release fence fd in the event that
a failure occurs during the buf sync ioctl. This is additional
sanity to ensure that we are not leaking any fd's in userspace.

Change-Id: Ic303aa2a2ed20244605b0f0bd91145e8f3fc8f1b
copybit: Export c2d header

On open source builds, adreno libs don't get built, due to which
c2d headers aren't exported. Export it from the display HAL.

Change-Id: I6ed1d1fcf3f99ba83d5f194e40d0b42bd7b4d566
copybit: Minor fix in opening copybit device

Proper handing of opening copybit device.

Change-Id: Id54ca463fe34764a1a3ffe90a71d8eec7cfefeb3
overlay: Trace all MDP ioctls

Add trace points for all MDP ioctls so that they show up in
systrace.

Change-Id: I4425176c31934963a39b8f59a91f16535927d99d
overlay: Remove usage of scale header

Remove usage of scale header and do not create or destroy objects.
the programScale() function exported out of libscale.so will
internally manage objects.

This frees up overlay from relying on scale.h which may not be
exported by libscale.so to a known location if only binaries are
shipped.

Change-Id: If6970541e2eb0ee2bdb907c73ed3534fc22e9dd1
hwc: Define binder interface to set view frame of a display

Define binder interface setViewFrame to set view frame information
of a display by surfaceflinger when projection for that display
changes.

Change-Id: If737b51ae0f04303a1a29c91a9703f64354b61fb
hwc: initialize viewFrame for primary display

viewFrame for primary display will always be full screen, hence
initialize it to primary resolution

Change-Id: I0f6ce79a9af6eac9b7b8a684c5b690c8b4a9e760
hwc: Extend partial frame update for split displays

Extends partial frame update support for split displays by calculating
changing region(ROI) independently for each half of the screen. In case of
only one half updating, display driver shuts down the DSI/MDP mixer control
of the non updating half.

Maintains two ROI's for each display. In case of Non-split
displays, only left ROI is updated.

Change-Id: I8a67fe40aac665a48b6f8a46beffb9f8027851b2
hwc: Support single ROI for split panels.

For panels that cannot accept commands in both the interfaces, we cannot
send two ROI's (for each half). We merge them into single ROI and split
them across lSplit for MDP mixer use. The ROI's will be merged again
finally before updating the panel in the driver.

 - Reads panel property of dual control path.
 - If dual control path not supported, merge ROI's before
   analysing for composition strategies.

Change-Id: I67e361a299dc5d1adb28b180900e24633eefc4a8
hwc: Map dirtyRect to layer destination for single DSI panels.

Map dirtyRect generated for sourceCrop to layer destination
before using it for calculating ROI for single DSI
panels.

Change-Id: Ie65284e9c58270c66276f9d43c4eb3e7db29b623
overlay: Add a flag for compilation with new API

 * ROI fields have changed for dual-dsi systems. Add
   an ifdef to allow compilation with old kernels.

Change-Id: Ie18404bba2c5afe4e8b913c1b4eee2a588f37acb
hwc/overlay: Get rot dest dimensions instead of manipulating source

Currently for Mdss rotator we manipulate the layer buffer dimensions
to be equal to what rotator's destination dimensions would be, so that
these could be fed to MDP. Instead, this patch introduces APIs in
rotator so that hwc can directly query destination crop, width, height,
format from rotator.

This also simplifies the updateSource() and configRotator() helpers.

Change-Id: I501d998f2e0574683c764af9422742b2426ba0c7
Revert "display: Revert some problematic changes for now."

This reverts commit 231f87b24f702d475365ab37becc1d4903218ca9.

Change-Id: I13fbac5299e6ee50d4f6924ca10ac7c136da288a
hwc: Source Split layers always if indicated by driver

Source Split layers always if the driver indicates so by setting
the src_split_always in the capabilities sysfs node.
This is applicable to layers whose width > mixer's width, since
MDP clk rate is dependent on max(mixer_width, layer_width).

This feature can be enabled if the panel height is more than a
certain empirically derived value. Splitting always in those
cases can help with a lower voltage.

Change-Id: If9b33f11ca4132eb77416c26819f7473c65d3b08
hwc: Add display ROI in HWC dumpsys

Add ROI generated for each display in their dumpsys data.

Change-Id: I41fb79af9d42abc11ff147d18a600fd4ad60ab6c