overlay: Allow kernel-controlled rotator formats

Recent qcom kernels (matching this source tree) have moved the
configuration of the destination color format from userspace
to kernel, as of change I7b7f36d97d3bb2fb04e89d57b8f11e8aa65b18c1
("msm: rotator: provide dst format based on src format").

This patch keeps the older default for compatibility with the
current kernels on most devices, but allows the use of the
QCOM_ROTATOR_KERNEL_FORMATS cflag to override it for devices in
which the mentioned kernel patch has been merged

Change-Id: I6d69b258eb390b5dd54f5158b28f929fdd319449
hwcomposer: Let the external display header be overloaded

Individual devices may want a different header

Change-Id: Ic2d9524dc2dfc4ff76e0516ac7cd02432f9c95f6
Merge "overlay: Allow kernel-controlled rotator formats" into ics
Merge "hwcomposer: Let the external display header be overloaded" into ics
qcom/display: flags clenup

Change-Id: I11c8a38f321a519f63e49e3179e2721894573da9
Display/hwcomposer:Add support for intermediate down scaling

Copybit module has a limited stretch to up/down scale.
Hence we need to do a intermediate stretch before going
to final stretch.
CRs-fixed: 341196

Change-Id: Ic547fdb8e88072f9f89032f047d04a7a26bddf71
(cherry picked from commit 256bde19b8f912388e19390570e5ea36f0208cfe)
libhwcomposer: Change dynamic composition strategy

Use copybit composition only for those frames where we
have maximum 2 full screen sized layers for composition.

Change-Id: Id34975f85dce11ba9365714655c994c6f3b0cabd
hardware/qcom/display: removing tiling debug messages

CRs-fixed: 343820
(cherry picked from commit 7ab561734ded4b52d5772584cc1369c7e3bedafa)

Conflicts:

	libtilerenderer/tilerenderer.cpp

Change-Id: Iafcd4035119bbb62a3ebcc5744279571fe9317ac
hwcomposer: Close MDP pipe on invalid gralloc handle

Unused bypass pipes need to be closed after unlocking their
buffer handles.This change makes sure the pipes are closed even
if client releases the buffers(invalid buffer handle) before
this function gets called.

CRs-Fixed: 344765
(cherry picked from commit d8761a761f7d2eddcec12841f4d9afd4261ee79e)

Change-Id: I449d0dce4ec458e19446fcc26316a3794a15f909
libQcomUI/libhwcomposer: Log and dump layers of screen frames.

Log a frame-by-frame succession of HWComposer layers' data and write
their buffers, if any, into raw or png files based on system property
values.

CRs-fixed: 339748

Change-Id: I171a9891a0867548b34d45c0561f25f66cf0580c
(cherry picked from commit 8166b062df4765af0b0d9f95d55fa14dd4b75b8d)
libQcomUI: handle WFD and HDMI concurrency

- Add external_display_type to differentiate WFD and HDMI
- based on the display type, handle wifi display and HDMI
  concurrency

Conflicts:

	libqcomui/qcom_ui.cpp
	libqcomui/qcom_ui.h

Change-Id: I48031c3c22ce14fc30e741676c3b19c816421856
libgralloc: Clearing PRIV_FLAGS_NOT_MAPPED.

- clearing PRIV_FLAGS_NOT_MAPPED if
  GRALLOC_USAGE_PRIVATE_DO_NOT_MAP flag is not set
  so mmap can be skipped.

Crs-fixed:342782

Change-Id: I01de82dedf08c8c41db179789cc3a9927aa7e221
(cherry picked from commit 67215121cdff9df78d6a80cda442a6bfc7aa27b3)
gralloc: Initialize and handle allocType correctly.

CRs-fixed: 346154
(cherry picked from commit a235dd6b4e8efe3cc432057806b3d5fb2cb4881d)

Change-Id: Ie657f6e52df5a4b39c9fa04e74aabe1135e5bdd5
Revert "libqcomui: Select texture target based on pixel format"

This reverts commit 4cfa30aa54ca589dfc3e9b0fbaac7eaeed2bbf2a.

CRs-Fixed: 345078, 344565
(cherry picked from commit 9f758ee2cfd486686b8e922c3222aaf944a1ad12)

Change-Id: Id39f8d36ec1f766d554e01781aff38ae11454c70
hwcomposer: Force close bypass MDP pipes on suspend.

Since SF wont compose when device is on suspend mode, MDP_UNSET can
be called to close all allocated bypass pipes.

Change-Id: Ia4610c34e6d89028f8b3400af023296c459dd8d1
(cherry picked from commit 32a9e25b699d7abde661f3ad947ed58a09a1b132)
Unlock overlay buffers before going to suspend

In video playback through overlay, it is observed that, during
suspend/resume, genlock TIMEOUT errors are seen at the component
level.

drawLayerUsingOverlay() function locks buffers, but doesn't unlock
them, before going to suspend, making the genlock_lock_buffer calls
from video component to fail.

Unlock any overlay buffers before going to suspend.

CRs-fixed: 342878
(cherry picked from commit 4ffcd156710184fe492294fd55beea7d5f412116)

Change-Id: Id0165f370d05d9b4bdf71ddaea15cf00caa65896
fix TARGET_USES_ION usage in libcopybit

The TARGET_USES_ION ifdef/endif adds -DUSE_ION to LOCAL_CFLAGS.
It must be after the "include $(CLEAR_VARS)" otherwise it has no
effect.

This fixes "E/copybit_c2d(  157): Invalid handle flags: 0x8" errors
seen when using TARGET_USES_ION := true.

Change-Id: I924346d9efd4ec06721a3eed68d3995f8dfb00cd
libhwcomposer: Implement register_proc in HWC

register_proc in HWC is used by SurfaceFlinger to register
callback functions with HWC. This can be used by HWC to invoke
SurfaceFlinger functions. Currently invalidate is the only function
registerd and can be used by HWC to trigger a screen re-draw.

CRs-Fixed: 342060
(cherry picked from commit 03a5cf4b9c52da2bfbd9706e85fddae63110ee9b)

Change-Id: I464370ebf63b93e0ce238395b5c165647d777575
libqcomUI: Add utils folder to libqcomUI

-Introduce utils folder in qcomUI lib for all Qcom
 implemented utility classes.
-Move FPS calculation profiler class into utils
 folder.

CRs-Fixed: 342060
(cherry picked from commit e9469022741642cfd8483839de96e809f4d94f1e)

Change-Id: Ie0af0c0cc10b5304814b4f26aed581ea93ce7f5f
Display: Fix swap interval 0

- debug.gr.swapinterval is now deprecated. It has been replaced by
  debug.egl.swapinterval.
- Do not disable MDP bypass if we have ASYNCHRONOUS layers present
  and debug.egl.swapinterval=0.
- Do not lock overlay buffers if debug.egl.swapinterval=0

Conflicts:

	liboverlay/overlayLibUI.cpp

Change-Id: I004a437397570ad62b589bb68db2b9815917f551