hwc: Include more cases in partial MDP composition and fix bug.

Fixing bug in partial mdp composition due to layer caching when
UI layer with 90 rotation is present in layer list.

Layer not updating and a layer composed to FB are same now.

When MDP cannot support a layer, we send the whole list of layers to
GPU. If such layers are not updating they can be cached on FB while
allowing the rest to take the MDP route.

Example # 1: Volume bar on video in 90 rotated mode. Since volume bar
is not h/w accelerated, there is no prerotation and we invoke the GPU
for redraws each round. With this change we won't because of caching.

Example # 2: If prerotation is applied to layers on primary, the
secondary layers would show a transform and the whole list is redrawn
with GPU. Now we could make use of caching.

This change also imposes a 1 layer limit on secondary, but now allows
full and partial MDP comp, thus benefiting secondary-only content.

Change-Id: I7eb43ba817f1081f317fefa99fa0c507344060e8

Conflicts:
	libhwcomposer/hwc_mdpcomp.cpp
	libhwcomposer/hwc_mdpcomp.h
Merge "hwc: Include more cases in partial MDP composition and fix bug."
hwcomposer: Clear mVirtualonExtActive on EXTERNAL_OFFLINE

If WFD Client APK is connected and teared down and then hdmi is connecetd
Unblank Virtual display is happening instead of ext display
this results in Display not coming up on External using HDMI.

Change-Id: Id61e9e753f81e90787e2a958f75a4f84b4469f71
Merge "hwcomposer: Clear mVirtualonExtActive on EXTERNAL_OFFLINE"
hwc: Add support for Secure display

- Identify secure display layer in the hwc_list
- Need to set both SECURE_OVERLAY and SECURE_DISPLAY flags for the secure
  display layer
- Disable idle timeout for secure display usecase, as GPU should not be
  accessing secure display layer

Change-Id: I555910db77c466b5e103b24b4f0ec7f47bb210a5
Merge "hwc: Add support for Secure display"
hwc: handle actionsafe with downscale on ext enabled

during actionsafe calculations, if downscale on ext is enabled, we need
to consider the physical display attributes.

Change-Id: Ia07218b0b8e47b91b0bf575c66478ebaeab2e2a4
hwc: Fix for MDP Downscaling limitation

  For HDMI/WFD downscaling scenario, if the downscale factor is
  >=2, MDP cannot do downscaling without BLT mode. Since BLT mode
  is disabled, overlay_set_failure occurs when downscale factor
  is >=2 (Ex: primary resolution 1920 x 1080, External resolution
  640 x 480). To fix this, do MDP downscaling only when downscale
  factor is < 2.

Change-Id: I6361d0290ad75abc1f39662377e590cd288a48a8
Merge "hwc: handle actionsafe with downscale on ext enabled"
Merge "hwc: Fix for MDP Downscaling limitation"
gralloc: Fix caching for rarely read/write flags

GRALLOC_USAGE_SW_WRITE_RARELY and GRALLOC_USAGE_SW_READ_RARELY
need to be compared directly since they share bits with
GRALLOC_USAGE_SW_WRITE_OFTEN and GRALLOC_USAGE_SW_READ_OFTEN.

CRs-fixed: 569559

Change-Id: I52692027033e1036e3ad960b9e03dd8ee60b4111
Merge "gralloc: Fix caching for rarely read/write flags"
hwc: Enable rotator during resolution change.

- MDP VG pipe framesize register is not double bufferred.
  It introduces corrupted frame during resolution change especially when
  rotator is not used. Enable rotator to handle the transition case.

Change-Id: I48147ed812bec17fea2990260f600aa84d9f1144

Conflicts:
	libhwcomposer/hwc_utils.h
Merge "hwc: Enable rotator during resolution change."