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

This commit is contained in:
Romain Guy
2011-10-17 17:11:08 -07:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 1 deletions

View File

@ -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);

View File

@ -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);