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
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
libhwcomposer: Fix device freeze on HDMI resolution change

-Mutex dead lock is happening in invalidate call
-Separate invalidation from setExternalDisplay

Change-Id: I9a37dd031f573353e1785095c51d3d6108eb8363
CRs-Fixed: 395929
hwc: Fix flicker on 8660 for 2 layer bypass to UI mirror transition

-Make OV_BYPASS_2_LAYER to OV_CLOSED to OV_UI_MIRROR transition

Change-Id: Id8a65de734b76317b24244eed086872248e396f0
CRs-Fixed: 391977
libhwcomposer: Ensure VG pipe is allocated for UI mirroring

Set OV_MDP_PIPE_SHARE mdp flag to ensure that VG pipe is
allocated when requested for it.

Change-Id: I8d5bf93b06ec9f624dc3338e4af8fbd2120b9e3a

Conflicts:

	libhwcomposer/hwc_uimirror.cpp
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
Merge "hardware/qcom/display: Remove glfinish call"
Merge "libhwcomposer: Fix UI freeze on 8660 on HDMI cable connect"
Merge "libhwcomposer: Fix device freeze on HDMI resolution change"
Merge "hwc: Fix flicker on 8660 for 2 layer bypass to UI mirror transition"
Merge "libhwcomposer: Ensure VG pipe is allocated for UI mirroring"
hwc: wait for fb_post and PAN only if necessary.

Wait for fb_post only if external is connected.

Wait for PAN only if using overlay on primary. In other cases, drawing can run
ahead of thread doing PAN.

Change-Id: I5bc6f1efaf883297f3224a739ffdf7534cf0f075
Merge "hwc: wait for fb_post and PAN only if necessary."
Revert "hwc: wait for fb_post and PAN only if necessary."

This reverts commit d434a8ad7ed97b165359e9872cc7692555b0344d.
Merge "Revert "hwc: wait for fb_post and PAN only if necessary.""
liblight: Add LED blink support for network notifications

remove +x permissions: liblight/lights.c

CRs-fixed: 407474
(cherry picked from commit 9bc4e5d31eb11e9f851210fed59fe819a116ee49)

(cherry picked from commit ce898cab47ff25d472eaf022201336fe562c9408)

Change-Id: Ibe5cd9831819bd5e27ca59cb09f7a11b6eea5dad
Merge "liblight: Add LED blink support for network notifications"
hwc: fixes for vsync and race conditions

- Fix some race conditions between hwc_eventControl and the hwcVsyncThread.
- don't call vsync-ctrl ioctl for same enable value
- move enable disable ioctls to vsync thread, this stabilizes the vsync
  signal
- read again if vsync read is interrupted

Change-Id: I4065918b352769dd9fe18bd0dff4a87053299189
CRs-Fixed: 393243

Conflicts:

	libhwcomposer/hwc.cpp
hwc: dont return from vsync thread when read fails.

Read can return fail when the panel is off.
When read fails do not exit from the vsync thread,
continue with the vsync signal, as later there will
be correct vsync event from the driver

Change-Id: I0f145b93fe5d365eafb6b9e7661160f00f84db40
CRs-Fixed: 417529
hwc: avoid open/close of sysfs node on each vsync

Opens fb0 and fb1 vsync_event sysfs files at the beginning
and avoids open/close on each cycle

Change-Id: I68ffe6a615bb782879a16e5d3baa9afaf413558f