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

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

Merge "Return early when we cannot allocate a hardware layer Bug #5462308"

parents b5c45e00 5cd5c3f7
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -10114,8 +10114,20 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
                mLocalDirtyRect.setEmpty();
            }
            // The layer is not valid if the underlying GPU resources cannot be allocated
            if (!mHardwareLayer.isValid()) {
                return null;
            }
            HardwareCanvas currentCanvas = mAttachInfo.mHardwareCanvas;
            final HardwareCanvas canvas = mHardwareLayer.start(currentCanvas);
            // Make sure all the GPU resources have been properly allocated
            if (canvas == null) {
                mHardwareLayer.end(currentCanvas);
                return null;
            }
            mAttachInfo.mHardwareCanvas = canvas;
            try {
                canvas.setViewport(width, height);
+2 −1
Original line number Diff line number Diff line
@@ -216,7 +216,8 @@ Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque
        layer->allocateTexture(GL_RGBA, GL_UNSIGNED_BYTE);

        if (glGetError() != GL_NO_ERROR) {
            LOGD("Could not allocate texture");
            LOGD("Could not allocate texture for layer (fbo=%d %dx%d)",
                    fbo, width, height);

            glBindFramebuffer(GL_FRAMEBUFFER, previousFbo);
            Caches::getInstance().fboCache.put(fbo);