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

Commit 0585744a authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Discard framebuffer commands when we redraw the entire buffer" into jb-mr1-dev

parents 709c542b 45e4c3df
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1412,8 +1412,12 @@ int DisplayListRenderer::prepareDirty(float left, float top,
    mSnapshot = new Snapshot(mFirstSnapshot,
            SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
    mSaveCount = 1;

    mSnapshot->setClip(0.0f, 0.0f, mWidth, mHeight);
    mDirtyClip = opaque;

    mRestoreSaveCount = -1;

    return DrawGlInfo::kStatusDone; // No invalidate needed at record-time
}

+3 −3
Original line number Diff line number Diff line
@@ -332,10 +332,10 @@ void LayerRenderer::flushLayer(Layer* layer) {
        if (Caches::getInstance().extensions.hasDiscardFramebuffer()) {
            GLuint previousFbo;
            glGetIntegerv(GL_FRAMEBUFFER_BINDING, (GLint*) &previousFbo);

            GLenum attachments = GL_COLOR_ATTACHMENT0;
            if (fbo != previousFbo) glBindFramebuffer(GL_FRAMEBUFFER, fbo);
            glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, &attachments);

            const GLenum attachments[] = { GL_COLOR_ATTACHMENT0 };
            glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments);

            if (fbo != previousFbo) glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
        }
+9 −0
Original line number Diff line number Diff line
@@ -173,6 +173,15 @@ int OpenGLRenderer::prepareDirty(float left, float top, float right, float botto
    mSnapshot->setClip(left, top, right, bottom);
    mDirtyClip = opaque;

    // If we know that we are going to redraw the entire framebuffer,
    // perform a discard to let the driver know we don't need to preserve
    // the back buffer for this frame.
    if (mCaches.extensions.hasDiscardFramebuffer() &&
            left <= 0.0f && top <= 0.0f && right >= mWidth && bottom >= mHeight) {
        const GLenum attachments[] = { getTargetFbo() == 0 ? GL_COLOR_EXT : GL_COLOR_ATTACHMENT0 };
        glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments);
    }

    syncState();

    if (!opaque) {