libhwcomposer: print a log if there is any delay in vsync read.

If there is a delay in vsync read print a warning message if
vsync status is enabled.

Change-Id: I26ca86639a5e62949f0e8b2a31d0bf17ce630551
hwc: Define and Use mSecureLock

Define and Use mSecureLock in composition and binder
thread. This is to ensure both variables mSecureMode
and mSecuring are updated in binder thread without
any context switch to composition thread

Change-Id: Ibd701bd3363515e2f7e8a9711bbc5b66053cfa03
HWC : Use Layer Caching in Video Only Use case on External

Currently Layer Caching is not used in Video only use case on
external. This causes GPU to redraw the UI layers every time.
This is causing under runs. This change will enable Layer
Caching in such use cases there by avoids  un necessary redraws.

Change-Id: Iedaf64b909dcd9d5b940c56c282c17a3b485637b
CRs-fixed: 514448
Merge "hwc: Define and Use mSecureLock"
Hwc: Allow MDP comp for upto 2-Layers with Alpha & scaling

Since we are allocating RGB pipes first, we can allow
MDP composition Upto 2 Layers with Alpha and scaling.

Change-Id: I6ceb2b1a2f9d2228530529d93352dc466e39eadc
CRs-fixed: 523212
Merge "HWC : Use Layer Caching in Video Only Use case on External"
Merge "Hwc: Allow MDP comp for upto 2-Layers with Alpha & scaling"
hwc: Increase precision in triming

Increase precision from float to double in triming calcs.
This improves the output. We need this since ultimately
we assign to int which would truncate excesses. With float
due to lower precision, we end up slightly lower than an
integral value.

Change-Id: I5d781b609be1761b746edf6503340f34a985b9e2
hwc: Do not show animation on External display.

- When primary is animating, the animation should not be
  shown on the external display.
- Mark all app layers as HWC_OVERLAY on external during
  animation so that SF wont compose it on FB.
- Remove default arguments from setMDPflags function to get rid of
  issues hidden from the developer.

Change-Id: Ic557cabfd9f2518614777c0e993541e36e090850

Change-Id: Ic78645675b0aaab284fe2d0de8fffb4b26beabc7
Revert "HWC : Use Layer Caching in Video Only Use case on External"

This reverts commit edfc717febd64a8cb7dae671aec4c3670485c162.
Merge "hwc: Increase precision in triming"
Merge "libhwcomposer: print a log if there is any delay in vsync read."
Merge "hwc: Do not show animation on External display."
Merge "Revert "HWC : Use Layer Caching in Video Only Use case on External""
display: External display refactor

  - cleans up external library
  - add separate library for virtual display
  - process virtual updates in its separate path
  in hwc.
  - Acquire blank mutex lock for one complete drawing
  cycle

Change-Id: Ib984c578464a131ecdb27ee48960f58d68b7a5a7
hwc: fix aspect ratio calculations

- Make aspectratio calculations independent of ext dpy w/h
- pass hwc_rect_t to getAspectRatioPosition function instead of
  x, y, w, h
- overload getAspectRatioPosition func to return the upscaled
  or transformed position for a particular display based on the
  values set by SurfaceFlinger

Change-Id: I0be9b2b4b030bdd8e69dc1493dc8cbac31918c27
hwc: Call commit on primary & external in blank

* Call commit on primary mixer in hwc_blank after unsetting
the pipes
* Call commit on mixer connected to hdmi/wfd with
 wait_for_finish set to true. This is needed to ensure
composition on external is completed.

Change-Id: I1ca01a27fb6d8e9f61bf84babcc38b1daae87e58
hwc: Fix locking.

Remove the unnecessary blank lock, mdp comp lock, secure lock.
Rename the ext lock to a more appropriate draw lock.

The mdp comp lock is at an incorrect place and causes unwanted
objects to show up in dumpsys, since configDone hasnt cleaned
them up yet.

dump(), blank(), draw() should all acquire a common lock.
draw() includes prepare() and set().

Change-Id: I595547dd5a393a8af6cd8c9297d50793b715e658
hwc: Fix Pause/Resume issues

  1. During PAUSE event, trigger an invalidate frame
     which will unset the pipes (in draw call) and invoke
     display commit as part of hwc_event thread.
     This is required to avoid iommu page faults arising when
     WFD encoder is in the middle of configuring buffers
     and providing to Writeback as part of RESUME event and
     Display HAL tries to invoke display commit as part of PAUSE.

  2. Allow usage of rotator for Primary when WFD is in Pause
     state.

The above changes are required to support secure/non-secure
video playback on HDCP WFD session and Pause/Resume.

Change-Id: I7391ae4cc7cd8b968873996a1a00fee5fbe6039c
hwc: Replace redundant display_commit with Overlay displayCommit

1. As part of Writeback class implementation, display commit is
implemented in Overlay class.
Replace display_commit function with Overlay::displayCommit
function.
2. Fix return value of hwc_blank function

Change-Id: Ie54fa9876495608a60216025e57cf4de7f6cb03c