summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Conley Owens <cco3@android.com> 2011-04-27 12:46:09 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2011-04-27 12:46:09 -0700
commitac505b86b45462d9883f9c36fad0ef85e0885ee4 (patch)
tree26cc066dda05de60f4d9da2f8c91509afae2d41d /services/surfaceflinger/Layer.cpp
parent470239a0904a439b0364ef2ae6d85e8811c90d36 (diff)
parentf0556bb90ff38be96c6099f5efafe386cd7f1083 (diff)
am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"
* commit 'f0556bb90ff38be96c6099f5efafe386cd7f1083': Add lock before calling initEglImage
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index c9dcef370a4d..dfee803bdc46 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) {