hwc: Add secure display attribute

- External displays can be secure or non-secure based on HDCP
- Propogate this to the SF with the getDisplayConfig
- Non-virtual displays(pri and hdmi) are considered to be secure
- For WFD using V4L2 archiecture, read the HDCP status from the
  sysfs and update accordingly

Change-Id: I4aaf303f0770201b8ca4f8a1c578bed61054bcfb
Merge "hwc: Add secure display attribute"
hwc: Full MDP Composition mode with overlap region removal

MDP bandwidth limitations can be avoided, if the overlapping region
covered by the smallest layer at a higher z-order, can be composed
on a render buffer using Copybit, and then it can be queued to MDP
along with other layers. It helps to improve performace by avoiding
GPU Composition in use cases like Home Screen pan. To enable this
feature, set system prop "persist.hwc.ptor.enable" to "true" or '1'
and enable Copybit HAL compilation.

Change-Id: Ib719d3dd42477837519518cc427f1b95356c28f7
hwc: Enable PTOR feature for split display

Enable PTOR feature for split display devices.

Change-Id: I2f8acc0713acf2a50f0cd472c272bc1298f4ed7f
copybit: Enable HAL_PIXEL_FORMAT_RGB_888 support in c2d

Enable HAL_PIXEL_FORMAT_RGB_888 pixel format support in c2d library.

Change-Id: I2316357adb3fef8007bdab4791c94e53d12fa00f
copybit: Enable RB Swap for RGB_888

Enable swapping of R & B color components
for RGB_888 format, otherwise C2D renders
wrong output.

Change-Id: Ib1670418a588e09e8168a04c9f8b8022a84e65e8
CRs-fixed: 672033
hwc: Extend PTOR feature for two layers

- Consider two smallest layers for PTOR feature which uses MDP comp.
- These two layers are rendered on a buffer and are queued to MDP
  to acheive full MDP Composition
- This helps to acheive performance enhancement

Change-Id: I43d9306ff19cd2d7a410c885316523965a44cbd4
hwc: In PTOR, offset depends on stride calculated by gralloc

1. In PTOR feature, offset for the second overlap layer on render
buffer, depends on stride calculated by gralloc for RGBA (4 bpp).

2. If mCopyBit object exists for external, we need setReleaseFd()

Change-Id: I74e365def2a6e540b2f2ba2b294b6b1e00e0ea96
hwc: Configure MDP with updated crop and whf for PTOR layers

1. For PTOR layers, MDP needs to be configured with width, height
and format of the Copybit render buffer, otherwise it will lead to
artifacts due to incorrect render buffer reads, when PTOR layer
handles have un-equal strides.

2. Remove render buffer offset for a PTOR layer and configure MDP
with modified source crop, based on its position on render buffer.

3. A layer cannot qualify for PTOR feature, if none of below layers
intersect with it.

Change-Id: Idba65789b9ed3b699a5c70107881868c0385322d
hwc: Configure MDP with updated content attributes of PTOR layers

Since there is no content underneath a PTOR layer, all overlapped
contents have been composed by Copybit on render buffer. So for a
PTOR layer, we can set blending to HWC_BLENDING_NONE and planeAlpha
to 0xFF. And the transform for the PTOR layer should be set to 0 to
avoid MDP flipping again.

Change-Id: I26fec26dcde4d9b0b62f94107a013d82074628b5
hwc: Fix PTOR for overlapping PTOR regions.

If two PTOR layers are overlapping, remove overlapping
region from bottom PTOR layer if possible to reduce total
overlapping layers in a region.

Change-Id: I695c097360ac5a8fa123e014f21380169519eb32
libqservice: libhwcomposer: Add Display binder interface for setting PTOR status

Clients can enable or disable PTOR feature via binder call to display.

Change-Id: I20c5182bf796164203be47a0ea9d641e54eb6fb3
Hwc : Calculate copybit destination rect properly in PTOR

When the layer destination rect is not transformed properly on target
render buffer location of that PTOR layer,  it results in corruption
on the PTOR layer. This corruption is observed when the overlapping
region of any below layer different from PTOR display frame.

To fix this, destination rect for copybit is calculated as follows:
i.   Find the intersection of layer display frame with PTOR layer
     with respect to screen co-ordinates
ii.  Calculated the destination rect by transforming the overlapping
     region of layer display frame with respect to PTOR display frame
iii. Transform the destination rect on to render buffer

Change-Id: I9468e194ac87de4e3d37f7b1df90bfa6473a1921
hwc: Clear render buffer before blitting layers below PTOR layers

Stale render buffer data results in flickering in some corner cases.
It always better to clear render buffer before using it.

Change-Id: If87dc05bcdc88e839f162cf3db4f00aba6f1d535
Revert "hwc: Add secure display attribute"

This reverts commit 844848cb90836cc6c337fdae94eaabe5a8f52d3b

Change-Id: If212b3627fc5a9921a832b7bee2a946a60cf4746
Merge "Revert "hwc: Add secure display attribute""
libhwcomposer: libgralloc Set MDP_SMP_FORCE_ALLOC flag

For PROTECTED but NON SECURE layers set MDP_SMP_FORCE_ALLOC flag
to allow SMP allocation and prevent GPU fallback
In Such cases if video resolution changes dynamically
it fails to display layer due to GPU fallback.
Use this flag for FB layer composition and depricate
MDP_BACKEND_COMPOSITION flag.

Change-Id: I9ab7cbdd2e12b56dfa67d5b4b3ff6b2dcd0096be
hwc: Check for planeAlpha along with HWC_BLENDING_NONE

Check for planeAlpha along with HWC_BLENDING_NONE as the latter
is set if the layer is Opaque irrespective of planeAlpha value.

Change-Id: Iaee7efe662189ba3a2562f79c2d109da831ac94d
qdutils: Fix checking for HWC_BLENDING_NONE alone

Check for planeAlpha value as well along with HWC_BLENDING_NONE
as the latter is set if layer is Opaque independent of planeAlpha.

Change-Id: I32a1a7da4d5efec7515e8e4faf77e00278580ff0
libmemtrack: Fix the kgsl memory flag to determine usermapped buffers

The flag is the last character in 'flags' field array. It was wrongly
indexed at flags[6] causing all entries to be marked as unaccounted.
The correct check should be for flags[5] to be equal to 'Y'.

Change-Id: I9f9af884b697363186d6315e5fb7c5673c22a495