libhwcomposer: Check for downscaling with alpha

RGB pipe doesnot support downscaling with alpha on targets
with MDP 4.1 and less. Abort bypass for those targets if the
layer requires downscaling with alpha

Change-Id: I3450968458977626dfc90a9f35da593f08ced93c
Revert "hwc: Support VSYNC notification via sysfs"

This reverts commit 0d47bc4df5de25b8232a3c297a96d8def5e206af.

I suppose we'll use CAF's version.
hwcomposer : Use sysfs to read vysnc information

* Read sysfs entries, to get vsync timestamp from kernel.
* External display continues to use in ueventThread.
* A new thread, vsyncThread is created to read and send vsync
  timestamps to HAL.
* Disable H/W VSYNC for MDP 5.x targets until kernel changes are
  complete.

(cherry picked from commit a61a58cb775631cd3899211f6ff0aed232f5f3c0)

Change-Id: I58e09a092f81d4ff78b8cb4072ff06d2500c6f53
hwcomposer : Synchronize EventThread, and hwcVsyncThread

Synchronization is needed,to make sure, read() is not called
by hwcVsyncThread when VSYNC is disabled.

Otherwise in usecases, where display is OFF, and still some
tasks keep running in the background; SurfaceFlinger hogs
CPU.

(cherry picked from commit ffa84468bbd2517ffb22ab4023cb57a6272fc80d)

Change-Id: Idd779647a27ed3e6fb0703a07033dd5f7cd1b5fd
libqdutils: Initialized GPU layer present flag to false

Change-Id: I8d7ce6acdc28fbd562f60cd8c96d993817d6489a
libhwcomposer: Fix bug caused by change 152124

The change in 152124 makes the yuvLayerIndex equal to the pipLayerIndex
because of which overlay is used only for the pip video and not the main
video. Removing the assignment operation since that is updated when
yuvCount is 1.

Change-Id: I4a96a0e57c43e2c4888d3497229a9a24dde2ca27
hardware/qcom/display: Remove glfinish call

There is no need to do a glFinish on every composition complete.
glFinish needs to be called for composition cycles where GPU and
copybit are both used for composition. This is because the GPU and
copybit operate on the same framebuffer.

(cherry picked from commit 7983c275ae3eb15fab931d301e6338f83ad4a75a)

Change-Id: If06da4ca60ec17122c3dd698558cbf08fec73251
hwcexternal: fixes in hwc_external

- instead of FBIOPUT_VSCREENINFO ioctl, use the new ioctl
  OVERLAY_PIPE_COMMIT to update the external display
- when MSMFB_OVERLAY_VSYNC_CTRL ioctls fails, return -errno

Change-Id: Ie37309615f7fa39f20fa347fc53c04f7fcab9740
CRs-fixed: 391564
hwcomposer: Add secure intents to support Secure Playback

   Add OPEN_SECURE_START, OPEN_SECURE_END, CLOSE_SECURE_START
   and CLOSE_SECURE_END secure intents for Securing/Unsecuring
   start and end notifications.

   1. On Open Secure Start and Close Secure End events, hwc_prepare
      close the current overlay state and composition will be
      done by GPU. This will teardown the exisiting Rotator session.
   2. On Open Secure End, secure configuration is enabled and
      subsequent hwc_prepare will allocate secure memory for Rotator.
   3. On Close Secure End, secure configuration is disabled and
      subsequent hwc_prepare calls will allocate non-secure memory
      for Rotator.

Change-Id: Ia81b21d19f8084f218ae16eb8e69bb62937afa26

Conflicts:
	libhwcomposer/hwc_utils.h
HWC/copybit::Add condition for video layer composition

In case of non overlay target composition of the video
layer should base on composition of UI layer as well.
(if taget has dynamic composition)

Change-Id: I5eb91adec340297fdc4b0560f01f74aaf8459586
CRs-fixed: 397517
libhwcomposer: Correct an enum mismatch in the HAL.

Correct the enumeration value of HWC_USE_COPYBIT factoring in the new
HWC_BACKGROUND enum in hwcomposer_defs.h.

Change-Id: I4a8f60ac1b5387bf6068a626d00db0b2e193ee98
libhwcomposer: Fix UI freeze on 8660 on HDMI cable connect

-In 3 layer bypass case on hdmi cable connection, UI freezes.
-Overlay state change from OV_BYPASS_3_LAYER to OV_UI_MIRROR
directly not possible on 8660 as BF pipe is not available.
-Add support to change overlay state via OV_CLOSED to make pipe free
 OV_BYPASS_3_LAYER-->OV_CLOSED-->OV_UI_MIRROR
-Move processUEventOnline to prepare thread.

Change-Id: I29c657ab799d1cd4ad52adcf6a8f86d18e76bcf9
CRs-Fixed: 386335

Conflicts:

	libhwcomposer/hwc_utils.h

Conflicts:
	libhwcomposer/hwc_utils.cpp
libhwcexternal: remove unnessary ioctls

- fb open will turn on the framebuffer device, no need of explicit
  UNBLANK
- remove PANDISPLAY as it will be trigged by FBIOPUT_VSCREENINFO

Change-Id: I58bc1ebea924809b32a8e51eb81a2cc926538465
overlay: mdprot: Call rotator start only on config change.

Call ROTATOR_START ioctl only if the rotator config changes.
Save the last good config when the start succeeds.

Make getSessId()'s return type uint32_t to match the member's.

Change-Id: I5ca048ea866316f18d8df14dc08218fca2c82bdf
hwcomposer: 7x30: disable overlays for video playback

check MDP revision and disable overlays for video playback usecase
on 7x30.

Change-Id: I8b179512b4aff136834dd80e4da7227a6b2aff4e
libqdutils: Fix crash in checkForGPULayer

 * This will be NULL when SF is disabling HWC. Don't crash!

Change-Id: I0b988b0c0f224ef7281dc9049449f3202fce835f