frameworks/native: fix copy back dirty region

Copyback dirty region logic does copyback,
even when its not necessary causing 2ms delay.
Fix the logic to copy back only what is necessary.

Change-Id: I52de68258ac9f87d704ee5401f93417805fa6773
Omap3 Workaround

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

Allow to "revert" by a board config flag the offset member addon
see commit f24c4cd0f20 (aosp change id Ie618fb5c0718e)

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: I2e5c10d3cd9584803dd282aa17650661d6499e5b

Conflicts:

	include/binder/MemoryHeapBase.h
SurfaceFlinger: try dropping features from EGL config query before giving up

Change-Id: I914aba2b0404646a29854e8e2ffa708958fb41f1
libEGL: restore SYSTEMUI_PBSIZE_HACK

This was removed in the otherwise unrelated commit f4486c6...

Change-Id: I6b62a3a4332a0376eb6865c2674aaf3f8ef262bd
libEGL: restore SYSTEMUI_PBSIZE_HACK

Change-Id: Ic781391f622c67e64e0bf0f55dbd65a3f64b0089
DisplayDevice: Backwards compatibility with old EGL

Change-Id: I1c839339678c5be0c248e4fb9f8edbe1330f9472
Surfaceflinger: Remove ifdef on GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE

https://github.com/omnirom/android_frameworks_native/commit/e0c4ab43ce7a851ab5fefbd2e8e259daf1c48c68

The above revert commit brought the if (!useReadPixels) statement back in when it isn't
necessary.

Huge thanks to ankitkv for discovering this!

Change-Id: Idc31c49034aa5c1960bad4976f8cac5358b30b48
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
	services/surfaceflinger/DisplayDevice.cpp