SF: Block gpu rendering for virtual display widevine level3

In MPD3 we are using the widevine level3 for secure content
display. And this should applicable only for primary display
not for screen shot or screen recording.

CRs-Fixed: 595469
Change-Id: I99be2d81287ab746d5c4a2375c3106c59e61a8fc
Merge remote-tracking branch 'cm/cm-11.0' into cm-11.0
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
binder: update MemoryHeapIon

* Update from ODROID-XU 09232013 BSP release

Change-Id: I5245c8a9f783e8902bf91a0ee23e60ebeb335b27
Merge remote-tracking branch 'cm/cm-11.0' into cm-11.0
Add sessionId metadata with every buffer queued through Surface

Add sessionId metadata to identify the buffers to be belonging to a
single video session

Change-Id: Ic26cf1d7fdead1c38c0f43e562b7878663d7291c
Display: Add swaprect feature for MDP composition.

Add swaprect feature for MDP composition.
SwapRect is a SurfaceFlinger feature for selective composition
of only thedirty region.
* Existing SF does copying of the complete layer for every
 layer (in effect the full screen) whether or not the layer's
 information has changed (dirty region).
This is very inefficient use of compositing hardware (MDP/GPU).
* At the app level, we're doing dirty region rendering (App only
renders what is changed) using the feature "Dirty Region Rendering".
So, at the app level we know what has changed (dirty region) per
 layer. But SurfaceFlinger doesn't know this info and hence it's
 not able to use dirty region for selective composition and ends up
 compositing full screen.
* For SurfaceFlinger to composite only the dirty region
   1. It needs to know the dirty region (This needs to be passed
      down from the app)
   2. It needs to pass this info to the actual compositing hardware
     (MDP / GPU) so that the hw can do selective composition
* SWAPRECT feature needs to implement 1 & 2.
* 1 is common for all composition types whereas 2 is different
 for each composition type
This change implements 2 for MDP composition
* We've also added strong checks in the feature to make sure the
 feature kicks in only for the UX scenario's where performance
 improvement is expected and no functionality issue would arise.
To enable MDP Swaprect, setprop debug.sf.swaprect 1 and restart
framework.

Change-Id: Iac67acffcd4de1413cdbe0f15a278cc2cd54206f
Merge remote-tracking branch 'cm/cm-11.0' into cm-11.0

Conflicts:
	services/surfaceflinger/SurfaceFlinger.h