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
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
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
hardware/qcom/display: Fix overcounting frames with CALC_FPS

With a recent change, debug.gr.calcfps was enabled, frames were
being overcounted. This change fixes it.

CRs-fixed: 350335
(cherry picked from commit e8ea630b6b629403ad713b8cb3d912c4d54e7699)

Change-Id: I863072f3311c584edd30f7be74a3ab8122f05f01
libcopybit: Enable premultiplied alpha support

Premultiplied alpha is now supported on MDP3.x.
Enable it from userspace.
Also make flags as int since values are exceeding 255(uint8_t).

CRs-fixed: 347803
(cherry picked from commit 3dcbcb1f8672067f85e2f53e6321c27df6d6fbe6)

Change-Id: I865379b368726e95cab7aa669fbf27d5207240c5
Fix heap corruption in overlay clients.

Fix heap corruption in overlay clients, caused by missing
compilation flags. All libraries using overlayLib.h should
have flags used for conditional member declaration in overlay.

CRs-fixed: 342959
(cherry picked from commit 42120b29500560ebedbd897e2e7adf7369eb0a21)

Change-Id: Idf613861c4dc67e96ecadf7ce7e37472cb4e4daf
libhwcomposer: Implement idletimeout fallback for MDP composition .

Background: On MDP compositon, MDP keeps reading contents from the
pipes even on Idle Screen i.e. even when HWC is not queueing any new
buffers to MDP. Above data traffic leads to high power consumption.

Implementation: This change introduces a timer in HWC which will
timeout if there are no updates in bypass composition path for
the period specified via debug.bypass.idletime. Also SurfaceFlinger
will be notified to redraw the current frame which will be composed
into FB.

Conflicts:

	libhwcomposer/hwcomposer.cpp

Change-Id: Ic3a467596068fa553271b5cd8c2831e544e3211d
(cherry picked from commit ad1d9a019234ab03dbc79b1ddb73c86e560e3e74)

Conflicts:

	libhwcomposer/hwcomposer.cpp
liboverlay: set correct flags for external display channel

When external display is connected during video playback, the
flags to overlay was not set properly.
Pass the flags which comes from the hwc, by just changing the
WAIT_FOR_VSYNC(external should not wait for vsync)

(cherry picked from commit 857cfcba2d120d5da4916c7cb4fe119a08d1ce68)

Change-Id: I13100bebd223780eb9c709f384f0e4644e8295dc
hwcomposer: fix blank screen on external display.

fixes the black screen when external display is connected
during bypass and when video is paused.

(cherry picked from commit 2ffc188a6cad26a347e565211564640173f340ac)

Change-Id: I6caeda8bbc744a45164e2ae139345ba4aab55dab
CRs-fixed: 346284
liboverlay: Remove evening-out of layer destination coords.

Evening-out of layer destination coords causes a noticeable up & down
shift in the screen when video layer drawing switches between Overlay
and GPU. This is most easily observed during video playback or pause,
when a UI layer (like Menu) is displayed / hidden. Remove evening-out
of layer destination coords to fix the video layer "twitching" issue.

Change-Id: I3f43b53a7609c9ad8cc983c353fba6dc97460158
CRs-fixed: 348856 350073