Squashed commit of the following:

commit 65d815700b2d861b33ea2979f45f2b618b4075d4
Merge: dcec814 34dcb8d
Author: Kristof Petho <kristof.petho@gmail.com>
Date:   Thu Aug 7 09:07:30 2014 +0200

    Merge tag 'AU_LINUX_ANDROID_KK_3.5.04.04.02.003.367' of git://codeaurora.org/quic/la/platform/hardware/qcom/display into caf

    AU_LINUX_ANDROID_KK_3.5.04.04.02.003.367

commit 34dcb8d1d9b8c5cf093b54131fac0694ad5adda3
Merge: 314a602 ff4f041
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Wed Jun 18 16:24:52 2014 -0700

    Merge "hwc: Define binder interface to set view frame of a display"

commit 314a602b04bc90b9a33936057d20b4a2e748706c
Merge: c7b6992 5166b31
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Wed Jun 18 14:02:15 2014 -0700

    Merge "hwc: Avoid MDP draw if prepare is not successful."

commit c7b69920165f62f0470cdb43dd14ed1eabf3a9e4
Merge: af8e3cf 36fa71a
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Wed Jun 18 14:01:41 2014 -0700

    Merge "common: Do not link to ABL lib"

commit ff4f04140440d39acf120e314875337943f3400f
Author: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>
Date:   Mon May 19 19:53:56 2014 -0700

    hwc: Define binder interface to set view frame of a display

    Define binder interface setViewFrame to set view frame information
    of a display by surfaceflinger when projection for that display
    changes.

    Change-Id: If737b51ae0f04303a1a29c91a9703f64354b61fb

commit 5166b31155983d07df940f5fbca1f0d996153b6f
Author: Raj Kamal <rkamal@codeaurora.org>
Date:   Fri Jun 6 13:45:20 2014 +0530

    hwc: Avoid MDP draw if prepare is not successful.

    If #AppLayers are 0 or exceed MAX_NUM_APP_LAYERS
    return early from MDP draw.

    Change-Id: I834c7b04a295fbd9b98374cade880992d995ad1f

commit 36fa71af06d2bbb21e67b5338ba48a5d4122c498
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Wed Feb 19 17:46:46 2014 -0500

    common: Do not link to ABL lib

    The library is not used in the code. If used in the future, it
    can be linked to with dlopen.

    Change-Id: I5af0847f0838f26c3c7f39375d3f082b1d3b8a6c

commit af8e3cf434e44d3158b870c310bf1c0b613fcfa1
Merge: cb77440 f9b2cb8
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Jun 12 23:14:53 2014 -0700

    Merge "overlay: Request specific pipe type"

commit cb77440d8dda9a61241a978b64e0c728b78d8dbb
Merge: 0873535 2268dd7
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Jun 12 23:14:51 2014 -0700

    Merge "hwc: modifying logic in adjust FB Z-order for 4k2kYUVSplit"

commit 0873535dba6cf5043b15727e6540dbbc8c15eb98
Merge: 793835a 8b9c04b
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Jun 12 15:57:57 2014 -0700

    Merge "libmemtrack: Use kgsl memory flag to determine usermapped buffers"

commit f9b2cb84c4770b6b84ea806a2b3c524d6b568fb6
Author: radhakrishna <radhakrishna@codeaurora.org>
Date:   Fri May 9 16:18:43 2014 +0530

    overlay: Request specific pipe type

    Request driver for a specific pipe type instead of
    notifying the type request using mdp flags.

    Change-Id: I83fffc7c0e1f24d903b7dd6d52a58b87c70f3d4f

commit 793835aee70664bdcd2c71dd2012db965c91d086
Merge: 1f6fb30 5c353ea
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Mon Jun 9 21:23:36 2014 -0700

    Merge "hqd: Fix Klocwork errors in liblight"

commit 2268dd772e8ddf2a283752ad3fd87b6bce19256f
Author: Dileep Kumar Reddi <dkumarre@codeaurora.org>
Date:   Thu May 22 22:24:53 2014 +0530

    hwc: modifying logic in adjust FB Z-order for 4k2kYUVSplit

    Use complete layer list details instead of depending on only
    4k YUV layer indices.

    Change-Id: I28deee47b8330a4b3c56bef48e333ce6ead8bf25

commit 1f6fb30c2bcabfb3f48d0b9718cec767123d8674
Merge: ce03e88 56db0cc
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Jun 5 00:22:00 2014 -0700

    Merge "display: Remove klockwork warnings and errors."

commit 8b9c04bf53bf1477cac52c1c96c32bc6db3abe08
Author: Harsh Vardhan Dwivedi <hdwivedi@codeaurora.org>
Date:   Mon May 5 22:30:02 2014 -0600

    libmemtrack: Use kgsl memory flag to determine usermapped buffers

    Instead of using useraddr from kgsl memory allocations to be
    matched against proc/<pid>/smaps file to be used to determine
    usermapping of a buffer, use the newly added flag which directly
    indicates whether a given gpubuffer entry is usermapped or
    not. The flag is the last character in the "flags" field.

    CRs-fixed: 634962
    Change-Id: I1f82f7a2ff207eb780f1938a3b1347451b1e3d77

commit ce03e880a26e8342f7c500bd7e17dc282449296b
Merge: 5476b99 2f8cd2b
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Mon Jun 2 12:08:29 2014 -0700

    Merge "hwc: Handle validateAndSet failures in AD prepare call"

commit 5476b99fdc20da54ad0fee7cb43d0dc119af1fac
Merge: adcbd90 51fed98
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Fri May 30 12:08:26 2014 -0700

    Merge "hwc: Fix klockwork errors"

commit 5c353eac5f749537049083f0863c20818d2511e5
Author: Manoj Kumar AVM <manojavm@codeaurora.org>
Date:   Tue Apr 29 22:08:51 2014 -0700

    hqd: Fix Klocwork errors in liblight

    1. Fix null pointer de-reference klocwork error in liblight.
    2. sprintf is part of ScanBan function. Replace sprintf with
       snprintf.

    Change-Id: I0b88967a2bdf4adf563753c09df88d2c6a432045

commit 2f8cd2b2b0d22d85ea7a73cb422b467a1e8b1c67
Author: Tatenda Chipeperekwa <tatendac@codeaurora.org>
Date:   Mon Apr 14 10:36:06 2014 -0700

    hwc: Handle validateAndSet failures in AD prepare call

    When validateAndSet fails we must reset the mDoable flag to false and
    close the fb device. This will prevent making a draw call using
    invalid resource references and prevent any fd leaks.

    Additionally, we should only turn AD on if there are no configuration
    errors during prepare call. This will prevent toggling AD between
    on/off state in the face of continuous failures.

    Change-Id: I15502dbf64c6203092aa13e001bab5d27b0e17ec

commit 51fed98fdccda280a991217418c363657bc8a854
Author: Praveena Pachipulusu <pveena@codeaurora.org>
Date:   Wed May 7 20:01:54 2014 +0530

    hwc: Fix klockwork errors

    Resolving klockwork errors to avoid memory leaks,
    improper assignments in liboverlay.

    Change-Id: I82ac6ae782c7b783e89999b832bbd1d361376b9f

commit 56db0ccdd68bd5dd8ab187772956c48bf93800cb
Author: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>
Date:   Fri Jan 31 20:03:01 2014 -0800

    display: Remove klockwork warnings and errors.

    Remove all klockwork warnings and errors for libgralloc,
    libhwcomposer, liboverlay, libqdutils, libqservice, libvirtual,
    libexternal libraries to avoid buffer overflow and memory leaks.

    Change-Id: I078143bcbcf5e4b342156bd8305a644566f7cc4b

commit adcbd901b9a4e51353113ebe20e0b4baa56e70a1
Merge: 1b4ad93 684f7e8
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Sat May 10 05:13:07 2014 -0700

    Merge "overlay: Align width to 4 multiple in case of 90 degree rotation."

commit 1b4ad93ba02b94dc811d1fe21f9dbc948ea52c85
Merge: 4f446b4 65d4434
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Wed May 7 11:24:15 2014 -0700

    Merge "hwc: set mModeOn flag for fbupdate properly"

commit 65d44346bcec2f222c7d549da41655eabe06c9e6
Author: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>
Date:   Mon Mar 17 17:30:15 2014 -0700

    hwc: set mModeOn flag for fbupdate properly

    Set mModeOn flag for fbupdate to false if validateAndSet function
    fails, so that queueBuffer can be avoided for prepare failure.

    Change-Id: Ifcc7a16caf8779f13411ae2a9eeeec6e6c846f4c

commit 4f446b4b65bc9d01f3e7bf06b297ee79aa393853
Merge: ccdfdfb d0a2c37
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue May 6 13:45:03 2014 -0700

    Merge "h/q/d: Dump ovinfo only on pipe config errors"

commit ccdfdfb2d0b3e26fdf34b188b2186b502e1da4c3
Merge: 09c5570 2d41c76
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Sun May 4 21:45:45 2014 -0700

    Merge "hwc: Fix for HDMI video playback out of boundary in portrait."

commit 2d41c76de6a69e04d5bb8aa148029956861f1c7e
Author: Ramkumar Radhakrishnan <ramkumar@codeaurora.org>
Date:   Mon Mar 24 14:33:17 2014 -0700

    hwc: Fix for HDMI video playback out of boundary in portrait.

    Fix for out of boundary video playback issue on HDMI where HDMI
    resolution is lower than primary resolution.

    Change-Id: I4271471cda87e1e3d3805ace8b8723a91979a160

commit 684f7e80743bfed995a0c2d4dac3692a42047e95
Author: Sravan Kumar D.V.N <sravank1@codeaurora.org>
Date:   Wed Mar 26 19:13:11 2014 +0530

    overlay: Align width to 4 multiple in case of 90 degree rotation.

    To support interlaced content with 90 degree rotation
    width has to be aligned to 4 multiple.

    Change-Id: Idaae06f1aa80490ae1b37e148c6d862dc26bebca
    CRs-Fixed: 637264

commit 09c557023bb604876151ba99720f0ace8a518721
Merge: d0e44e3 5c2b3af
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Apr 29 08:23:49 2014 -0700

    Merge "hwc: [8x26]Never allow primary get DMA pipe when external connect"

commit 5c2b3af4fdb26e23f8da2eccfd125cf09264d9d2
Author: Xu Yang <yangxu@codeaurora.org>
Date:   Tue Apr 8 13:56:47 2014 +0800

    hwc: [8x26]Never allow primary get DMA pipe when external connect

    For 8x26, if external display is connected, DMA pipe should never
    be occupied by primary display. Otherwise, external display would
    lack DMA pipe if switch to GPU composition.

    This patch refines former commit: 9c1eb2be21a4952ee097d33

    CRs-Fixed: 640934
    Change-Id: Idc64b724cfacf9e8e22ca73e4e443e8d989e1212

commit d0e44e3e0486cbd7bd4391fb11d6adc0409f0361
Merge: b67c117 cbce60f
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Apr 24 00:37:35 2014 -0700

    Merge "hwc: Set DMA state at the start of composition"

commit b67c11748daeb83690c8e4252337bb96f0b47750
Merge: e6e18a1 fc5b922
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Apr 24 00:37:34 2014 -0700

    Merge "Invoke a padding round in certain use-cases."

commit e6e18a1e52d6bfcbf69993b6c0107d22deacb1e4
Merge: 2a44b8b 1cbe839
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Apr 24 00:37:33 2014 -0700

    Merge "Set priority among various display devices"

commit 2a44b8bd71bb060f0c03ab5edc306776691d8f23
Merge: 6bc6487 a192cd2
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Wed Apr 23 06:46:33 2014 -0700

    Merge "hwc: Handle more events from driver."

commit a192cd2ad147654fb38f124c645322998b39b581
Author: Naseer Ahmed <naseer@codeaurora.org>
Date:   Mon Mar 10 17:20:02 2014 -0400

    hwc: Handle more events from driver.

    In certain cases, such as the shutdown sequence, the driver may
    blank itself without any direction from SurfaceFlinger.
    In such cases the HWC should make sure that no further updates on
    the display occur.
    Handle events from driver in a more generic way to include blank
    events and leave room for any other events that need to be polled
    on from the driver.

    Change-Id: I0aab9f30046f07ca9c90c73cadabcadc150565c8
    CRs-fixed: 627814

commit cbce60fab947da0aa3b3e5eb8f9c69277190a627
Author: Raj Kamal <rkamal@codeaurora.org>
Date:   Thu Apr 10 16:58:44 2014 +0530

    hwc: Set DMA state at the start of composition

    * Set DMA state at the start of the composition cycle
    based on the following.

    Set it to LINE_MODE if the number of active rotator
    sessions are 0.

    Set it to BLOCK_MODE if
    ** A yuv-layer for any display-device requires rotation
    ** (or) mExtOrientation is set
    ** (or) mBufferMirrorMode is set

    * Separate out the reset helper function into more
    modular ones

    Change-Id: I6a22ac4379565cd1fd2d875a7a417f4ed3ee0f1e

commit fc5b922503f5ae663aa76edadd8b7f12d58fb362
Author: Raj Kamal <rkamal@codeaurora.org>
Date:   Fri Feb 7 16:15:17 2014 +0530

    Invoke a padding round in certain use-cases.

    * In some use-cases, it is possible that there are
    no AppBuffer layers on the external/virtual layer-list
    during which all the pipes will be allocated to the
    primary. When layers do comeup on external/virtual
    layer-list, subsequent overlay sets fail.

    * This change ensures that in such cases, we invoke a
    padding round on all the displays to free up the
    hw resources which can be used in subsequent cycles.

    Change-Id: Ifac0b8f51a8719eb55b11010d05b8d11352db054

commit 1cbe8398681aeca786c9c1062c85bd93f11f5c16
Author: Raj Kamal <rkamal@codeaurora.org>
Date:   Mon Jan 27 19:35:13 2014 +0530

    Set priority among various display devices

    * When a non-WFD virtual display device (SSD/
    screenrecord) is active along with
    non-hybrid WFD solution(WFD faked on
    external), give preference to non-hybrid WFD
    device over non-WFD virtual display device.

    * This is needed only in cases when WFD is
    enabled via v4l2 rather than using VDS api's.

    Change-Id: I63e53baa214bdcdac19430ca30b939cdd7416cbb

commit 6bc648746333aa78ec8b45ddc58e5bbb509ec089
Merge: 3a5bef6 9af062e
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Mon Apr 21 00:14:07 2014 -0700

    Merge "Display and wfd synchronization during teardown"

commit 3a5bef6e4ea33eeef0861f801435bc2773aef661
Merge: 5448cad 5b967eb
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Apr 17 21:10:17 2014 -0700

    Merge "qdutils: correct error checking of MetaData's handle mapping"

commit 9af062e94e5232b89939a90a18a056593dd21ea1
Author: Raj kamal <rkamal@codeaurora.org>
Date:   Tue Apr 1 16:52:19 2014 +0530

    Display and wfd synchronization during teardown

    * Provide a binder interface call for wfd module
    to inform display about the start/stop/pause/resume
    of wfd session.

    * This is needed for wfd-hdmi synchronization in
    case of v4l2 wfd solution. If hdmi is plugged
    in during v4l2 wfd session, display-hal waits in
    uevent thread for wfd teardown notification from
    wfd module, before going ahead with configuring
    external display.

    Change-Id: I9514cb5bc7ff81de0b5dd4cdf66d8286a64ba094

commit 5448cad65010e2fa6d23312a44d8f7265e1da3cd
Merge: e85805a 9b6348f
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Thu Apr 17 13:14:24 2014 -0700

    Merge "libvirtual: Fix logic to detect DRC use case."

commit 5b967eb6a54bffe6cc901761656b6170fcd4a3cd
Author: Ray Zhang <rayz@codeaurora.org>
Date:   Mon Apr 14 15:32:04 2014 +0800

    qdutils: correct error checking of MetaData's handle mapping

    In term of Linux manual, mmap() returns MAP_FAILED in case of
    error, so current checking against NULL is not valid.

    Change-Id: Iee6920b6478843a0c1cd62bdbe3e4b652a39c583

commit 9b6348f862e8d114224c4c63df3682bed27b220a
Author: Tatenda Chipeperekwa <tatendac@codeaurora.org>
Date:   Tue Apr 8 11:41:37 2014 -0700

    libvirtual: Fix logic to detect DRC use case.

    We detect DRC based on the resolution of the external display stored
    in the HAL, and the dimensions of the framebuffer(fb2) after receiving
    a RESUME event. If the stored resolution is greater than that of fb2
    it means fb2 was reconfigured due to DRC. This is the only case in
    which we trigger the DRC path (and the MDP downscale path thereafter).

    For all other cases, the RESUME event is just treated as normal and
    should not result in triggering the DRC path.

    Change-Id: I2c8a854434f09a840938f00b88faa59c6cb57e7f

commit e85805a77453da15d557b49d4e94b5af8428ea42
Merge: 8938d36 d8ef93f
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Tue Apr 15 19:27:41 2014 -0700

    Merge "hwc: Color layer always has zero transform."

commit d8ef93f46d0c0162b75c6c4edffe4355b5070fdd
Author: Sushil Chauhan <sushilchauhan@codeaurora.org>
Date:   Thu Mar 20 11:08:41 2014 -0700

    hwc: Color layer always has zero transform.

    Color layer always has zero transform because framework uses the
    transform member of hwc layer to pass the color value to HAL.

    Change-Id: I79fe204c558d1b6e1dd69ba635ba0bd87140b1b1

commit 8938d3637769aaf823c4da8a69474208ebb0e6d5
Merge: 8e3af8a 5c69879
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Mon Apr 14 15:29:34 2014 -0700

    Merge "hwc: Display view frame needs to be set before using it."

commit 8e3af8a8fb80f84e492be0c6f75aa90d746dcbc3
Merge: c2d198e 70b62f5
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Mon Apr 14 08:31:34 2014 -0700

    Merge "hwc: Add rotator obj to layer-rot-map if acquired"

commit 5c69879a5b0c696b164091e5af7503da6d9fba49
Author: Sushil Chauhan <sushilchauhan@codeaurora.org>
Date:   Wed Apr 9 09:15:37 2014 -0700

    hwc: Display view frame needs to be set before using it.

    The display view frame needs to be set before calling trimLayer api
    because it uses view frame to find the scissor for display, which is
    used to clip crop for out-of-bounds display frame sent by framework.
    If mViewFrame is not set, scissor will be empty rect, which leads to
    wrong source crop calculation.

    Change-Id: I52ad4eb9037d34aff24c30fe65e3793684445264

commit c2d198ee396681c9323e19047dc025b71d44fd7d
Merge: 357c9f5 60aafff
Author: Linux Build Service Account <lnxbuild@localhost>
Date:   Fri Apr 11 06:59:04 2014 -0700

    Merge "HWC: Minor fix in 4k2kYUVsplit feature"

commit d0a2c3746b751e5060a9d421372fc7b2ea0493ca
Author: Jeykumar Sankaran <jsanka@codeaurora.org>
Date:   Tue Apr 1 15:21:55 2014 -0700

    h/q/d: Dump ovinfo only on pipe config errors

    Dump ovinfo only when validateandSet fails due to invalid pipe
    configs. Failure due to insufficient resource is common and
    dumping ovinfo for such cases wont provide much information.

    Change-Id: I9e102cf633bb394603ea2484d80017e4b906b49a

commit 70b62f54e5676544240ca253fe4685b233ac348b
Author: Saurabh Shah <saurshah@codeaurora.org>
Date:   Mon Mar 31 10:31:42 2014 -0700

    hwc: Add rotator obj to layer-rot-map if acquired

    Add rotator obj to the layer-rot-map soon after its successfully
    acquired. This makes sure that any object allocated is accounted
    for, irrespective of whether rotator configuration succeeds or not.

    Change-Id: I94102d9c607cf61b2eccdf7f2445bb07d309d35c

commit 60aafff743ddcba47460dbc63cfbad29e984fc89
Author: Dileep Kumar Reddi <dkumarre@codeaurora.org>
Date:   Tue Apr 1 12:57:08 2014 +0530

    HWC: Minor fix in 4k2kYUVsplit feature

    Increment fbZ when 4k2kyuvindex matches with fbZ,
    otherwise we see momentary flicker as right half of
    4k2k YUV layer and fb layer have same z-order.

    Change-Id: Ia900e102b6d4670b9bfdfd4e52ef360d1d813cab

Change-Id: I73c17bc5986fdb301540af60ca99bb068de6a5d0