summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-10-17 17:11:08 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-17 17:11:08 -0700
commitb6233ffd602642cd47a08f951770744cbed54f22 (patch)
treeff039b1f74f6f8e6d9dc7f11fea43f38b7d2d162
parentb5c45e00967b9d0a6411098a598ad6b40f3b2074 (diff)
parent5cd5c3f7e4df99f47e3def6e3707b9eb8205aef3 (diff)
downloadframeworks_base-b6233ffd602642cd47a08f951770744cbed54f22.zip
frameworks_base-b6233ffd602642cd47a08f951770744cbed54f22.tar.gz
frameworks_base-b6233ffd602642cd47a08f951770744cbed54f22.tar.bz2
Merge "Return early when we cannot allocate a hardware layer Bug #5462308"
-rw-r--r--core/java/android/view/View.java12
-rw-r--r--libs/hwui/LayerRenderer.cpp3
2 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 61b13d5..a2f9b36 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -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);
diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp
index dfcc5ea..e38b479 100644
--- a/libs/hwui/LayerRenderer.cpp
+++ b/libs/hwui/LayerRenderer.cpp
@@ -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);