display-caf: sync with CyanogenMod cm-10.2 branch

Squashed commit of the following:

commit 64a7ace7b5daadd27b275fd29d94848eafc5aab3
Merge: 2f255dc cd39f8f
Author: Steve Kondik <shade@chemlab.org>
Date:   Wed Aug 7 13:24:27 2013 -0700

    Merge branch 'jb_2.6' of git://codeaurora.org/platform/hardware/qcom/display into cm-10.2

commit 2f255dc1baaba643f92255b2f9656eb40e4a0bec
Author: Steve Kondik <shade@chemlab.org>
Date:   Wed Aug 7 13:22:34 2013 -0700

    hwc: Add conditional for use of retire fence

     * This patch is only in AOSP, and requires specific support in the
       kernel. Add a conditional for devices that want to use it.

    Change-Id: I7e0b7ee0ea2f58b82db1adc28c6cdd9eb4db2156

commit 9400d0a15425473405f2c13b35963b4ba7ee873f
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Tue Jun 25 17:17:04 2013 -0400

    hwc: Get the retire fence from the MDP driver

    Get the retire fence separately instead of duplicating the
    release fence.

    Bug: 9319776
    Change-Id: Iacb773c2d94f635e27a7b355d399cb2e36dac2a5
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit dcb1eecb4f333a89e480a391cf5d2e84addb3c08
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Thu Jul 18 12:48:22 2013 -0400

    hwc: Resend the command after broken pipe is fixed

    Bug: 9850103

    Change-Id: Ia2ee8019394ce1397fe7eaf73a44a00b0b78e88c
    Acked-by: Ping Li <pingli@codeaurora.org>

commit fb535d750601bf4e3c970df690e038d1e3fde03b
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Wed Jul 17 00:49:51 2013 -0400

    hwc: Handle the broken pipe issue between hwc and ppdaemon

    If broken pipe is detected, close and then re-establish the connection
    between hwc and ppdaemon.
    Acked-by: Ping Li <pingli@codeaurora.org>

    Bug: 9850103
    Change-Id: I68ff21b93ab5b40608ca9ab4951adaa9d75fa17e
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit cd018383d857ce08798e8fb10a1be1fff42c652a
Author: naseer <naseer@codeaurora.org>
Date:   Thu Jun 27 19:44:12 2013 -0400

    hwc: Don't run CABL when HDMI is connected

    There is no power benefit with CABL when HDMI is on.

    Bug: 9605980
    Change-Id: I57b3af493e0af54db520fea04dc3a2d007943b82
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit 79be32dd122a10e64dfbb4d5c3dce7bde2b5e2ff
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Mon Jul 8 15:25:41 2013 -0400

    hwc: Set a timeout when communicating with CABL

    Bug: 9669813
    Acked-by: Ping Li <pingli@codeaurora.org>
    Change-Id: If0f65e9ee100b368e46f8f6d4edf9d7a93120bed
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit e9ca3163ae23176c99442dad671b9f1527c86b84
Author: naseer <naseer@codeaurora.org>
Date:   Tue Jul 2 17:39:04 2013 -0400

    hwc: Don't kill ppd when HDMI is on and primary also has video

    There is still a power impact when video is playing on primary
    with HDMI connected.

    Bug: 9680403
    Change-Id: Ia12710194ea6ebc677c7a86731a409333853ccfc
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit be43e0c2f1d244b3ef0573c051802a49c7fcdd30
Author: naseer <naseer@codeaurora.org>
Date:   Thu Jun 27 19:44:12 2013 -0400

    hwc: Don't run CABL when HDMI is connected

    There is no power benefit with CABL when HDMI is on.

    Bug: 9605980
    Change-Id: I57b3af493e0af54db520fea04dc3a2d007943b82
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit d6b82fb9ffc1507f8fe7a4fbf4b18f878d704ef2
Author: naseer <naseer@codeaurora.org>
Date:   Thu Jun 27 18:11:05 2013 -0400

    hwc: Ignore SIGPIPE error when communicating with ppd

    This avoids a potential crash in HWC if a SIGPIPE is thrown due
    to failure communicating with the other end.

    Bug: 9414907
    Change-Id: I7f1de4f2ff0f287de4cad29dd92a6e964ba50224
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit 129b70c91c1b7251182950f5e3f6ad4016ed4768
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Tue Jun 18 21:37:41 2013 -0400

    hwc: Add support to enable CABL for video use case only

    Set property "persist.qcom.cabl.video_only" to 1 to enable this
    feature. With this feature, CABL will be turned on only during video
    play cases. CABL will turn off for UI cases.

    Bug: 9414907
    Acked-by: Ping Li <quicpingli@codeaurora.org>
    Change-Id: I7dee9e03685bdf8e5f69ad5004e63f15dd028333
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit 1419022d7bea225b240a65300c69ec8d97e47dc4
Author: Dave Burke <daveburke@google.com>
Date:   Mon Jun 3 00:21:43 2013 -0700

    Add support for white LEDs

    Bug: 9079860
    Change-Id: Icc981682a274546c1414bd7c0b0045b1293575bf

commit b80f3c0d89b74d4ece715ab6ad295959a1189dcb
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Tue May 28 16:37:23 2013 -0400

    display: Remove libmm-abl dependency

    This lib no longer needs to be linked to any component in the
    display HAL.

    Change-Id: Id332d3cb22fc35e16f655d4c6127d6f1891330b0

commit cd39f8f93aac9f86cf97ed4ed1544611879b38c4
Merge: 1edd6be c86b277
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Aug 1 16:02:14 2013 -0700

    Merge "hwc: Configure framebuffer before other layers."

commit 1edd6bec88031824de1aa48e60ae667a23dc3d59
Merge: 8c996b6 7930f02
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Aug 1 16:02:10 2013 -0700

    Merge "hwc: Fix locking in external connect and composition."

commit 8c996b64c03588ae42795756d58b972739ea1853
Merge: cc5b985 0c280a7
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Aug 1 16:02:09 2013 -0700

    Merge "hwc: wfd: Call commit even if in pause"

commit dafe3ca10ae271bf6c38c9a71a9dc424bfa4ab02
Merge: db2fb0e 942199d
Author: Ricardo Cerqueira <cyanogenmod@cerqueira.org>
Date:   Thu Aug 1 19:34:52 2013 +0000

    Merge "gralloc: Add workaround for Jellybean camera drivers" into cm-10.2

commit cc5b985570ac706b14f7245e3b4e95af4565bda8
Merge: 5714cba ac44ed6
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 04:41:09 2013 -0700

    Merge "gralloc: Do not map framebuffer memory unless needed"

commit 5714cbaf7e991796464497ed7c0b64eccbb1df95
Merge: 7d98f12 9b800d4
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 04:41:08 2013 -0700

    Merge "gralloc: Fixes for software composition"

commit 7d98f12247d15ba7dc97ac2815cac5df279e0360
Merge: 1b07dee 2661a7e
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 04:41:07 2013 -0700

    Merge "hwcomposer: Fix a deadlock with debug enabled."

commit 1b07deed5bceb9761ecbf0a2d66352623b590b54
Merge: 69fd5fe 469bf59
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 04:41:07 2013 -0700

    Merge "hwcomposer: Add adb property to disable Mixed Mode"

commit db2fb0e01b1f91af53cb8722033650a73c5920bc
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Tue Jul 9 16:36:28 2013 -0400

    hwc: Don't lock eventControl for vsync events

    Locking here can lead to a delay in vsync disable/enable
    where prepare/set is not yet completed. The HWC spec says
    that eventControl needs to take effect immediately.
    This lock was earlier present when we waited for
    SF to unblank primary at startup and the vsync control
    ioctls could fail. This is no longer necessary as we unblank
    primary on startup now.

    Bug: 9669813
    Change-Id: I2bf18ae9235f8dd428a495a9a23af7f00f34ff1d
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit 3eccc0dcd1aaa0c2fb1bbfce1986d55420e0cc39
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Wed Jun 19 19:43:34 2013 -0400

    hwc: Punt video layers with plane alpha

    This fixes a transition issue when exiting youtube while the
    video is playing.

    Bug: 9486278
    Change-Id: I0259b2dc9ccbf302b13d8ae40e62765820d94860
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit fab44a83c9791b1ab3c265a91aff41f3a1747cc4
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Fri Jun 7 12:46:19 2013 -0400

    hwc: Add support for smooth streaming feature.

    Update the source video width and height set by the video decoder
    for the secure video smooth streaming usecase from the gralloc
    metadata.

    Change-Id: I73a3804d90557034604142481a232787dbc08f23
    Acked-by: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>
    Signed-off-by: Lajos Molnar <lajos@google.com>
    Bug: 9533458

commit 98806281a3d8172d8cfaba762a62a8d0313b30c3
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Fri Jun 7 19:47:21 2013 -0400

    overlay: Add tolerance to downscale factor

    In certain corner cases for 1080p panels, round doesn't get us
    the right downscale factor resulting in MDP attempting to go into
    blt mode. Add a tolerance for failure.

    Bug: 9322550
    Change-Id: I2be4715955d9e248fc63e408dc4a2cdf493152f6
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit af83024ee47cf70d4e40ba4b21df627668863d2e
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Mon Jun 10 15:04:26 2013 -0400

    hwc: Clear rotator map if overlay allocation fails

    This fixes the GPU fallback path in case overlay set fails.

    Bug: 9322550
    Change-Id: I515204f41169debd8428b4fc48be392ecdd9ff48
    Signed-off-by: Iliyan Malchev <malchev@google.com>

commit 69fd5fed74583dba66ecc538b2c9b63055f75fbb
Merge: 9b6a5dc fe21678
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 00:08:23 2013 -0700

    Merge "hwcomposer: Reset LayerRotMap if MDP configure fails"

commit 9b6a5dcf6be48456c2f845649033c35293184895
Merge: 87dd15e e940bab
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 00:08:22 2013 -0700

    Merge "hwcomposer: Fix a crash with MDP composition."

commit 87dd15e85387e1b802fa3fa91c99343b5edd97cd
Merge: 16d1dc4 0dd581c
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 00:08:21 2013 -0700

    Merge "libqdutils: Add synchronization to idle invalidator"

commit 16d1dc4e3452e3f94aa437e6b88c73af9a7b05f9
Merge: 3264ad5 8f26570
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Jul 30 00:08:18 2013 -0700

    Merge "hwc: Minor bug fixes"

commit c86b27706c234e0b77d706e0f8cbbeab231c4035
Author: Saurabh Shah <saurshah@codeaurora.org>
Date:   Mon Jul 22 16:33:23 2013 -0700

    hwc: Configure framebuffer before other layers.

    If framebuffer needs to be configured, configure it before all the
    other layers in mdp composition. This helps in cases where we are
    out of SMPs and framebuffer configuration fails owing to that.
    Framebuffer being the fallback path, should always get highest
    priority when reserving SMP blocks

    Change-Id: Ie7a6903d1b9fb98b308689c81522571449bf2e8e

commit 942199d68c2e29b50a76ab45bffce6697b46b377
Author: Steve Kondik <shade@chemlab.org>
Date:   Sat Apr 20 16:32:50 2013 -0700

    gralloc: Add workaround for Jellybean camera drivers

    * Arcee is smarter than I am, and discovered that we can simply swap
      two fields to ensure compatibility with Jellybean camera drivers
      having the metadata fields in the private_handle_t struct.
    * Enable this by defining QCOM_BSP_CAMERA_ABI_HACK.

    Change-Id: I2cd267dd5550404cf2e61d76fb805e780cd99d3c

commit 7930f02dbdd6a4fce3491d4994c18ade59adc23f
Author: Saurabh Shah <saurshah@codeaurora.org>
Date:   Thu Jul 18 10:33:22 2013 -0700

    hwc: Fix locking in external connect and composition.

    The external configuring flag should be set after holding locks.
    Before opening FB for HDMI/WFD, composition should give up any
    open external FB resources.

    Locks should be held by composition for the entire duration.

    Change-Id: I703f69f156c665bf422613567c00aae340f3ee12

commit 0c280a746165ee38b4a3cf2b18cc113768e6fcdc
Author: Saurabh Shah <saurshah@codeaurora.org>
Date:   Mon Jun 24 15:48:50 2013 -0700

    hwc: wfd: Call commit even if in pause

    We need to call commit on wfd even if in paused state so that pipes
    which are unset are actually unstaged from driver

    Change-Id: Id71de8b80c44a632989de154a2387380d8fa66f0

commit 8f265704d7e1274eb37fa7ae1a7d84c61afc16ba
Author: Raj kamal <rkamal@codeaurora.org>
Date:   Wed Jul 3 06:45:08 2013 +0530

    hwc: Minor bug fixes

    - Since SF doesnot send blank/unblank event to hwc for
    virtual display, handle them as part of primary
    - Close acquireFenceFd's of the layers before returning from hwc_set
    in case of display commit failure.
    - Change in getAspectRatioPosition function to handle portrait and
    landscape panels.

    Change-Id: I089c56f61352c21bf76ff2b0104f586d611c3013

commit ac44ed64bf7b5bdcd93d4f417b4f9032b1f2e78e
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Thu Jul 4 15:24:31 2013 -0400

    gralloc: Do not map framebuffer memory unless needed

    The SurfaceFlinger opens the framebuffer module even when it
    isn't necessary. It does this for some legacy hals.
    Due to this we unnecessarily mmap the fb memory in gralloc.
    Do not map this unless the property to use the framebuffer
    memory is set.

    We do further operations in fb_device_open based on the result of
    mapFrameBuffer. However, if mapFrameBuffer is never done, we
    could end up with a random crash when using the info values in
    fb_device_open. Defaulting to an error value avoids this.

    Change-Id: Ib4ebfdf9a63af0dabb53170342181bac0360baeb

    Change-Id: I1e51f814611a3f2eb73f36d75e14d8725ca98474

commit 9b800d45730914372b69e0665ca188934dd08211
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Fri Jun 14 17:06:46 2013 -0400

    gralloc: Fixes for software composition

    Check that the buffer is actually an ion buffer
    before calling clean. This is needed for the case
    where the physically contiguous framebuffer is mapped.
    That framebuffer memory is used for bringup.

    Change-Id: I2db84d4bfc3465d995f12e0860be3cafa0d4a81b

commit 2661a7eca09926008a3abcfcf36d8785f4cee70f
Author: Prabhanjan Kandula <pkandula@codeaurora.org>
Date:   Fri Jul 12 16:19:31 2013 +0530

    hwcomposer: Fix a deadlock with debug enabled.

    If debug property for MDP composition is enabled,
    we call dump function from composition thread.
    Make sure we are not holding the MDP composition
    lock before calling dump function as this also tries
    to acquire the same lock and causes a dead lock.

    Change-Id: I05e5fd58be096f1ab683d796cc1beb4972c2168f

commit 469bf59745164c821b9cce5b6728b63a9efec3e9
Author: Jeykumar Sankaran <jsanka@codeaurora.org>
Date:   Fri May 24 09:40:36 2013 -0700

    hwcomposer: Add adb property to disable Mixed Mode

    This change adds adb property support to disable mixed mode in
    MDP Comp. Will be helpful in debugging issues to narrow down the
    root cause.

    Change-Id: I49b737bb8755dc3a35db2e1ea8ccb2043135d2b0

commit fe2167834f8a957ab5aaba259a4be140a1980eb2
Author: Sravan Kumar D.V.N <sravank1@codeaurora.org>
Date:   Thu Jul 4 14:24:16 2013 +0530

    hwcomposer: Reset LayerRotMap if MDP configure fails

    For some reason if overlay pipe allocation fails reset the LayerRotMap
    to avoid calling rotator sync ioctl which we should not call.

    Change-Id: Ibe31d22a18bf48201ab8f20009489c6dc5e04a28
    Crs-Fixed: 505003

commit e940babfc9711d252b42ddd62cf080b7d7cf4de7
Author: Prabhanjan Kandula <pkandula@codeaurora.org>
Date:   Wed Jul 10 17:20:59 2013 +0530

    hwcomposer: Fix a crash with MDP composition.

    Reset the current frame data before returning from MDP
    composition prepare to avoid accessing previous frame data
    in MDP composition draw phase. Avoid the number of app layers
    going beyond the layer count limit in MDP composition.

    Change-Id: I2a3035ad5cb1731060b9359ccdbe9fe0c07e843c
    CRs-fixed: 510683

commit 0dd581c21458302964bc0ad59392238c9d556300
Author: Prabhanjan Kandula <pkandula@codeaurora.org>
Date:   Tue Jul 9 15:41:08 2013 +0530

    libqdutils: Add synchronization to idle invalidator

    Protect invalidator data from accessing multiple threads
    asynchronously. Composition thread and idle invalidator
    threads could access at same time. Add locking to protect
    invalidator class  member variables.

    Change-Id: I568ec367958c88f70f7aa4e6917abd53830adfd3

Change-Id: Ie435e0355e15b9aae1ea302cea6796158b177b49
Merge "display-caf: sync with CyanogenMod cm-10.2 branch" into cm-10.2