Display/hwcomposer:Add support for intermediate down scaling

Copybit module has a limited stretch to up/down scale.
Hence we need to do a intermediate stretch before going
to final stretch.
CRs-fixed: 341196

(cherry picked from commit 256bde19b8f912388e19390570e5ea36f0208cfe)
(cherry picked from commit e426d9cc0ae2a71a0607ed03cf47243b8820af50)

Change-Id: I2862fb0c6bdd624b968f9618994c8d74f3f07dc3
gralloc: Allow temporary buffer to choose to be cached

The flag GRALLOC_USAGE_PRIVATE_UNCACHED can be set in the
usage to allow it to be uncached. If not set, the buffer
will be cached by default.

CRs-fixed: 341196
(cherry picked from commit 6232816aadd311dbb57b714c7c0a4073d3ddc7f7)

Change-Id: Ic10677d105328702972dd69581b919c984d17fe9
Revert "libQcomUI: handle WFD and HDMI concurrency"

This reverts commit d59d3dea9b78c0ae1532343dded0097e64088d44.
(cherry picked from commit 267eb3201a5a54246eb668a4c299e1b0a9df147b)
libQcomUI: handle WFD and HDMI concurrency.

- Add external_display_type to differentiate WFD and HDMI
- based on the display type, handle wifi display and HDMI
  concurrency

Change-Id: I2bf928dcd232f2ea39c4fa8dca812a26112076b2
(cherry picked from commit 8e7490026832d8df6758f4aa615039f91ac0f5ff)
(cherry picked from commit 7c6b7979bf2d7ab12ff528be75b5e008405acbda)
YUV layer updates during animation and popups.

-- During animation, if yuv layer is marked skip close overlay channels.
   But if HDMI is connected, let them remain open, and send data.

-- During popups on paused video, if the layer above it is skip,
   let the video layer be displayed via overlay.

-- Fix MDP pipe closing mechanism for yuv content.

-- Synchronize notification to gralloc with actual video channel status.

CRs-Fixed: 342892

Change-Id: I98f442c12e59e4fcf93af87a251e3d489e624c0b
(cherry picked from commit 752ee11eb0318dbb2bfdc5200c320cd2db972eb9)
gralloc: Allow SF to use IOMMU heap

(cherry picked from commit 9ff9a8df77ce6887b6d45fdb7dc7400690d408c5)

Change-Id: Ia079f4c68b88201f638cfc2b4618de381d246e49
libhwcomposer: Remove dimension Align checks for copybit

gralloc is already taking care of source buffer width alignment
based on the color format.Alignment should be based on source format,
But not dependent on FB format.

CRs-fixed: 344311
(cherry picked from commit 8c8edc440288def7017eb12d93391cb785196f55)

Change-Id: I0355059ed0afa8bf88125a027be7fe37b78ec2aa
libhwcomposer: Unregister layer handles that fail validation.

Layer buffer handles that fail gralloc validation must be removed
from hwcomposer's register of previous bypass and overlay handles.

(cherry picked from commit 18c7f1951018b6632bd6e1a4957194c01423b6ee)

Change-Id: Idaaf3557b05adb5b3e938e9cd46dac5b104b729e
CRs-Fixed: 347157
Revert "libhwcomposer: Remove dimension Align checks for copybit"

This reverts commit e5cb40319ff7a2c24ac52094d7a60da79d9d4dc6

Change-Id: I6b8d0027b226e8cdcad1f6a630a7c7df8bd95762
Merge "gralloc: Allow SF to use IOMMU heap" into ics_chocolate
display: Use a new flag for content protection

The GRALLOC_USAGE_PROTECTED flag that was used
earlier for content protection is also used for
some other use cases such as disabling of
screen captures. Define this new flag that
is explicitly used for allocating secured
buffers for DRM.

Change-Id: Ia33f79fa0dea7f2f16dd320f267203e6173af48e
CRs-fixed: 348454
(cherry picked from commit 440a996f13be732895524412762793f109681c11)
display: Fix Overlay state transitions

Trigger overlay state change for S3D format changes.

Close both overlay channels only when transition to/from 3D display
happen.

The closeChannel resets the Overlay state variables. Any changes to
the state variables prior to closechannel are lost. Update state
variables after calling closeChannel.

Remove unused variables.

Change-Id: Ia5aa84d02df1e1874df93530cf3e55298ebc81e3
CRs-fixed: 342350 342987 347382 350326
(cherry picked from commit 6706fd708dace780751a4602d6125e089851789f)
Merge branch 'ics_chocolate' of git://codeaurora.org/platform/hardware/qcom/display

Change-Id: I5b9fdb1a5ea637d526f4a211e1154a0618c039f9
fix TARGET_USES_ION usage in libcopybit

The TARGET_USES_ION ifdef/endif adds -DUSE_ION to LOCAL_CFLAGS.
It must be after the "include $(CLEAR_VARS)" otherwise it has no
effect.

This fixes "E/copybit_c2d(  157): Invalid handle flags: 0x8" errors
seen when using TARGET_USES_ION := true.

Change-Id: I924346d9efd4ec06721a3eed68d3995f8dfb00cd
gralloc: Add locking to alloc and free in ION

Change-Id: I16e24e3d366b15a458b19983827233a7bd27d9f7
(cherry picked from commit edad58e17deb0cb1d9ff4754fbac511eea8e4ecf)
Overlay: Enable rotator for external displays

(cherry picked from commit 8e12c41fe12a2b1fd21ce89663f4103f82547bc4)

Change-Id: If01d97877bda8d2e81e0e7c13bb334227fa07325
Reset to initial state when Overlay startChannel() fails.

When Overlay startChannel fails due to some reason and overlay
channel is not yet up, state needs to be reset to initial value.

Change-Id: Iabc765f350bf999d8362f86a43b900ff7aed1bb3
CRs-Fixed: 354403
Avoid 3D video layer for GPU composition

libhwcomposer: Donot mark the 3D layer below HWC_SKIP_LAYER
for GPU composition. In these cases, let the layer be
composed through composition type decided in hwc_prepare.
This helps us in avoiding the cases where 3D videos
cannot be composed through GPU.

CRs-Fixed: 346973

(cherry picked from commit 0331f07ed4b5a3cf5a2e358c8417ac9e8103bc07)

Change-Id: I9f6c53cc2da35109fe789074a9d1accc11372dd8
qcom/display: add perform function to fb/hwc HALS

- Add perform function to framebuffer and HWComposer HALS
- This will be used communicate custom events(external display,
  video overlay, orientation, etc.,) to HALS
- remove setActionsafe API(not used)

CRs-Fixed: 341947
(cherry picked from commit 31999628ddd4a6c0996e22e9fbf1f311d6efb160)

Change-Id: I221f2ab49770e8db7602bb1881ef9972567b7780
HWComposer: Set the transform value correctly

When using the bypass, read only last 4 bits of
the transfrom value regarding the change of
transform value in Layer::setGeometry().

(cherry picked from commit 7689940bec6440b78418cb15a9888312ab96ea04)

Change-Id: Ida5781e3e92929b8024947a41e5521f83164a4f7