Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 56dd352c authored by Naomi Luis's avatar Naomi Luis Committed by toastcfh
Browse files

SurfaceFlinger: Skip composition if HWC_SKIP_COMPOSITION flag is set

If the HWC sets the HWC_SKIP_COMPOSITION, SurfaceFlinger should skip
the composition step.

Change-Id: I8d9f6bc61b3788c73d4ea950f1e9a4d78277ae9f
parent 83a88b37
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -98,6 +98,8 @@ status_t HWComposer::createWorkList(size_t numLayers) {
}

status_t HWComposer::prepare() const {
    // Reset the Skip composition flag
    mList->flags &= ~HWC_SKIP_COMPOSITION;
    int err = mHwc->prepare(mHwc, mList);
    if (err == NO_ERROR) {
        size_t numOVLayers = 0;
@@ -167,6 +169,10 @@ hwc_layer_t* HWComposer::getLayers() const {
    return mList ? mList->hwLayers : 0;
}

uint32_t HWComposer::getFlags() const {
    return mList ? mList->flags : 0;
}

void HWComposer::dump(String8& result, char* buffer, size_t SIZE,
        const Vector< sp<LayerBase> >& visibleLayersSortedByZ) const {
    if (mHwc && mList) {
+3 −0
Original line number Diff line number Diff line
@@ -67,6 +67,9 @@ public:
    // updated in preapre()
    size_t getLayerCount(int type) const;

    // gets the list flags
    uint32_t getFlags() const;

    void enableHDMIOutput(bool enable);

    // for debugging
+13 −1
Original line number Diff line number Diff line
@@ -63,10 +63,12 @@ Layer::Layer(SurfaceFlinger* flinger,
        mOpaqueLayer(true),
        mNeedsDithering(false),
        mSecure(false),
        mProtectedByApp(false)
        mProtectedByApp(false),
        mLayerQcomFlags(0)
{
    mCurrentCrop.makeInvalid();
    glGenTextures(1, &mTextureName);
    updateLayerQcomFlags(LAYER_UPDATE_STATUS, true, mLayerQcomFlags);
}

void Layer::onFirstRef()
@@ -257,6 +259,7 @@ void Layer::setPerFrameData(hwc_layer_t* hwcl) {
    } else {
        hwcl->handle = buffer->handle;
    }
    hwcl->flags = getPerFrameFlags(hwcl->flags, mLayerQcomFlags);
}

void Layer::onDraw(const Region& clip) const
@@ -364,6 +367,11 @@ bool Layer::isProtected() const
            (activeBuffer->getUsage() & GRALLOC_USAGE_PROTECTED);
}

void Layer::setIsUpdating(bool isUpdating)
{
    updateLayerQcomFlags(LAYER_UPDATE_STATUS, isUpdating, mLayerQcomFlags);
}

uint32_t Layer::doTransaction(uint32_t flags)
{
    const Layer::State& front(drawingState());
@@ -430,6 +438,8 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
            return;
        }

        updateLayerQcomFlags(LAYER_UPDATE_STATUS, true, mLayerQcomFlags);

        // update the active buffer
        mActiveBuffer = mSurfaceTexture->getCurrentBuffer();

@@ -517,6 +527,8 @@ void Layer::lockPageFlip(bool& recomputeVisibleRegions)
                    bufWidth, bufHeight, mCurrentTransform,
                    front.requested_w, front.requested_h);
        }
    } else {
        updateLayerQcomFlags(LAYER_UPDATE_STATUS, false, mLayerQcomFlags);
    }
}

+4 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ public:
    virtual bool needsDithering() const     { return mNeedsDithering; }
    virtual bool isSecure() const           { return mSecure; }
    virtual bool isProtected() const;
    virtual void setIsUpdating(bool isUpdating);
    virtual void onRemoved();
    virtual sp<Layer> getLayer() const { return const_cast<Layer*>(this); }
    virtual void setName(const String8& name);
@@ -124,6 +125,9 @@ private:

    // binder thread, transaction thread
    mutable Mutex mLock;

    // Qcom specific flags for this layer.
    int mLayerQcomFlags;
};

// ---------------------------------------------------------------------------
+2 −0
Original line number Diff line number Diff line
@@ -205,6 +205,8 @@ public:
    /** called with the state lock when the surface is removed from the
     *  current list */
    virtual void onRemoved() { };
    /** Called from surfaceFlinger to update the layer */
    virtual void setIsUpdating(bool isUpdating) { };
    
    /** always call base class first */
    virtual void dump(String8& result, char* scratch, size_t size) const;
Loading