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
Surfaceflinger: Modify setFormat() API to set 3D format.

setFormat() API is modified to accept 3D formats from applications.
This change is required for 3D game usecase so each layer can be
marked as 3D and can be sent to overlay for rendering.

Change-Id: I9266d9ab367c5eccb8fb182f3f517234415a9897
SurfaceTexture: Initialize S3D format member variable to 0

Without initialization mS3DFormat may hold garbage value, and
may corrupt the format calculations in libQcomUI.

This change is done to fix UI corruption.

Change-Id: I55491ce82a49f69eb290bc4a078f7995589335f3
MediaRecorder: Remove creation of new thread when voting for io_is_busy

Change-Id: I682b91be2a001f19eb4b8c90a4d0e450bbbe1f71
CRs-Fixed: 339691
add missing #ifndef
Surfaceflinger: Compose UI in S3D format

The new member of LayerBase takes care of identifying layer for 3d
composition. When 3D composition is required the Layer takes care
of drawing in 3D format

Change-Id: I55c99a3cb612c6dd7a22d346a5b9a88c056c835d
SurfaceFlinger: Return error on invalid buffer creation

When a buffer is re-allocated on reconfiguration, return NULL
if there is an error in re-allocation.

Also, remove warnings during compilation.

Change-Id: Ie01bfcfbb469a106ef99bf1725376e2753206708
CRs-Fixed: 337660
SurfaceFlinger: Skip composition when rotation is not completed

When rotating, each layer's buffer is already changed to
new orientation before SurfaceFlinger gets the signal from
Window Manager. If the orientations of all the buffers are
changed to new orientation, then that's fine. But, sometimes,
only one buffer is changed and others remain the same.
In this case, skip composition.

Change-Id: I850fe8ee6d806e21833e6811f95878fcfb6f7c40
CRs-fixed: 338034
SurfaceFlinger: Prevent screencap command from failure

For secure windows, screen capture fails, and the screencap command
falls back to reading from the framebuffer directly.

Instead, draw a black screen on the framebuffer object if there is a
secure session, so that secure layers cannot be captured.

Change-Id: Ic14ee3f119f622b41f1af3861237204805fb3ca2
CRs-Fixed: 338570
SurfaceFlinger: notify HWC when layer is in asynchronous mode

When the layer is in asynchronous mode the HWC may choose a
different composition method.

CRs-Fixed: 335498
Change-Id: Ifa4658338e98e80e9a673bdf10ae388f0ad3ae9f
Remove 'Bypass Texture Creation' hack in frameworks

Graphics driver (ADRENO) was updated to convert the texture on
first use. Hence this change is no longer required.

CRs-fixed: 338153
libRS: Correct the screen freezing issue

This fixes a timing issue where it could calculate a delay of 0
(indicating wait forever) when it has no pending commands to actually
execute. In such cases, it should just break out of the playback loop.
This also fixes a small issue with returning whether or not to redraw.
(Provided by Stephen Hines <srhines@google.com>)

CRs-Fixed: 330352

Change-Id: If3c880e1546105279d286ae76cc41e8b8f193ec1
SurfaceTextureClient: Add support for external only usage flags.

Add support for GRALLOC_USAGE_EXTERNAL_ONLY and
GRALLOC_USAGE_EXTERNAL_BLOCK to be set as a part of usage flags.
These flags if present will be cached by SurfaceTextureClient.
Incoming usage flags will be ORed with these, if present.

(cherry picked from commit dcbd475319bae2f5d0613bf62d8324169e6ab79d)

Change-Id: I366f6a664805e8944663600dc3b1f82530275873
QCOM-related cleanups

* Hide qcom-specific methods from the API
* Disable service classes
* Fix media-recorder start/stop for non-qcoms

Change-Id: I42b1acb5c732182663fea89039f57e775afb3ebe