fix a possible deadlock when removing a layer and destroying a client

generally the last reference to a Layer is released in commitTransaction()
with mStateLock held. Layer itself only holds weak references to Client,
however, ~Layer() briefly promotes this weak reference -- during that time
the all other strong references to that Client go away, ~Layer is left with
the last one... then hell breaks loose as ~Client is called, which in turn
needs to acquire mStateLock.

We fix this by holding a temporary copy of the drawing state during
the transaction so that the side-effects of copying the current
state into the drawing state are seen only after mStateLock has
been released.

Bug: 9106453
Change-Id: Ic5348ac12283500ead87286a37565e8da35f1db2
sf: virtual display clean up

  Since HAL allows Virtual devices, remove virtual display id
  check during setup of virtual display.

Change-Id: I6ec93c0f06842b69e6677f05ae8b45fb1f4225f6
libgui: Fix building with QCOM_BSP + CAF display

Change-Id: Iaf0eb69fa7f409144a266ada683fceb835f62aff
Merge "fix a possible deadlock when removing a layer and destroying a client" into cm-10.2
Forward-port surface dithering from CM10.1

This allows the use of 16-bit color displays without excessive color
banding; behavior can be controlled by the persist.sys.use_dithering
property.

This is a straight forward port of http://review.cyanogenmod.org/35240
for CM10.2.

Change-Id: Icb469b9cb4beb686516c60bb576dbd0a73f505e0
Prefer 16bpp surface formats

Adds a property to use RGB565 surface formats for the opaque
surface default, enabled by default.

Change-Id: Iac9bbc8292a863e2ab86093df3ecf218e4ec61e1
don't use fence sync for qcom legacy display

Change-Id: I4e7df9ac5c6e2eb5e6f923c907d0ec8d391a93d8
separate mHeap-based screenshot from BOARD_EGL_NEEDS_LEGACY_FB

No need for the Exynos/Tegra legacy fb implementation on legacy
qcom. Add a separate flag for mHeap-based screenshot in case of
future extensions. Enable mHeap-based screenshot for legacy qcom
dislay.

Change-Id: I35ff015555f19a5ba2857ad3d765d02eb6b9acde
Merge remote-tracking branch 'cm/cm-10.2' into cm-10.2

Conflicts:
	services/surfaceflinger/DisplayHardware/HWComposer.cpp
Add overlay support for camera

Change-Id: I4089f2ba9d4a23af6ce53e9d1ece08260511502d
Select texture target based on pixel format

Adreno is not optimized for GL_TEXTURE_EXTERNAL_OES, making GPU
utilization (and power), high with GL_TEXTURE_EXTERNAL_OES for
RGB formats.

Change texture target from GL_EXTERNAL_TEXTURE_OES to dynamically
select between GL_EXTERNAL_TEXTURE_OES, and GL_TEXTURE_2D based
on the pixel format.

CM9 original author: Neti Ravi Kumar
CM9-Change-Id: I89ab1d60b23eef55442a9fd338b2a05b3304ce61

Change-Id: I9ea82f3fd1d9caea22d4b1da843f2dedb2daf51b

Signed-off-by: Daz Jones <yuki@thebronasium.com>
surfaceflinger: enable EGL_NEEDS_FNW for qcom legacy

Signed-off-by: Michael Bestas <mikeioannina@gmail.com>

Change-Id: Ia6df94e8380062d646e29f293e5dc768e8a138e7
Merge branch 'cm-10.2' of github.com:androidarmv6/android_frameworks_native into cm-10.2