Skip to content

Instantly share code, notes, and snippets.

@pawitp
Last active December 30, 2015 21:59
Show Gist options
  • Save pawitp/7891444 to your computer and use it in GitHub Desktop.
Save pawitp/7891444 to your computer and use it in GitHub Desktop.

Revisions

  1. pawitp revised this gist Dec 16, 2013. 1 changed file with 78 additions and 2 deletions.
    80 changes: 78 additions & 2 deletions patch.diff
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,53 @@
    From b8f9e36338d1b7812b9e6a43ca69ec3483aecda2 Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:38:17 +0700
    Subject: [PATCH 1/4] binder: add compat symbols

    Required for libtvservice_binder.so on I9082

    Change-Id: I059e92f19e4c5a911d38faa9c4df549c75c90761
    ---
    libs/binder/Parcel.cpp | 12 ++++++++++++
    1 file changed, 12 insertions(+)

    diff --git a/libs/binder/Parcel.cpp b/libs/binder/Parcel.cpp
    index 38e019c..26e54f1 100644
    --- a/libs/binder/Parcel.cpp
    +++ b/libs/binder/Parcel.cpp
    @@ -808,6 +808,12 @@ status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob)
    return status;
    }

    +extern "C" status_t _ZN7android6Parcel5writeERKNS0_26FlattenableHelperInterfaceE(void *parcel, void *val);
    +
    +extern "C" status_t _ZN7android6Parcel5writeERKNS_11FlattenableE(void *parcel, void *val) {
    + return _ZN7android6Parcel5writeERKNS0_26FlattenableHelperInterfaceE(parcel, val);
    +}
    +
    status_t Parcel::write(const FlattenableHelperInterface& val)
    {
    status_t err;
    @@ -1184,6 +1190,12 @@ status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const
    return NO_ERROR;
    }

    +extern "C" status_t _ZNK7android6Parcel4readERNS0_26FlattenableHelperInterfaceE(void *parcel, void *val);
    +
    +extern "C" status_t _ZNK7android6Parcel4readERNS_11FlattenableE(void *parcel, void *val) {
    + return _ZNK7android6Parcel4readERNS0_26FlattenableHelperInterfaceE(parcel, val);
    +}
    +
    status_t Parcel::read(FlattenableHelperInterface& val) const
    {
    // size
    --
    1.8.3.4 (Apple Git-47)


    From 3018d04dcdb261b174b7a22787c32c3e3e91f52c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:37:23 +0700
    Subject: [PATCH 1/2] SurfaceFlinger: ifdef EVENT_ORIENTATION
    Subject: [PATCH 2/4] SurfaceFlinger: ifdef EVENT_ORIENTATION

    Some HWC implementation spam the log on unknown event

    @@ -53,7 +99,7 @@ index 822130b..8583393 100644
    From 8a097001d151587a4d4e5205fe92b88d905281fe Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:38:42 +0700
    Subject: [PATCH 2/2] sf: add CAPRI_HWC compatibility
    Subject: [PATCH 3/4] sf: add CAPRI_HWC compatibility

    Change-Id: Iaaba61dc661fcb801ea11db58d129a01105648a3
    ---
    @@ -108,3 +154,33 @@ index dd66f0b..2235cd5 100644
    --
    1.8.3.4 (Apple Git-47)


    From c743a672a7b9b80f3a1765e5a5e0e9093a44a0dd Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Mon, 16 Dec 2013 15:45:42 +0700
    Subject: [PATCH 4/4] sf: CAPRI_HWC: fix rotation artifact

    Change-Id: I1d9cd2a57ece5a55af318f00c7902994a77776fc
    ---
    services/surfaceflinger/SurfaceFlinger.cpp | 5 +++++
    1 file changed, 5 insertions(+)

    diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
    index 8583393..9688f54 100644
    --- a/services/surfaceflinger/SurfaceFlinger.cpp
    +++ b/services/surfaceflinger/SurfaceFlinger.cpp
    @@ -3134,6 +3134,11 @@ status_t SurfaceFlinger::captureScreenImplLocked(
    {
    ATRACE_CALL();

    +// Rotation artifact problems when useReadPixels is false
    +#ifdef CAPRI_HWC
    + useReadPixels = true;
    +#endif
    +
    // get screen geometry
    const uint32_t hw_w = hw->getWidth();
    const uint32_t hw_h = hw->getHeight();
    --
    1.8.3.4 (Apple Git-47)

  2. pawitp created this gist Dec 10, 2013.
    110 changes: 110 additions & 0 deletions patch.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,110 @@
    From 3018d04dcdb261b174b7a22787c32c3e3e91f52c Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:37:23 +0700
    Subject: [PATCH 1/2] SurfaceFlinger: ifdef EVENT_ORIENTATION

    Some HWC implementation spam the log on unknown event

    Change-Id: I3cdbd51f8badc195a14ff2b979d78c363e525207
    ---
    services/surfaceflinger/SurfaceFlinger.cpp | 4 ++++
    1 file changed, 4 insertions(+)

    diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
    index 822130b..8583393 100644
    --- a/services/surfaceflinger/SurfaceFlinger.cpp
    +++ b/services/surfaceflinger/SurfaceFlinger.cpp
    @@ -1103,6 +1103,7 @@ void SurfaceFlinger::setUpHWComposer() {
    sp<const DisplayDevice> hw(mDisplays[dpy]);
    const int32_t id = hw->getHwcDisplayId();
    if (id >= 0) {
    +#ifdef QCOM_HARDWARE
    // Get the layers in the current drawying state
    const LayerVector& layers(mDrawingState.layersSortedByZ);
    bool freezeSurfacePresent = false;
    @@ -1122,6 +1123,7 @@ void SurfaceFlinger::setUpHWComposer() {
    }
    }
    }
    +#endif

    const Vector< sp<Layer> >& currentLayers(
    hw->getVisibleLayersSortedByZ());
    @@ -1135,6 +1137,7 @@ void SurfaceFlinger::setUpHWComposer() {
    */
    const sp<Layer>& layer(currentLayers[i]);
    layer->setPerFrameData(hw, *cur);
    +#ifdef QCOM_HARDWARE
    if(freezeSurfacePresent) {
    // if freezeSurfacePresent, set ANIMATING flag
    cur->setAnimating(true);
    @@ -1155,6 +1158,7 @@ void SurfaceFlinger::setUpHWComposer() {
    }
    }
    }
    +#endif
    }
    }
    }
    --
    1.8.3.4 (Apple Git-47)


    From 8a097001d151587a4d4e5205fe92b88d905281fe Mon Sep 17 00:00:00 2001
    From: Pawit Pornkitprasan <[email protected]>
    Date: Tue, 10 Dec 2013 19:38:42 +0700
    Subject: [PATCH 2/2] sf: add CAPRI_HWC compatibility

    Change-Id: Iaaba61dc661fcb801ea11db58d129a01105648a3
    ---
    services/surfaceflinger/DisplayHardware/HWComposer.cpp | 5 +++++
    services/surfaceflinger/Layer.cpp | 3 +++
    2 files changed, 8 insertions(+)

    diff --git a/services/surfaceflinger/DisplayHardware/HWComposer.cpp b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
    index eead7f1..7c5be2f 100644
    --- a/services/surfaceflinger/DisplayHardware/HWComposer.cpp
    +++ b/services/surfaceflinger/DisplayHardware/HWComposer.cpp
    @@ -1132,13 +1132,18 @@ public:
    //getLayer()->compositionType = HWC_FRAMEBUFFER;
    }
    virtual void setPlaneAlpha(uint8_t alpha) {
    +// CAPRI_HWC does not respect planeAlpha despite being v1.2
    +#ifndef CAPRI_HWC
    if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_2)) {
    getLayer()->planeAlpha = alpha;
    } else {
    +#endif
    if (alpha < 0xFF) {
    getLayer()->flags |= HWC_SKIP_LAYER;
    }
    +#ifndef CAPRI_HWC
    }
    +#endif
    }
    virtual void setDefaultState() {
    hwc_layer_1_t* const l = getLayer();
    diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
    index dd66f0b..2235cd5 100644
    --- a/services/surfaceflinger/Layer.cpp
    +++ b/services/surfaceflinger/Layer.cpp
    @@ -1172,6 +1172,8 @@ uint32_t Layer::getEffectiveUsage(uint32_t usage) const

    void Layer::updateTransformHint(const sp<const DisplayDevice>& hw) const {
    uint32_t orientation = 0;
    +// CAPRI_HWC has display problem in landscape mode when transform is used
    +#ifndef CAPRI_HWC
    if (!mFlinger->mDebugDisableTransformHint) {
    // The transform hint is used to improve performance, but we can
    // only have a single transform hint, it cannot
    @@ -1182,6 +1184,7 @@ void Layer::updateTransformHint(const sp<const DisplayDevice>& hw) const {
    orientation = 0;
    }
    }
    +#endif
    mSurfaceFlingerConsumer->setTransformHint(orientation);
    }

    --
    1.8.3.4 (Apple Git-47)