SurfaceFlinger: Set the buffer size in the GraphicBufferAlloc

When setting the buffer size, store the required size, and allocate
the buffer of the required size in GraphicBufferAlloc, instead of
SurfaceTexture. We do this because SurfaceTexture does not always
run in the server process space. GraphicBufferAlloc always runs in the
server process.
SurfaceTexture: Avoid binding texture if format not supported in GPU HW

Certain formats may not be supported in GPU HW. For them, avoid binding
textures. When the textures created from surface flinger, they may not
be needed if we are not using GPU composition.
Fix 'Avoid Binding Texture' logic in SurfaceTexture & SurfaceFlinger

CRs-fixed: 335449
frameworks/base: Add cpu governor service

Increase sampling rate when the display turns off and set it
back to the original value when it turns back on. This helps
reduce power consumption for use cases such as MP3 playback with
the display turned off.
frameworks/base: Vote to turn off io_is_busy during recording.

When recording starts, vote to turn off io_is_busy. After
recording stops, take out that vote so that io_is_busy can
go to its original value. Doing this saves power by reducing
the amount of time for which the CPU runs at high frequencies
when encoded data is being written to the SD card - a process
that causes io_wait times to shoot up. With io_is_busy turned off,
these wait times will not be considered as CPU busy time and so
the ondemand governor will not unnecessarily bump up the clock rate.
The votes are handled by the CpuGovernorService. Also move the
dynamic sampling rate and vote processor classes out of the
CpuGovernorService to improve modularity.
DynamicMemoryManagerService: Add DMM functionality.

Call Power API's to switch unstable memory between Active/Disabled states.
DynamicMemoryManagerService: Use Wakelock to Prevent Suspend.

Use Wakelock to prevent Suspend from being attempted during PageMigration.
DMM Service: Offline Memory only if DMM is enabled.

Add a check to see if DMM is enabled before the request to turn off unstable
memory.
binder: add support for Ion

Add classes to allocate from the Ion memory manager.
binder: Get rid of old flag

MAP_LOCKED_MAP_POPULATE is an outdated flag that is not used
anymore. Get rid of this flag in MemoryHeapIon
DisplayHardware: Set MDP composition flag correctly
SurfaceFlinger: Fix surfaceflinger crash when showing screen update

With selecting 'show screen update' option under Setting/Developer
options, there's crash in getYUVBufferCount() in Hwcomposer.cpp.
This occurs because the handles of hwc_layer_list have invalid
values that are passed from HWComposer:createWorkList().
Initialized hwc_layer_list after it is allocated.
Remove opaque check in GLRenderer when preparing dirty region.

Since preserved swap is enabled, we need to clear the color buffer
when the scissor rect is prepared for a new process. This prevents
garbage to be present from the previous process in the color buffer
libs/rs: Fix parameter swap in rsAllocation

This change swaps index and size parameter in rsAllocation calls as
Google's comment suggests
libRS: release last surface reference when shutting down GL
Merge remote-tracking branch 'origin/ics_chocolate_M8260AAABQNLZA30136' into HEAD
Merge branch 'ics_chocolate_M8260AAABQNLZA30136' into HEAD
f/b: missing qcom ifdef
Support triple application buffers

This change modifies surfaceflinger to use 3 application buffers
by default for performance improvement.

Change-Id: Ia3b1354f1b5d23f8237d73d1761436dd05ab004a
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
CRs-fixed: 328074