diff options
| author | Conley Owens <cco3@android.com> | 2011-04-27 12:28:05 -0700 |
|---|---|---|
| committer | Android Code Review <code-review@android.com> | 2011-04-27 12:28:05 -0700 |
| commit | 86d1d74762e65b6f64c2d4758aa5fd4af6275696 (patch) | |
| tree | 9aa44e1a21fc0e6c52aed97f57d50ac0e23d6638 | |
| parent | 44935c2908b644576b37bd84623461f0eb6ef106 (diff) | |
| parent | 8ecc90d00df9ca90dfbf505daa051eb2a05a14de (diff) | |
| download | frameworks_base-86d1d74762e65b6f64c2d4758aa5fd4af6275696.zip frameworks_base-86d1d74762e65b6f64c2d4758aa5fd4af6275696.tar.gz frameworks_base-86d1d74762e65b6f64c2d4758aa5fd4af6275696.tar.bz2 | |
Merge "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 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) { |
