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

Commit db0e69ef authored by Rajulu Ponnada's avatar Rajulu Ponnada
Browse files

frameworks: extended tile rendering to avoid unresolves

extended tile rendering to avoid unnecessary resolves and
unresolves caused by apps.

Change-Id: Ie255a680b0fea0726fa2e5b0594be2bd924bc4ee
parent f7b97761
Loading
Loading
Loading
Loading
+31 −7
Original line number Diff line number Diff line
@@ -130,7 +130,7 @@ OpenGLRenderer::OpenGLRenderer():
    mFirstSnapshot = new Snapshot;
    mFrameStarted = false;
    mCountOverdraw = false;

    mExtendedTiling = false;
    mScissorOptimizationDisabled = false;
}

@@ -203,7 +203,7 @@ void OpenGLRenderer::setupFrameState(float left, float top,
    mTilingClip.set(left, top, right, bottom);
}

status_t OpenGLRenderer::startFrame() {
status_t OpenGLRenderer::startFrame(bool useExTiling) {
    if (mFrameStarted) return DrawGlInfo::kStatusDone;
    mFrameStarted = true;

@@ -217,8 +217,12 @@ status_t OpenGLRenderer::startFrame() {
    // This ensures we don't use tiling when a functor is going to be
    // invoked during the frame
    mSuppressTiling = mCaches.hasRegisteredFunctors();

    if (!mSuppressTiling) {
        startTiling(mSnapshot, true);
    }
    else if (useExTiling){
        startTilingEx(mSnapshot);
    }

    debugOverdraw(true, true);

@@ -304,10 +308,30 @@ void OpenGLRenderer::startTiling(const Rect& clip, int windowHeight, bool opaque
    }
}

void OpenGLRenderer::startTilingEx(const sp<Snapshot>& s) {
    Rect* clip = &mTilingClip;
    if (s->flags & Snapshot::kFlagFboTarget) {
      clip = &(s->layer->clipRect);
    }

    mCaches.startTiling(clip->left, s->height - clip->bottom,
            clip->right - clip->left, clip->bottom - clip->top, true);
    mExtendedTiling = true;
}

void OpenGLRenderer::endTiling() {
    if (!mSuppressTiling) mCaches.endTiling();
    if (!mSuppressTiling)
      mCaches.endTiling();
    else
      endTilingEx();
}

void OpenGLRenderer::endTilingEx() {
    if (mExtendedTiling) {
        mCaches.endTiling();
        mExtendedTiling = false;
    }
}
void OpenGLRenderer::finish() {
    renderOverdraw();
    endTiling();
@@ -2043,7 +2067,7 @@ status_t OpenGLRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty,
    // will be performed by the display list itself
    if (displayList && displayList->isRenderable()) {
        if (CC_UNLIKELY(mCaches.drawDeferDisabled)) {
            status = startFrame();
            status = startFrame(true);
            ReplayStateStruct replayStruct(*this, dirty, replayFlags);
            displayList->replay(replayStruct, 0);
            return status | replayStruct.mDrawGlStatus;
@@ -2055,7 +2079,7 @@ status_t OpenGLRenderer::drawDisplayList(DisplayList* displayList, Rect& dirty,
        displayList->defer(deferStruct, 0);

        flushLayers();
        status = startFrame();
        status = startFrame(true);

        return status | deferredList.flush(*this, dirty);
    }
+6 −1
Original line number Diff line number Diff line
@@ -452,7 +452,7 @@ protected:
     * Indicates the start of rendering. This method will setup the
     * initial OpenGL state (viewport, clearing the buffer, etc.)
     */
    status_t startFrame();
    status_t startFrame(bool useExTiling = false);

    /**
     * Clears the underlying surface if needed.
@@ -589,6 +589,7 @@ private:
     */
    void startTiling(const sp<Snapshot>& snapshot, bool opaque = false);

    void startTilingEx(const sp<Snapshot>& snapshot);
    /**
     * Tells the GPU what part of the screen is about to be redrawn.
     * This method needs to be invoked every time getTargetFbo() is
@@ -602,6 +603,7 @@ private:
     */
    void endTiling();

    void endTilingEx();
    /**
     * Saves the current state of the renderer as a new snapshot.
     * The new snapshot is saved in mSnapshot and the previous snapshot
@@ -1117,6 +1119,9 @@ private:
    // No-ops start/endTiling when set
    bool mSuppressTiling;

    //tiling to avoid unresolves when set
    bool mExtendedTiling;

    // If true, this renderer will setup drawing to emulate
    // an increment stencil buffer in the color buffer
    bool mCountOverdraw;