display-caf: squashed CM commits (2/2)
libhwcomposer: Don't count video layers marked for SKIP

When YUV layers are marked for SKIP, it needs to be composed by
SurfaceFlinger. No need for tracking them in HWC

Change-Id: I4c8ca9710b709b9df9dcb6867681387b7507e14c

Update copyright to The Linux Foundation

Change-Id: I145b66896159ff9886ed73507f17b3165ba0266d

hwc: Don't use MDP for buffers of width less than 5

This is a software workaround for MDP hardware limitation where
DSI mode panels wont give more than 30 FPS if buffers in RGB
pipes are of width less than 5

MDP can't handle layers of width less than 3. Fail MDP
Composition for those frames.

Change-Id: If45efab19817ea9e724fd2857fcc1c5d98ce0eab

gralloc: Fix redefinition of metadata struct

Change-Id: I2309a9769c5f0c2aeb52d73c775e85ca597f4728

display: Add support for MDP 4.1

 * MDP 4.1 does not support the borderfill pipe and the baselayer logic
   should not be used.
 * Only use 3 pipes for MDP 4.1.

Change-Id: Ide542079902f35818300619f8eefd3d188342b5d

Revert "gralloc: Support for old and new ION API"

This reverts commit fc202c400a62475cba2410106d8bbd77eb7e9f5c.

Update buffer dimensions with new dimension

Add case GRALLOC_MODULE_PERFORM_UPDATE_BUFFER_GEOMETRY in
gralloc_perform function to update the new buffer dimensions.

Change-Id: I7a855dc017dd042dda2abdc28c51ce5ec919fceb

display: Add display metadata in buffer handle

Allocate extra space for metadata in buffer handles
Provide api to map this space in client process and set the metadata

Change-Id: I8bca8448670d4aa88d439320faf402dae30458f8

display: Add support for Venus color format for newer platforms

Change-Id: I4c9a327bd30d1321e1f8383ffc1ca978efc8e9b9

Conflicts:

	liboverlay/overlayUtils.h
	libqdutils/gpuformats.h
	libqdutils/qcom_ui.cpp

libgralloc: Add support for custom buffer size.

Init allocSize hook function with alloc_size function

Change-Id: I514d47928f10b6c41404aa19d8b704f64327211b

display: Reconcile display HALs

Make the display HALs compile with/without the Qualcomm BSP
specific features so they can work with pure AOSP.
Change-Id: I1ad7282c4fe1fe7e3309afb530a07735f165ffbe

Conflicts:
	common.mk

mdssRotator:For Venus, rotator buffer size depends on rotated w/h

Due to alignment requirements on venus format, rotator buffer size
calculation needs to be performed according to destination buffer
dimensions. Due to these alignments, the buffer can be different
when width and height are swapped due to 90 degree rotation.

Change-Id: I8eb0f1ece22946e6c3b2106623c3457e6871fd9c

liboverlay: Mdss Rotator secure buffer needs to be aligned to 1M.

It is TZ requirement, xpu needs the buffer size to be 1MB aligned
for protection.

Change-Id: Icd9047a54d5706c321445e7970fb0f455d0c130b

overlay: mdssRot: Fix stale rotation flag values.

When moving from a non-zero to 0 orientation rot flags are not cleared.
This change resets the flag to 0 after every commit.

Change-Id: I2fb9759921c36620c53bf2ac92d9473a42919d8c

overlay: mdssRot: Fix the logic for setting Rotator info flags.

Set the required flags instead of considering SECURE flag only.

CRs-Fixed: 423045

Change-Id: I82699d23de97c5276cac8f3b614b5d0463d7b06a

overlay: mdssRot: Do not reset non-rotation flags.

Reset only rotation flags to fix stale orientation flag values.
Resetting non-rotation flag breaks secure-playback using rotator.

CRs-Fixed: 440417

Change-Id: Ia35c6258cfd26358b3dfe5cb006e9245d51e3dfc

liboverlay: Set mdp src format as rotator output format.

* Set mdp source format as rotator output format
rather than determine it from a fixed mapping of
input/output formats.

* This is needed since for the same input format
to rotator, fastyuv mode if enabled may result in
a different output format than the one if the mode
is not enabled.

* Do the inline optimization for rotator where possible

CRs-fixed: 451064
Change-Id: If0bb2f3a44df10968383ab3f5c3625257518934d

liboverlay: Fix stride alignment issue for s/w decoded video.

1. Due to alignment requirements on HAL_PIXEL_FORMAT_YV12 format,
rotator buffer size calculation needs to be performed based on
rotated width and height because buffer size can be different when
width & height are swapped due to 90 degree rotation.

2. Input and output color formats are same for MDSS Rotator.

Change-Id: I0a06ef9bb7bdceb951e7ab5160dac3e92a28bcda
CRs-Fixed: 451871

hwc: Log if vsync read takes more than 2 expected vsyncs

Change-Id: Id1daffa9d1d3521f42d121634bf5b00757f3609f

gralloc: Add TARGET_USES_QCOM_BSP flag for non-AOSP features

 * Also add additional ifdefs for metadata feature.

Change-Id: Iba1430a34a7123a7bcda3bf89ea2a0deb85fb334

Fix ION_IOC_MAP error on old ion api during drm video playback

Video playback in the Google Play Video app would
result in an ION_IOC_MAP invalid argument error and
the app to display error 22.

This fixes some old ion api code left out with the
"display: Reconcile display HALs" commit which resulted
in the invalid arugment or an out of memory error.

This was found using a Nexus 4 (mako) and the Google Play Movies
app while attempting DRM video playback.

Change-Id: I2f7724515cbb7449086611fb79d042ea71d6eb39

display: Disable unsupported copybit features

Change-Id: I2eea2c725e4e0a195b0b4842fe52bf08e3e4e713

gralloc: Remove usage of METADATA_SET ioctl

 * No longer needed to configure base layer alpha

Change-Id: I21ae663c530da9c848a3605a9f16bedbeea1502e

Revert "libhwcomposer: Don't count video layers marked for SKIP"

 * Causing a memory leak during orientation change.

This reverts commit 357f747b7e4b7206230aa540e3c916258012dfb7.

display: Disable use of copybit temporarily

 * HWC will optimize drawing with copybit when the device is
   rotated 90/270 degrees as MDP cannot rotate the UI (HWC_BLIT),
   however the version of C2D2 currently available does not support
   fence_sync. This causes tearing when scrolling lists (Play Store,
   etc).
 * Put an ifdef around copybit initialization so HWC uses GLES instead.
 * We can remove this when an updated driver is available.

Bug: QSDB-9
Change-Id: I0d046c89782c7a1ef0d780b78f787d49005c4695

display: Don't enable pixel repeat for YUV buffers

 * This can cause horrible things to happen on msm8660 like clock rates
   going to a zillion hz, hard lockups, artifacts, and the smell of
   fresh ozone in the air. Don't do it.

Change-Id: Ic3b8541fc149c593e46ca5ed0c1ee14cab6af71a

Revert "Revert "libhwcomposer: Don't count video layers marked for SKIP""

This reverts commit 5b9ee9522eff9f43eb13692e2d15f8d500b680a2.

libhwcomposer: Only 4 pipes can be used per display for MDP Comp.

Although 6 pipes are available in total but only up to 4 pipes are
available per display (single mixer) for MDP Composition.

CRs-Fixed: 450985

Change-Id: I99df91ab955a1a7110dfbea2aaf790ba26058a78

display: Close 0 fds

0 can be a valid file descriptor, make sure 0 fds are closed

Change-Id: I2bf2280d70eda74fa0b0a886ea54ecefc6854b24

display: Do not align down input rotator src height

Aligning down the input rotator source height value introduces
green line in the output of the rotator. Remove aligning down the
input rotator source height for YV12 format.
For 1/8th downscale use aligndown instead of alignup.

Change-Id: I9152ee873c5ee79877653c78f33eb0cf7e2f9871
CRs-Fixed: 453033

overlay: Fix rotator output buffer size.

Fix rotator output buffer size for mdp and mdss rotators.
Output size is based on rotated width & height.
Output format can be different than source format.
It could be same if using mdss rot or using fastyuv mode in mdp rot.
Deprecate the static mapping of rotator input and output formats.
Driver will be responsible for correctly populating the dest format that its
wishes to use.

Change-Id: I17352d6d460cac24eb97083aed38668929c66807

overlay: Add support for pipe dumps.

Add support for pipe state dump useful in dumpsys.
Reduce debug log spam when mdp state changes.

Change-Id: Ie27ad00698085e2ffd6166ad2f7503fe16a571f8