diff options
| author | Conley Owens <cco3@android.com> | 2011-04-27 13:54:08 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2011-04-27 13:54:08 -0700 |
| commit | b4a56f10d875dc62a9c73008f98596c7e32fc249 (patch) | |
| tree | 5258eff2bba73aad718a47790270671e511f5f44 | |
| parent | 36f873c765fee84ec26b0e21021ef4c6edc78123 (diff) | |
| parent | ba5aebd106c61567ad6be905efd18902025735aa (diff) | |
| download | frameworks_base-b4a56f10d875dc62a9c73008f98596c7e32fc249.zip frameworks_base-b4a56f10d875dc62a9c73008f98596c7e32fc249.tar.gz frameworks_base-b4a56f10d875dc62a9c73008f98596c7e32fc249.tar.bz2 | |
am ba5aebd1: am ac505b86: am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"
* commit 'ba5aebd106c61567ad6be905efd18902025735aa':
Add lock before calling initEglImage
| -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 c4027e0..b2f95cd 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -986,8 +986,16 @@ status_t Layer::BufferManager::initEglImage(EGLDisplay dpy, ssize_t index = mActiveBufferIndex; 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) { |
