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

Commit 7b6320b0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Re-enable empty damage drop optimization"

parents d43f86ff 0b19a737
Loading
Loading
Loading
Loading
+18 −5
Original line number Diff line number Diff line
@@ -401,11 +401,11 @@ void CanvasContext::draw() {
    SkRect dirty;
    mDamageAccumulator.finish(&dirty);

    // TODO: Re-enable after figuring out cause of b/22592975
    //    if (dirty.isEmpty() && Properties::skipEmptyFrames) {
    //        mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
    //        return;
    //    }
    if (dirty.isEmpty() && Properties::skipEmptyFrames
            && !surfaceRequiresRedraw()) {
        mCurrentFrameInfo->addFlag(FrameInfoFlags::SkippedFrame);
        return;
    }

    mCurrentFrameInfo->markIssueDrawCommandsStart();

@@ -638,6 +638,19 @@ int64_t CanvasContext::getFrameNumber() {
    return mFrameNumber;
}

bool CanvasContext::surfaceRequiresRedraw() {
    if (!mNativeSurface) return false;
    if (mHaveNewSurface) return true;

    int width = -1;
    int height = -1;
    ReliableSurface* surface = mNativeSurface.get();
    surface->query(NATIVE_WINDOW_WIDTH, &width);
    surface->query(NATIVE_WINDOW_HEIGHT, &height);

    return width == mLastFrameWidth && height == mLastFrameHeight;
}

SkRect CanvasContext::computeDirtyRect(const Frame& frame, SkRect* dirty) {
    if (frame.width() != mLastFrameWidth || frame.height() != mLastFrameHeight) {
        // can't rely on prior content of window if viewport size changes
+1 −0
Original line number Diff line number Diff line
@@ -217,6 +217,7 @@ private:
    void freePrefetchedLayers();

    bool isSwapChainStuffed();
    bool surfaceRequiresRedraw();

    SkRect computeDirtyRect(const Frame& frame, SkRect* dirty);