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

Commit a59ff8f9 authored by Kyong Hwa Bae's avatar Kyong Hwa Bae Committed by Giulio Cervera
Browse files

SurfaceFlinger: Skip composition when rotation is not completed

When rotating, each layer's buffer is already changed to
new orientation before SurfaceFlinger gets the signal from
Window Manager. If the orientations of all the buffers are
changed to new orientation, then that's fine. But, sometimes,
only one buffer is changed and others remain the same.
In this case, skip composition.

Change-Id: I850fe8ee6d806e21833e6811f95878fcfb6f7c40
CRs-fixed: 338034
parent 0662345c
Loading
Loading
Loading
Loading
+13 −0
Original line number Original line Diff line number Diff line
@@ -190,6 +190,19 @@ status_t Layer::setBuffers( uint32_t w, uint32_t h,
    return NO_ERROR;
    return NO_ERROR;
}
}


#ifdef QCOM_HARDWARE
bool Layer::isRotated() const {

    const Layer::State& front(drawingState());

    if( (front.w == front.requested_w) &&
        (front.h == front.requested_h) ) {
        return true;
    }
    return false;
}
#endif

void Layer::setGeometry(hwc_layer_t* hwcl)
void Layer::setGeometry(hwc_layer_t* hwcl)
{
{
    LayerBaseClient::setGeometry(hwcl);
    LayerBaseClient::setGeometry(hwcl);
+3 −0
Original line number Original line Diff line number Diff line
@@ -77,6 +77,9 @@ public:
    virtual void onRemoved();
    virtual void onRemoved();
    virtual sp<Layer> getLayer() const { return const_cast<Layer*>(this); }
    virtual sp<Layer> getLayer() const { return const_cast<Layer*>(this); }
    virtual void setName(const String8& name);
    virtual void setName(const String8& name);
#ifdef QCOM_HARDWARE
    virtual bool isRotated() const;
#endif


    // LayerBaseClient interface
    // LayerBaseClient interface
    virtual wp<IBinder> getSurfaceTextureBinder() const;
    virtual wp<IBinder> getSurfaceTextureBinder() const;
+6 −0
Original line number Original line Diff line number Diff line
@@ -363,6 +363,12 @@ bool LayerBase::isOverlay() const {
    return mInOverlay;
    return mInOverlay;
}
}


#ifdef QCOM_HARDWARE
bool LayerBase::isRotated() const {
    return true;
}
#endif

void LayerBase::setFiltering(bool filtering)
void LayerBase::setFiltering(bool filtering)
{
{
    mFiltering = filtering;
    mFiltering = filtering;
+3 −0
Original line number Original line Diff line number Diff line
@@ -117,6 +117,9 @@ public:
    virtual void setPerFrameData(hwc_layer_t* hwcl);
    virtual void setPerFrameData(hwc_layer_t* hwcl);
            void setOverlay(bool inOverlay);
            void setOverlay(bool inOverlay);
            bool isOverlay() const;
            bool isOverlay() const;
#ifdef QCOM_HARDWARE
    virtual bool isRotated() const;
#endif




    /**
    /**
+22 −0
Original line number Original line Diff line number Diff line
@@ -445,6 +445,13 @@ bool SurfaceFlinger::threadLoop()
        handleWorkList();
        handleWorkList();
    }
    }


#ifdef QCOM_HARDWARE
    if (isRotationCompleted() == false) {
        LOGD("Rotation is not finished. Skip the composition");
        return true;
    }
#endif

    const DisplayHardware& hw(graphicPlane(0).displayHardware());
    const DisplayHardware& hw(graphicPlane(0).displayHardware());
    if (LIKELY(hw.canDraw())) {
    if (LIKELY(hw.canDraw())) {
        // repaint the framebuffer (if needed)
        // repaint the framebuffer (if needed)
@@ -843,6 +850,21 @@ void SurfaceFlinger::unlockPageFlip(const LayerVector& currentLayers)
    }
    }
}
}


#ifdef QCOM_HARDWARE
bool SurfaceFlinger::isRotationCompleted()
{
    const Vector< sp<LayerBase> >& currentLayers(mVisibleLayersSortedByZ);
    const size_t count = currentLayers.size();

    for (size_t i=0 ; i<count ; i++) {
        if (currentLayers[i]->isRotated() == false) {
            return false;
        }
    }
    return true;
}
#endif

void SurfaceFlinger::handleWorkList()
void SurfaceFlinger::handleWorkList()
{
{
    mHwWorkListDirty = false;
    mHwWorkListDirty = false;
Loading