liboverlay: Rotator-assisted video downscale.

Engage the rotator to assist MDP in performing video downscale. This
saves bandwidth and avoids causing the driver to make too many panel
mode switches between BLT (writeback) and non-BLT (direct) modes.

This optimization can be enabled using ROT_DOWNSCALE_ENABLED flag.

Change-Id: Ic0779402dcb1e3617f868724c44e62887a0434f1
libhwcomposer: Enable rotator downscale for pip.

Enable rotator downscale for pip window.

Change-Id: Ia06b8dd4042084a67a007a055c6fb32c201d23a4
liboverlay: ROT_DOWNSCALE is not supported in all MDP versions.

Change-Id: I4f235964b2247b5136c640165f1ad3e555731f8c
CRs-Fixed: 411509
liboverlay: ensure open fd's are always closed

Ensures that reset and  mFd.Close is always called when MdpCtrl
and MdpData are closed down.

CRs-fixed: 397498
Change-Id: I775ba7cfe45c67e6acf874e3f4e8b4fa6fbe33b8
display: fix display for msm7x30

implement ANCIENT_GL ifdef to revert commit 2d69977f816031dacbf4378b2e54a3b6c4209d9a witout breaking other devices

Change-Id: I6aad90a7abae75cd780e4532eb53882ddd5fd0d3
liboverlay: close all the opened pipes after framework reboot.

Add initOverlay() function to close all the opened pipes when
Surfaceflinger process gets killed.

Change-Id: I9c65a61c81f9c81198f1076d6cbd27933b164c05
CRs-Fixed: 412954
(cherry picked from commit c20f1810dd07c9097ba4c066ec86a677399ae47f)
Change makefiles for qcom legacy

Change-Id: I0e70a52ce020ba107b5cb0f19746100c6766e76d

Conflicts:

	Android.mk
hwc: Fix reserved field usage

Use the top 16 bits of reserved[3] for HDMI
and the bottom 16 for FPS. A follow up patch
in the MDP driver will get rid of reserved field
usage entirely.

Change-Id: Ic9f7a2f91b46b0dec830ea54784b7775009fbe48
fb: Remove extra PUT_VSCREENINFO call.

Remove the extra PUT call during system startup.

Change-Id: I29287af2ee5610e749ac481c2832f41d7381ca59
hwcomposer: fixes for hwc c2d composition

- c2d composition has to be used even the when renderArea equal
  to twice the fbArea.  This change enables this.
- set the default dynThresHold as 2

(cherry picked from commit 70e85f1d2e115203075a7bd715e7c0f763f41536)

Change-Id: I0c1e0dbc35f07a55a550e812a1ad1084168a1de1
CRs-Fixed: 396227
display/libhwcomposer: Fix memory leak in MDP Comp.

This changes fixes a memory leak by freeing up pipe alloc
structure everytime before parsing the current frame.

Change-Id: I23edefca71ec0209291be24ee9d629b4a80f0a25
display: Add support for 180 flip operation

This changes adds support for 180 degree flip operation during
MDP composition. This enables frames to get MDP composited during
270 degree orientation too (with pre rotation doing 90 degree
rotation)

Change-Id: I225088e0eed083f145a0166b06aac3d0e4355505
overlay: Consider both directions for downscaling

Since downscale in rotator is applied to both width and height, the downscaling
decision should be made based on the area rather than just the width or height.

Change-Id: Ib1c7eccc6c430a401b6d8abb1d9bb0927d05869c
copybit: Use correct alignment in get_size()

get_size() is used to get the size required by c2d. It's alignment
should be 32 and not 16.

(cherry picked from commit 35d45d0cff5f6fe866fcb5df71444824a45e046e)

Change-Id: Iace771104ce8cea8b1672d15b2d46b6de9283868
libcopybit: draw full layer if dirty region list is long

1. Since blitting region by region by copybit is serial, if a layer has
long list of dirty regions, drawing full layer is optimal. Make blit
region same as display frame of layer.
2. Fix alpha for HWC_BLENDING_NONE layers

(cherry picked from commit 57f0723baf97d0f6499458d6764d1416baa18b4f)

Change-Id: Ib08a292e4845259cfb313ca07db34da9f9200dec
Revert "hardware/qcom/display: Remove glfinish call"

This reverts commit 95bc6a5c6dd76a432baaa6554abd0f4f7ca481f1.

Without glFinish(), in few corner cases; application is trying to
lock the buffer for write, while the read lock is still held.

CRs-Fixed: 430212

Change-Id: I9e3a22ca3496ef42e8dce5d565bcfe79fd427a4d
libgralloc : Correct the usage of pmem ioctl

Return error only if the ioctl PMEM_ALLOCATE_ALIGNED
returns negative value.

CRs-Fixed: 375513

(cherry picked from commit b1caf041824cedc268ced33e47a166070ec84f29)

Change-Id: Ie5e926648ff845dc04ce06e5c57e27dd214d1b45
hwcomposer : Synchronize EventThread, and hwcVsyncThread - fix mismerge

Synchronization is needed,to make sure, read() is not called
by hwcVsyncThread when VSYNC is disabled.

Otherwise in usecases, where display is OFF, and still some
tasks keep running in the background; SurfaceFlinger keeps
using CPU.

Change-Id: Ic59d0c477bc8483dd731777ebde3cc9e12bb681a
CRs-Fixed: 393243