egl: Addition of eglGpuPerfHintQCOM.

This patch implements a wrapper that hooks into the QCOM
functionality.

Change-Id: Ifcb77e90ba137a4dede7d25663b032df6acc799d
Surface: Initialize variable and add a defensive check

Initialize buf variable and make sure to check for return
value of dequeueBuffer() before sending to the client.

Change-Id: I0569f2d45825fab0e5d0f38fc91a07990f57c7ab
frameworks/native: Propagate dirty region in hwc_layer.

This change propagates dirty rect value of each layer down to HWC
in hwc_layer structure.

Conflicts:
	include/gui/IGraphicBufferProducer.h
	libs/gui/BufferQueueProducer.cpp
	libs/gui/Surface.cpp
	services/surfaceflinger/Layer.cpp
	services/surfaceflinger/Layer.h

Change-Id: I91d87facf4a321b92539de5353faf09b553d4919
SurfaceFlinger: Add support for virtual display

- Creates a rendering surface when invoked via hybrid path
- Makes changes in HWC wrapper to handle virtual display via HWC

Change-Id: I86560b5009949b75c267249799a446b8279eff32
Conflicts:
services/surfaceflinger/SurfaceFlinger.h
services/surfaceflinger/SurfaceFlinger.cpp
sf: vds: Selectively compose displays via HWC.

1. Replace static force copy flag with member variable

The decision to copy a virtual display using the WriteBack path will be
done when the display is created. We initialize the member variable to
false meaning all virtual display devices are composed via GLES.

2. Select which displays to compose based on sink usage flags

We should compose a display using HWC only if the sink usage contains
GRALLOC_USAGE_PRIVATE_WFD and GRALLOC_USAGE_HW_VIDEO_ENCODER flags.

If this condition is not met then the display is composed using GLES.
This means that GLES composes directly into the sink buffer and signals
the consumer. Furthermore, it is expected that any color conversion will
be handled on the consumer side.

3. Add debug hook for ScreenRecord use case

We add a debug hook which serves to by-pass the checks imposed by (2).
This is useful for debugging purposes and allows us to test VDS
end-to-end when WFD is not working on a particular build.

The debug hook is through the system property: debug.hwc.screenrecord

4. Update composition checks

-mFbProducerSlot is always at least 0 so there is no point in validating
 it when in advanceFrame().
-Release scratch buffers in onFrameCommitted as long as mFbProducerSlot
 is valid.

Change-Id: I2964e2f8d0b3e848895cdf4f41df8a5d2739ddad

Conflicts:
services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp
Change-Id: I2d2fc152f14487c4f24dbfb210c81c21346bdbe3
sf: Add dirtyRect information to SF dumpsys

Display dirtyRect information generated for each layer in
SurfaceFlinger Dumpsys.

Change-Id: Ie60f4bf67bc28af0fcce006c166d8ae4ed4985e8
frameworks/native: Reset dirtyRect after every queuebuffer call.

Sometimes HWR does not generate dirtyRect even when it updates the
buffer. To avoid incorrect DR calculation in such cases reset
cached dirtyRect after every queueBuffer call.

Change-Id: Iad9a2b1ecb4cf2a3789f2734a2d0e928dc56c9f0
SurfaceFlinger: Change to support framebuffer flip for 2D blitters

- Surfaceflinger does not flip framebuffers when there are
  no layers marked for HWC_FRAMEBUFFER
- This change checks for the HWC_BLIT flag and will request a flip
  to a new FB_TARGET buffer even if there are no FRAMEBUFFER layers

Conflicts:
	services/surfaceflinger/DisplayHardware/HWComposer.cpp
	services/surfaceflinger/Layer.cpp

Change-Id: I1cb44389a05c9ec049d7f0d39c288feccb11a91c
SF: Avoid wormhole clear for BLIT calls

Do not call GPU clear from SF when composition
type is BLIT as it'll be taken care in HAL.

Change-Id: Ia613eb9b824c6484ecc8c8fa4ee883545d8541b8
SF: Modify logic to handle "transparent Region" for displayFrame

sourceCrop and displayFrame calculations according to "transparent Region"
are not synchronized. Because of this mismatch scaling is introduced,
causing corruption in UI. To avoid this scaling, map displayFrame to
sourceCrop, apply reduce and remap result to displayFrame.

CRs-Fixed: 660699,651365

Change-Id: I1e7ad5b1c8932413f53bb94a2e62895661b97057
sf: Enable QCOM_BSP if TARGET_USES_QCOM_BSP is set.

Enable QCOM_BSP if TARGET_USES_QCOM_BSP is set in target
BoardConfig

Change-Id: I0288976c2d2000eff62430ad3d726725bda3e135
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.

CRs-fixed: 562334
Change-Id: I52de68258ac9f87d704ee5401f93417805fa6773
surfaceflinger: Set max acquired buffer count

If triple framebuffers are enabled, the number of acquired
buffers isn't increased by default. Set the count to one less
than the max buffers to make sure all three buffers come into
play.

Change-Id: I65054ed4004607f5be68c893f6f621e821cfbf1c
SF: Fix invalid reduction of transparent region from a layer.

Reduce transparent region from a layer only if the transparent
region has valid intersection with the layer. Otherwise, reducing
a transparent region lying completely outside of the layer leads to
invalid sourcecrop values for the layer.

Change-Id: Iee9ba53a8072c21c9ba8a6d58cb14ca30f8600ba
CRs-Fixed: 620973
GlES2: Add NULL check

Check for NULL before calling thread specific glGetString.

CRs-fixed: 569609

Change-Id: Ifee8257152ba7ca7a05df5d7b113171b71d16c82
Init display orientation according to panel orientation

   - Initialize the display default orientation to panel orientation.
   - honor the panel orientation only after the end of boot animation
     or the new orientation is as same as panel orientation.

Change-Id: Ieece097ff7c3710e379f47028900aed59a96c8d5
SF: Ensure boot animation always appears in panel orientation

Ensure that boot animation is always shown in panel
orientation.

Change-Id: I36a75ba5aea803a7b7cace3335a0d7f730612c5d
CRs-Fixed: 604934
sf: Set view frame of each display using binder

Set the view frame of a display using binder when set projection
for that display changes

Change-Id: Ib85ce80e88b207a4cf2559b2cc0e74e60ab3d4d4
surfaceflinger: Allow gpu to render widevine level3

Allow gpu to render widevine level3 but keep
blocking screen shots.

CRs-fixed: 428647,424769,421767
Change-Id: I914232a062acbb7b17901dbf2b414973230e59d9
sf: Fix incorrect state reporting in dumpsys

Dumpsys utility access layer compositionType variable
with out proper protection. These variables are modified
during hwc_prepare call. Existing HAL lock protection is not
sufficient to address this issue. Failure to do this will
result in incorrect state reporting in dumpsys.

A new drawLock mutex in HWComposer that will be used in both
dumpsys and draw calls to ensure correct state is accessed.

Change-Id: I6289e0a3d1f5bbf35a18ddcd0538c9cda3e96c27