Merge "Return early when we cannot allocate a hardware layer Bug #5462308"
This commit is contained in:
@ -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);
|
||||
|
@ -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);
|
||||
|
Reference in New Issue
Block a user