Forward-port surface dithering from CM10.2

This allows the use of 16-bit color displays without excessive color
banding;

Change-Id: Icb469b9cb4beb686516c60bb576dbd0a73f505e0
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
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

Change-Id: I89ab1d60b23eef55442a9fd338b2a05b3304ce61
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