libexternal: Restrict external mdp downscale to 1080p

Enable MDP downscale feature on External display upto 1080p.
If primary is 2560x1600 and hdmi is 1080p, do not perform
MDP downscale for hdmi.

Change-Id: Icf069b2d916a68c81796f4004752407e1badfd1b
hwc: use sourceCropF instead of sourceCrop from hwc_layer_t

- Always use sourceCropF instead of sourceCrop
- This was missed as part of commit 14089e

Change-Id: Ia64050a41a174f3f038c9b88d527d70c2240f2d9
gralloc: Set default value for implementation defined formats

For implementation defined formats which go via HWC, set the
default value to RGBA8888

Change-Id: I7f8c46bc47746dcf1c4a03438b8f93d7bab78bb1
hwc: Fix unchecked return value

Check the return value of uevent_init function
and return on error.

Change-Id: I9dfca0ed84cbe5f1abf5716c5deed7808aa046ea
hwc: handle actionsafe with downscale on ext enabled

during actionsafe calculations, if downscale on ext is enabled, we need
to consider the physical display attributes.

Change-Id: Ia07218b0b8e47b91b0bf575c66478ebaeab2e2a4
CRs-fixed: 569152
hwc: Listen fb0 event for panel status

Listen fb0 status change event for panel status. fb0 will receive
"PANEL_ALIVE=0" when panel is not responding to status call.
Call blank and unblank to reset the panel in next hwc_prepare
call.

Change-Id: I941a501a82d9f3b725660ad09631c1d8602b7325
hwc: Fix for MDP Downscaling limitation

  For HDMI/WFD downscaling scenario, if the downscale factor is
  >=2, MDP cannot do downscaling without BLT mode. Since BLT mode
  is disabled, overlay_set_failure occurs when downscale factor
  is >=2 (Ex: primary resolution 1920 x 1080, External resolution
  640 x 480). To fix this, do MDP downscaling only when downscale
  factor is < 2.

Change-Id: I6361d0290ad75abc1f39662377e590cd288a48a8

Conflicts:
	libexternal/external.cpp
Disable Mixed mode for External

Disable Mixed mode for external only in the case
involving alpha scaling due to limitation of VG scaling
MDP4_OP_SCALEY_PIXEL_RPT algo to upscale RGB layer

Change-Id: Ic074c712b657bf0be6ba2262b08e315e33dd76c7
Crs-Fixed: 567571
WFD video playback scenario in downscale mode.

In case of downscale usecase, correct params are
not getting set for external/virtual.
This was due to missing function call
calcExtDisplayPosition in configureLowRes
for RGB layers.

Change-Id: I47fe556d84eef15827e6e5733359654f8970e406
Crs-Fixed: 565655
hwc: Add support for Secure display

- Identify secure display layer in the hwc_list
- Need to set both SECURE_OVERLAY and SECURE_DISPLAY flags for the secure
  display layer
- Disable idle timeout for secure display usecase, as GPU should not be
  accessing secure display layer

Change-Id: I555910db77c466b5e103b24b4f0ec7f47bb210a5

Conflicts:
	libhwcomposer/hwc_utils.h
hwc: remove unblanking fb from openframebufferdevice

- unblaking fb is done as part of surface flinger initialization
  so its not required here

Change-Id: Ifaed119503c74b5a75ffd6694d3508c4c15dfb60
gralloc: Fix caching for rarely read/write flags

GRALLOC_USAGE_SW_WRITE_RARELY and GRALLOC_USAGE_SW_READ_RARELY
need to be compared directly since they share bits with
GRALLOC_USAGE_SW_WRITE_OFTEN and GRALLOC_USAGE_SW_READ_OFTEN.

CRs-fixed: 569559

Change-Id: I52692027033e1036e3ad960b9e03dd8ee60b4111
Avoid ov set failures in rapid wfd pause/resume

* Avoid overlay set failures on receiving rapid wfd
pause/resume events.

* Go for videoOnlyComposition when isConfiguring is
set for external/virtual display and secure video
playback is happening instead of falling back to GPU
for composition.

* When external/virtual display is in pause state
and secure playback is happening, go for
videoOnlyComposition instead of full/partial MDP
compostion since the pipes connected to external mixer
will take atleast two vsync cycles to get unset.

* When requesting for an overlay pipe from pipebook,
give preference to the pipe which has already been
allocated to the required LayerMixer in the previous
round.

* Sometimes displayhal receives consecutive wfd-pauses
or wfd-resumes. Add a sanity check to avoid handling
unnecessary wfd pause/resume

Change-Id: Ie0cc835d921f303e1c731c70ae066c375052e5f9
libgralloc: correct assigment of HAL_PIXEL_FORMAT_RGBA_8888

- assign correct gralloc format when format is
  HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED and usage is
  GRALLOC_USAGE_HW_COMPOSER.

Change-Id: I741504d54694ac061ecd6c870cb8f815cc61ab24
CRs-Fixed: 583142
hwc: Do not use fb handle in hwc_prepare

Do not use fb handle in prepare. Use displayFrame for dimensions,
align them and hardcode format

Change-Id: I5c494a74a807d3a52a1c88257494b58c583700f5

Conflicts:
	libhwcomposer/hwc.cpp
	libhwcomposer/hwc_fbupdate.cpp
	libhwcomposer/hwc_fbupdate.h
fix merge issus

N/A

Change-Id: I81f520bcdd6b4a831644586215df18a43f962eec
Signed-off-by: huangqiwu <huangqiwu@xiaomi.com>
Donot compose layers if external is in pause state

* Donot compose external/virtual layer-list when
when external/virtual is in pause state.
* Marking the layers for GPU composition when external/virtual
is in pause state would update FB_TARGET layer which inturn would
affect partial mdpcomp after resume.

Change-Id: Id2806bd7156085c00158a31dff3c3dc4c2b61146
libhwcomposer: Fence FD Count not handled for CACHED layer

- Fence FD count should not be incremented for CACHED layer

Change-Id: Ie6670bd44d2ff3ee180ee8413bf81154ee122c43
hwcomposer : Fix copybit render buffer fence usage.

Fixing array size to hold fence fd to count of render
buffers used in copybit, and use it to store
fence of corresponding render buffer at the index.

Change-Id: Ic5e7f264c2a81ded2a0f61ef138e59a093b0023a

Conflicts:
	libhwcomposer/hwc_copybit.cpp
HWC: Fix for use int reference in function call

To use the integer reference, declared integer
variable to get value directly in that variable.

Change-Id: I1fd1a45580be99dd95ccbc3495e28455a4c7de23