diff options
author | Conley Owens <cco3@android.com> | 2011-04-27 12:43:19 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-04-27 12:43:19 -0700 |
commit | a97b487178fe5acafe0281e4cc61827945b3711b (patch) | |
tree | e6d1cf58d5db46b75cb8e9c7a600a9684e919501 /services/surfaceflinger | |
parent | ff13c6559c9cffe944ce52629c29fe3bf82a67cd (diff) | |
parent | 4dc780e366cecbea1bbee95193be4f30635b2727 (diff) | |
download | frameworks_native-a97b487178fe5acafe0281e4cc61827945b3711b.zip frameworks_native-a97b487178fe5acafe0281e4cc61827945b3711b.tar.gz frameworks_native-a97b487178fe5acafe0281e4cc61827945b3711b.tar.bz2 |
am 86d1d747: Merge "Add lock before calling initEglImage"
* commit '86d1d74762e65b6f64c2d4758aa5fd4af6275696':
Add lock before calling initEglImage
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index c9dcef3..dfee803 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -874,8 +874,16 @@ status_t Layer::BufferManager::initEglImage(EGLDisplay dpy, ssize_t index = mActiveBuffer; if (index >= 0) { if (!mFailover) { - Image& texture(mBufferData[index].texture); - err = mTextureManager.initEglImage(&texture, dpy, buffer); + { + // Without that lock, there is a chance of race condition + // where while composing a specific index, requestBuf + // with the same index can be executed and touch the same data + // that is being used in initEglImage. + // (e.g. dirty flag in texture) + Mutex::Autolock _l(mLock); + Image& texture(mBufferData[index].texture); + err = mTextureManager.initEglImage(&texture, dpy, buffer); + } // if EGLImage fails, we switch to regular texture mode, and we // free all resources associated with using EGLImages. if (err == NO_ERROR) { |