libgralloc: Set alpha mode for MDP base pipe.

This change configures default alpha mode for MDP base pipe
during intialization.

Change-Id: Ibbc7185c4c57979584a5ce66bd4eef8e521165b5
hwc: Support 4kx2k FB for Primary and External.

Add support for 4kx2k FB for primary and external panels.
Change class design to create appropriate version of FBUpdate on boot up based
on the panel resolution.

Change-Id: I216d815d9b81c610aa39e351f7b55736dfa48b43
Revert "display: Don't use MDP flip if prerotation is disabled"

This reverts commit c3e5de44622422ddce691e069de260793a06cd19.
hwc: mdpcomp: Restructure for 4kx2k displays

Restructure MDPComp class for 4kx2k displays.
Cleanup MDPComp class to remove unused stuff and formatting.
Add a MDPCompLowRes class for current functionality.
Add a hollow MDPCompHighRes class for future.

Change-Id: I343540e712d31ca907257a73b49567578f49d5f7
hwc: Delay HDMI/WFD connection request by one frame

  This change introduces hdmi pending state, where we allow
  frames to fall back to FB, closing all MDP pipes.

  Pipes could be used by primary (mixer 0) in which case moving
  them to external (mixer 1) involves unsetting them and setting
  them in the same round which is not recommended by the driver.
  It will fall back to GPU till HDMI is configured on a connect
  event.

  CRs-Fixed: 430057

Change-Id: I4b6677883c499f6d15656c3578190be1115ee6b4
libexternal: Add support for changing resolution on HDMI

- set the property hdmi.resolution with the required mode
  (16,4,3,32,34,1)
- If that resolution is not supported by the TV, it will fall
  back to the best mode supported by the TV

Change-Id: I90ceda02319e79e388035ba7b5926bdcf6625595
CRs-fixed: 430055
hwc: commit changes for ext display on blank

- When the device is suspended, the overlay pipes will be unset,
  but they wont be unstaged as there is no DISPLAY_COMMIT ioctl
  called for ext display, as a result the fence wont be signalled
  by the MDP.
- This is needed as we dont turn off the External display(HDMI)

Change-Id: I9794ad2ae7c9d7b4ce3f9787f50ea9da87966e41
CRs-fixed: 425483
display: Return MDP pipe availability per display type

Pipes allocated for one display type cannot be used by other
display types without calling UNSET on them. So clients should
check for pipe availablity only for a specific display type.

Change-Id: Id2244e4976b4cc1f040ada7e56686742d5a65141

CRs-Fixed: 433870
libgralloc: Set alpha mode only if kernel allows.

The alpha mode is not in the latest QCOM HAL, so we will provide a
workaround for devices that need it, and still keep devices without
this working.

Change-Id: I0bf99cda698d9c78f0af7b8578a3fed21a9379a5
hwcomposer: 7x30: disable overlays for video playback

check MDP revision and disable overlays for video playback usecase
on 7x30.

Change-Id: I8b179512b4aff136834dd80e4da7227a6b2aff4e
liboverlay: Use camera heap for targets without mm heap.

for 7x30 MM heap is not available. Use camera heap instead.

CRs-fixed: 407303
Change-Id: Ie94937fb59c40b49d7f5bb30d12b4ddea497a6fc
hwcomposer: Use RGB_BORDERFILL only on MDP 4.2 and higher.

MDP 4.0 does not support RGB_BORDERFILL and causes the display to fail
initializing.

Patch Set 2: Actually set MDP_RGB format if not BORDERFILL.

Change-Id: Ib2007221c4dc78fd17ced97c0a0d28896c877b80
libcopybit: Merge copybit HAL from jb

Single commit having all the following commits

commit f39e512ad6f51cf35ab00995e52a39f31e76e77f
Author: Naomi Luis <nluis@codeaurora.org>
Date:   Fri Oct 19 14:41:32 2012 -0700

    copybit_c2d: Use a single draw call for surfaces with different rotations

    - When opening the copybit module, query the c2d driver capabilities.
    - If supported, use a single draw call for blitting surfaces with different
    orientations using the target target rotate override flag.
    - If not supported, invoke finish_copybit to draw the layers with the
    previous orientation before applying the current orientation.

    Change-Id: I0446f2817786321c9caa2eabf7b6679e5ecbcabe

commit a4008ff75150c1591c0dca46354e6bb8b30a675b
Author: Naomi Luis <nluis@codeaurora.org>
Date:   Thu Oct 18 15:26:15 2012 -0700

    Display: Add copybit_c2d performance optimizations

    Following performance optimizations have been made to copybit_c2d
    - Club all the layers into a single draw call. When finish_copybit
    is invoked, the draw and finish are executed.
    - Send the layer blend mode to copybit.
    - If the blend is set to none, set the pre-multiplied alpha flag.
    SurfaceFlinger assumes all surfaces have pre-multiplied alpha unless
    explicitly specified. Copybit_c2d does the same.

    The following cases are currently exempt from this optimization:
    - Change in C2D target
    - The template surfaces limit has been reached
    - Max. blit object limit has been reached.
    - Change in target transform.
    - Use of any temporary source/destination surfaces.

    Change-Id: I5ad1dc48bbe6d38d319116ccaa800fefb4fbf9f6

commit b188d739f69272c4820e1a33c5e10aa2f2825a5f
Author: Naomi Luis <nluis@codeaurora.org>
Date:   Mon Oct 15 11:17:11 2012 -0700

    copybit: Add finish API

    Add the finish API to copybit. This API is used to indicate the
    end of the drawing required by the copybit client.

    Change-Id: Ica4d13dbe6e7aeb7f88aabb734bf03e86c043acc

commit ecd56ace395fce78c14e2e753d3221218d062899
Author: Naomi Luis <nluis@codeaurora.org>
Date:   Mon Oct 15 11:21:08 2012 -0700

    copybit: Clean up copybit_c2d

    - Remove unused functions
    - Do nothing for the COPYBIT_BLIT_TO_FRAMEBUFFER case when using c2d
    composition.

    Change-Id: Idc416ce3742bb41f060e52ac70add44e584032b9

commit 35d45d0cff5f6fe866fcb5df71444824a45e046e
Author: Naomi Luis <nluis@codeaurora.org>
Date:   Wed Oct 17 10:37:33 2012 -0700

    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.

    Change-Id: I9fedca0186d0ea19883b967e127417b059621a99

commit 31311da328cbe2229fcf8d8d8e276ec64005bcb3
Author: Ramakant Singh <ramaka@codeaurora.org>
Date:   Thu Sep 20 15:58:29 2012 +0530

    HWC: use uncached buffer for tmp yv12 and tmp stretch buffer.

    Change-Id: Iecc2a9c3c9a365d00d3491ce1007a36484209346
    CRs-fixed: 396574

commit 5503c90b5001aa4d863139eebcd9c0c43f265702
Author: Pawan Kumar <pavaku@codeaurora.org>
Date:   Mon Sep 3 09:14:13 2012 +0530

    copybit: Fix crash when copy_image is called with Tile format

    Add check for copy_image failure case.
    CRs-Fixed: 393122

    Change-Id: I5765120e87a135795d771c5d331275a66ade7e23

commit 48975bc53702ecba66ecaa5e5769036bb91f5cf2
Merge: feb1cd6 ab25cb4
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Sat Sep 1 13:36:47 2012 -0700

    Merge "Display ::Use proper ion heap id" into jb

commit ab25cb4818d9b87886678972f2861bacc93c580a
Author: Ramakant Singh <ramaka@codeaurora.org>
Date:   Thu Aug 9 14:23:39 2012 +0530

    Display ::Use proper ion heap id

    Change the MM heap to CAMERA heap for 7627a in use case
    1.Intermediate stretch of low resolution clips
    2.Software conversion of Y12 format

    Change-Id: Ib705d3245f601256179e2dedccbc707df85eb431
    CRs-Fixed: 383115

commit 90bcaadf41451d89fe80f96961ffc0a07a333145
Author: Prabhanjan Kandula <pkandula@codeaurora.org>
Date:   Mon Aug 6 12:50:12 2012 +0530

    libcopybit: fix YUV buffer alignments as per gralloc

    buffer alignment in copybit should be in sync with
    gralloc allignments while allocating buffer.

    CRs-fixed: 377051
    Change-Id: Ib2ae64e368ea3c92d3494c71da605197ccb4a9a5

    Conflicts:

        libcopybit/copybit_c2d.cpp

commit 95cf0038ea6eb02314024d673418464f0739ddb4
Author: Sravan Kumar D.V.N <sravank1@codeaurora.org>
Date:   Thu Aug 2 14:37:37 2012 +0530

    copybit : Add support for NV12_ENCODABLE format

    Change-Id: I7087dcad2238a3c35cc15c28d75b76a9e3ca6718

Change-Id: I748bffb4215d27f609beec209af0a5047858a314
hwc: Add support for copybit(C2D) composition

- Add CopybitEngine to hwc_context
- draw the layer on the HWC_FRAMEBUFFER_TARGET using
  copybit(c2d) if it qualifies for C2D composition.
- use fence returned from the copybit during c2d
  composition

Change-Id: I052da015cd031f7abd6411d83d7944c335caeff7
hwc: Invoke commit ioctl even if there are no app layers

  Android has scenarios where it calls HWC::prepare and HWC::set
  without any application layers. In such cases, for power
  optimization, user space avoids  calling PLAY
  (on FB - since there is no new content drawn) and COMMIT ioctls.
  But we might have called UNSET on mdp pipes used for the previous
  frame. As per the current MDP design, these freed pipes will not
  be unstaged unless atleast a COMMIT ioctl is called on that mixer.

Change-Id: I7f7574b2e589e80c4926533066e35784bb29b4a5
CRs-Fixed: 437736
libcopybit: Add Async mode support for C2D

- flush_get_fence API to copybit.h - which is async,
  which returns the fenceFD
- flush_get_fence calls C2dflush and c2dCreateFenceFD
  signals the c2d_wait_thread which waits for
  transcation to finish and cleanup resources

Change-Id: I98d5e08ea1cbce9732970c68c1e47b6f396249ce
liboverlay: Rotator-assisted MDP downscaling of videos.

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

Change-Id: Icfabc2c0f978a23cf96c78a9976cf69cea697b5f
CRs-Fixed: 434852
libgralloc: Use ION_IOC_CUSTOM instead of MSM-specific ioctls

Use ION_IOC_CUSTOM instead of ION_IOC_CLEAN_INV_CACHES.
ION_IOC_CLEAN_INV_CACHES is now specified as a command argument of the
ION_IOC_CUSTOM ioctl.

Change-Id: I5b59ba1032364dfb884a90abf2ee2b35f3c09dd6

libgralloc: Change ion_allocation_data fields.

Change ioc_allocation_data structure fields as per changes in kernel.
The 'heap_mask' feild will hold what the older flags field held.
The 'flags' field will hold the caching information.

Change-Id: Id3b2e8a4d1ba370e0f982860fdb32b56227e2e43

gralloc: set ION_SECURE to flags instead of heap_mask during
ion alloc.

  This is required for Secure Playback usecase.

Change-Id: I590bf126a35465286a9487490a114af82732e262
gralloc: Support for old and new ION API

 * Enable old API with BOARD_HAVE_OLD_ION_API.

Change-Id: I037ebfeb53e9ed2eddee4d0c709559a07baf3694
libcopybit: Use CM standard QCOM naming.

Change-Id: Ide4c8d36743fc23f2711e010a8f031f1bb0b7c6f