libhwcomposer: Set bypass transition flag before invalidate()

Set flag to ensure HWComposer::invalidate() does not draw with
bypass still enabled. Also, log comp bypass transition due to
idle-timeout.

Change-Id: I3343d092a92c9677d0b9d50ced094c96d229474a
(cherry picked from commit f27aebd66249d165c0a3342abf4064a5dc350a6d)
qcom/display: add perform function to fb/hwc HALS

- Add perform function to framebuffer and HWComposer HALS
- This will be used communicate custom events(external display,
  video overlay, orientation, etc.,) to HALS
- remove setActionsafe API(not used)

CRs-Fixed: 341947
(cherry picked from commit 31999628ddd4a6c0996e22e9fbf1f311d6efb160)

Change-Id: I221f2ab49770e8db7602bb1881ef9972567b7780
libgralloc: Add API's to synchronize framebuffer update.

This change introduces API's in gralloc to allow clients
to synchronize with framebuffer posts.

CRs-fixed: 348953

(cherry picked from commit f81de75b1adb78018c0bd54b7f27901ba467defd)

Conflicts:

	libgralloc/framebuffer.cpp
	libqcomui/qcom_ui.h

Change-Id: I98b6a2b3243f520138cb5d1c76493cdfa3af60b6
libhwcomposer: Wait for framebuffer post complete before releasing composition buffers on bypass failure.

When bypass fails, MDP keeps reading the last submitted buffers until
the next VSYNC i.e., until PAN_DISPLAY is called on framebuffer. So
the previous buffers can be released only after PAN_DISPLAY IOCTL
call returns.

CRs-fixed: 348953

(cherry picked from commit c3a7ed7db39609e8f4d7ce0d6a56e82303ddb7f1)

Conflicts:

	libhwcomposer/hwcomposer.cpp

Change-Id: I5fb5a9eb275006a3158a111aad1eafac79973095
display: Fix Overlay state transitions

Trigger overlay state change for S3D format changes.

Close both overlay channels only when transition to/from 3D display
happen.

The closeChannel resets the Overlay state variables. Any changes to
the state variables prior to closechannel are lost. Update state
variables after calling closeChannel.

Remove unused variables.

Change-Id: Ia5aa84d02df1e1874df93530cf3e55298ebc81e3
CRs-fixed: 342350 342987 347382 350326
(cherry picked from commit 6706fd708dace780751a4602d6125e089851789f)
Reset to initial state when Overlay startChannel() fails.

When Overlay startChannel fails due to some reason and overlay
channel is not yet up, state needs to be reset to initial value.

Change-Id: Iabc765f350bf999d8362f86a43b900ff7aed1bb3
CRs-Fixed: 354403
Implement single vsync for YUV + RGB content

-- For UI updates, mark the MDP pipe for single layer YUV to be NO_WAIT.
-- Remove premature unlocking of buffers, except error cases.
-- Unlock buffers only after a single Vsync (PAN or PLAY) and after pipe UNSET.

This ensures smooth transition from MDP to GPU and prevents tearing.

Change-Id: Icfcb770dae12d4a7e0ff96d04149b2eaf0c07121
CRs-fixed: 359140
hwcomposer: Add workaround for cropped layers during bypass

 * Some hardware cannot handle cropping during bypass, or reports
   invalid rects during orientation change. If the invalid rect is
   cropped, MDP gets into a weird broken state where layers turn
   transparent, display blinks, etc.
 * Also use the VG pipe for 2 layers instead of just 1 in this case, it
   eliminates flicker when unlocking the device.

Change-Id: Ia5cb1a368bcc8949ba224a8510f577450449f22e
gralloc: Remove ifdef around assignment of perform

 * Perform is used for more than HDMI, and without this set on devices
   that don't have HDMI enabled, crashes result.

Change-Id: I9029892a12ab09ffb66b3560f796ffb99ea57460
gralloc: Allow SF to use IOMMU heap

(cherry picked from commit 9ff9a8df77ce6887b6d45fdb7dc7400690d408c5)

Change-Id: Ia079f4c68b88201f638cfc2b4618de381d246e49
Avoid 3D video layer for GPU composition

libhwcomposer: Donot mark the 3D layer below HWC_SKIP_LAYER
for GPU composition. In these cases, let the layer be
composed through composition type decided in hwc_prepare.
This helps us in avoiding the cases where 3D videos
cannot be composed through GPU.

CRs-Fixed: 346973

(cherry picked from commit 0331f07ed4b5a3cf5a2e358c8417ac9e8103bc07)

Change-Id: I9f6c53cc2da35109fe789074a9d1accc11372dd8
liboverlay: free rotator memory in a new function

- move freeing roator memory to a new function
- In queueBuffer, updateDataChannel, if memory allocation
  fails for the rotator, free the previous allocated memory

CRs-fixed: 353156

(cherry picked from commit 97de5b6dc39a8706ba90f4e8b191b18418cb0191)

Change-Id: Icc774b67678426ea7ba43520b1186ea148ce1281
gralloc: Reduce log severity for invalid handles

The calling function logs the appropriate error

Change-Id: I41f446b1495e23995aff4778f1c1a488d83537fb
CRs-fixed: 361831
(cherry picked from commit 81fd358ee8b70946b306417064d104fa3341d6fa)
Revert "Revert "libgenlock: add support for genlock_write_to_read locking semantics""

This reverts commit b419ca44a137f8f5bc9b80412c7a6459583addab.
Fix incorrect video overlay status update.

Status should be set to PREPARE_TO_CLOSE only if its OPEN.
Devices which rely on the status being CLOSED, if overlay
is unavailable, can crash.

(cherry picked from commit a6ee9945dedde6f2d119f0bdd8724fed20781f0e)

Conflicts:

	libhwcomposer/badger/hwcomposer.cpp

Change-Id: Iddf0ba1cc142e02fcf906d3b31f8f44a65def316
liboverlay: Add flag for mdp composition

MDP needs this flag to be specified to turn on pixel
repeat to do upscaling in VG pipes

CRs-Fixed: 353408,351504

(cherry picked from commit 12387460f4294611504071ad15d38923855c5a96)

Change-Id: I74788d7d5b792bd0f3988d7f7b763928f755537a
hardware/qcom/display: Fixes corrupted display when using whith zero dirtyregion

An empty dirty region, which initiates tile rendering (non-preserved with full viewport)
but with no updates from the view hierarchy leading to uninitialized content on the screen

CR's Fixed:357662
(cherry picked from commit 66ceabd31fcd49c344b468a138438fe3d226f515)

Change-Id: Ieaa357ee2951aa8286ab1fe0f96b3d99bc424a3b
libcopybit: Add support for Yamato format in MDP userspace.

Video decoder and MDP support Yamato(YCbCr_420_SP_ADRENO).
Add support from userspace to use it.

(cherry picked from commit 53578e5bddf86628ffa9814fe036de62e06584cc)

Change-Id: If068952b92c098529c3a144a3e6360f534979c36
gralloc: stop the log spam

Change-Id: Ib433aefd0725198d0c7dd210b9f10de38f4f4aa2
Merge "gralloc: stop the log spam" into ics