Revert "Simplify OpenGL TLS access on ARM."

This reverts commit 288870ebc3da8121b7a237a53280bd8b931b7a2f.

Conflicts:

	opengl/libagl/Android.mk
	opengl/libs/EGL/getProcAddress.cpp
	opengl/libs/GLES2/gl2.cpp
	opengl/libs/GLES_CM/gl.cpp

Change-Id: I1401ab19e3035c1ed132781f126aafc5149d66ae

Conflicts:

	opengl/libs/Android.mk

Conflicts:
	opengl/libs/Android.mk
Add overlay support for camera

Change-Id: I4089f2ba9d4a23af6ce53e9d1ece08260511502d
binder: add compat getCallingUidEv symbol

Fixes lg ril :
E/RILD    (27586): dlopen failed: dlopen failed: could not load library "liblgdrm.so" needed by
 "libril-qc-1.so"; caused by cannot locate symbol "_ZN7android14IPCThreadState13getCallingUidEv"
  referenced by "liblgdrm.so"...

Change-Id: I1e27583ec4b08147d31cb1976ea49336e451e0b6
MemoryHeapBase: ifdef for gingerbread/froyo compatibility

This change is required to use overlay based proprietary camera libs
coming from gingerbread and froyo builds.

This change also requires a global cflag named BINDER_COMPAT
because a lot of modules use the MemoryHeap includes

Add this in your BoardConfig.mk :
COMMON_GLOBAL_CFLAGS += -DBINDER_COMPAT

Backported from /#/c/13317/

Change-Id: I919a2a89d5efa0eab5ef286979fcd823b62a363c
(cherry picked from commit 5ed802ec57a87d78008b13fc094fdb99ddc5206b)
msm7x27: Disable fence sync

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

Change-Id: Ifecc7af579bfde9d0a7daaaf528ea0773ce6ceb2

Conflicts:
	libs/gui/Android.mk
DisplayDevice: Backwards compatibility with old EGL

From 4.1 to 4.2, the display subsystem was reworked to
use SurfaceTextureClient/BufferQueue instead of
FramebufferNativeWindow for the framebuffer itself.

Unfortunately, some legacy EGL libraries make assumptions
that any framebuffer device will be FramebufferNativeWindow.

These EGL libraries will fail when used in 4.2 as if the
framebuffer is not FramebufferNativeWindow, they will
try to dequeue more than one buffer at a time, which
will cause a hang of the graphics subsystem.

This allows use of FramebufferNativeWindow to keep
legacy EGL implementations happy.  Confirmed EGL
implementations that need this include but are
not limited to:

Set BOARD_EGL_NEEDS_FNW to use

Tegra2/3 ICS EGL
Mali400 ICS EGL (Allwinner A10)
Mali400 Jellybean (4.1) EGL (Samsung Exynos4)
Adreno Jellybean (4.1) EGL (legacy qcom devices using PMEM)

Original implementation by OndraOrg of XDA:
http://forum.xda-developers.com/showpost.php?p=34469675&postcount=19

Change-Id: If7c455035a002f272fa1a8af1cfcc60eb7ade894

Conflicts:
	services/surfaceflinger/Android.mk
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.

This change is done to reduce the composition time for 8x55

Conflicts:
        libs/gui/Android.mk

Change-Id: I89ab1d60b23eef55442a9fd338b2a05b3304ce61
Prefer 16bpp surface formats

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

Conflicts:
	services/surfaceflinger/SurfaceFlinger.cpp
	services/surfaceflinger/SurfaceFlinger.h

Change-Id: Iac9bbc8292a863e2ab86093df3ecf218e4ec61e1
fix DECIDE_TEXTURE_TARGET

The DECIDE_TEXTURE_TARGET hack wasn't correctly handling the
BufferRejecter that was added in JB and this resulted in various
graphical corruption.

see
   http://www.modaco.com/topic/359832-devrom247-cyanogenmod-101-android-422/?p=2107115
and
   https://github.com/grigorig/android_device_zte_blade/commit/f1bbba27fbc439db283cde010cbbf4f962cc8c50

Change-Id: I934345601ff38c3b404ffc704476d2820d5ab515
Revert "free EGL resources associated to a thread when it terminates"

This reverts commit 4e620ddce344e946ced992f61a69c367ff92fe24.

reverting this commit stops applications crashing when leaving GL views.
it's most easily seen when leaving the MyTracks maps view.
eg.
  E/Adreno200-EGL( 1662): <qeglDrvAPI_eglMakeCurrent:2668>: EGL_BAD_CONTEXT
  E/libEGL  ( 1662): eglMakeCurrent:781 error 3006 (EGL_BAD_CONTEXT)
and sometimes 1000's of these until the app is destroyed
  D/OpenGLRenderer( 1310): GL error from OpenGLRenderer: 0x502
  E/OpenGLRenderer( 1310):   GL_INVALID_OPERATION

Change-Id: I6af4ad388b69184ab2d3f79c0b7ccca03acac0e1