summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2011-04-26 18:05:23 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-04-26 18:05:23 -0700
commitfaee9c397d7f277031c3bf5578fd72d9208705d1 (patch)
treee3d876c214b0b6cf5e72d7edab048ddd78bcb0c2
parent93970c30e3cd6a76547df7bbfb497c9997475658 (diff)
parent6fad64c747040e6abcc6a57b99e5ba9293ee4d99 (diff)
downloadframeworks_base-faee9c397d7f277031c3bf5578fd72d9208705d1.zip
frameworks_base-faee9c397d7f277031c3bf5578fd72d9208705d1.tar.gz
frameworks_base-faee9c397d7f277031c3bf5578fd72d9208705d1.tar.bz2
Merge "Report errors when eglCreateImageKHR fails"
-rw-r--r--libs/gui/SurfaceTexture.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/libs/gui/SurfaceTexture.cpp b/libs/gui/SurfaceTexture.cpp
index 39418f0..15a176e 100644
--- a/libs/gui/SurfaceTexture.cpp
+++ b/libs/gui/SurfaceTexture.cpp
@@ -274,10 +274,14 @@ status_t SurfaceTexture::updateTexImage() {
EGLImageKHR image = mSlots[mLastQueued].mEglImage;
if (image == EGL_NO_IMAGE_KHR) {
EGLDisplay dpy = eglGetCurrentDisplay();
- sp<GraphicBuffer> graphicBuffer = mSlots[mLastQueued].mGraphicBuffer;
- image = createImage(dpy, graphicBuffer);
+ image = createImage(dpy, mSlots[mLastQueued].mGraphicBuffer);
mSlots[mLastQueued].mEglImage = image;
mSlots[mLastQueued].mEglDisplay = dpy;
+ if (image == EGL_NO_IMAGE_KHR) {
+ // NOTE: if dpy was invalid, createImage() is guaranteed to
+ // fail. so we'd end up here.
+ return -EINVAL;
+ }
}
GLint error;
@@ -483,12 +487,9 @@ EGLImageKHR SurfaceTexture::createImage(EGLDisplay dpy,
};
EGLImageKHR image = eglCreateImageKHR(dpy, EGL_NO_CONTEXT,
EGL_NATIVE_BUFFER_ANDROID, cbuf, attrs);
- EGLint error = eglGetError();
- if (error != EGL_SUCCESS) {
+ if (image == EGL_NO_IMAGE_KHR) {
+ EGLint error = eglGetError();
LOGE("error creating EGLImage: %#x", error);
- } else if (image == EGL_NO_IMAGE_KHR) {
- LOGE("no error reported, but no image was returned by "
- "eglCreateImageKHR");
}
return image;
}