Merge branches 'rukin5197' and 'jellybean' into jellybean
copybit: Fix crash when copy_image is called with Tile format

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

Change-Id: I5765120e87a135795d771c5d331275a66ade7e23
display: Add support for video rotation on Ext display

- sourceTransform in the hwc_layer_t has the source buffer transform,
  use this transform for external display.
- This helps in showing videos with source orientation properly on the
  external display

CRs-fixed: 387357
Change-Id: I2ac7e5481a27b93d10ba3fc1ad2e4a8788dc20a5
(cherry picked from commit a51a41188d34db49528edadadbf9ddbc052e772d)
hwc: video: Create crop and position structs only once.

Create crop and position structs only once.
Fix bug where x and y were not updated.

Change-Id: I7c6a873ba207997baa302b8999bdaf34cc938dba
hwc/overlay: Add premultiplied alpha support.

Add premultiplied alpha support to video and mdp comp features.

Change-Id: Ieddaf82d5cc43c455bd1c10dbc82b0fc016903ea
Overlay: Change MDP format for YV12 buffers

   Android uses different alignments for YV12 buffers.
   Hence, introduce a new format (MDP_Y_CR_CB_GH2V2) for
   such buffers.

Change-Id: Id4d58dd77f22c9efb8ece9caa34a8717964bf58d
hwc: wait for fb_post, PAN only if target has overlay.

Wait for fb_post, PAN only if target has overlay.

(cherry picked from commit c6e9a0aae817e75b4b5e20ef23edd02a0a627ccd)

Change-Id: I9696c122b3ce5abed2ae2adb9e5929d3664b3add
libgralloc: Fix possible leak of fd

Fix possible leak of fd in ion allocation.
If mmap fails close the fd before returning.

Change-Id: Id414792c14a75259f6075b0d76bc470c31fb5853
CRs-fixed: 387633
libhwcomposer: Reset layer list before clearing MDP states.

This change resets layers flags and composition types
before clearing MDP states.

Change-Id: I03ec173df7dec67348942f307079b506649f592b
hwcomposer: keep secure content in an overlay when below skip layer

Secure content can not be displayed unless in an overlay.  Since
getLayerStats marks all layers under the skip layer for framebuffer
composition, when there is a skip layer on top of protected content,
the protected content disappears since surfaceflinger doesn't draw
protected layers.

Change-Id: I59dd5dffad08dbf578baa459f5f4c726b6674c83
libhwcomposer: Close MDP PIPES in hwc_prepare.

Since MDP is doing a deferred close on pipes after PAN DISPLAY
HWC can close the pipes in prepare

Change-Id: Ia451e3b2e388d1b2199a14e31c3991d5d1b057c8
hwc: Close overlay when HWC disabled

 * SF will disable HWC before showing the electron beam animation. Close
   the overlay so that the GPU can be used.

Change-Id: I25bb3ed5cd9a5d80a590af4f94f2d0b903e98352
gralloc: stop the log spam

Change-Id: Ib433aefd0725198d0c7dd210b9f10de38f4f4aa2

Conflicts:

	libgralloc/ashmemalloc.cpp
	libgralloc/ionalloc.cpp
	libgralloc/pmemalloc.cpp
liboverlay: Make sure the crop rectangles' dimensions are even

Even out the values for both dimensions and position on both src
and destination rects.
This fixes both over and underrun issues, especially with HD panels

Change-Id: I781792d69cad83f76c3c0a45a5179a731661c3cf
hwcomposer: Remove vsync event control for WFD External Display

Change-Id: Ic0ffcfb035a8d0037d6394cb4b77888390eb7608
libgralloc: Set alpha mode for MDP base pipe.

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

Change-Id: Ibbc7185c4c57979584a5ce66bd4eef8e521165b5
gralloc: Don't use FB metadata on gimpy targets

 * If a device doesn't support VSYNC, it probably doesn't support FB
   metadata ioctl. Add an ifdef around it.

Change-Id: I1bf788147129f7b9d584e22b914f1c59d2ee133b
Merge "gralloc: stop the log spam" into jellybean
libgralloc: Add RGB_888 format as BUFFER_TYPE_VIDEO

GPU cannothandle RGB 888 format hence mark it is video.
This is required for MPQ.

Change-Id: I52b0e8c20af00a901ce3fc07cfb56d862f00caa9
display: Add support for video rotation on Ext display

- sourceTransform in the hwc_layer_t has the source buffer transform,
  use this transform for external display.
- This helps in showing videos with source orientation properly on the
  external display
- Remove unsed flag FINAL_TRANSFORM_MASK

CRs-fixed: 387357
Change-Id: I2ac7e5481a27b93d10ba3fc1ad2e4a8788dc20a5