summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorConley Owens <cco3@android.com>2011-04-27 13:41:12 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-04-27 13:41:12 -0700
commitba5aebd106c61567ad6be905efd18902025735aa (patch)
treeaf526858c576d9fb289a875a318057470761f19b /services
parentd84df05490e8b102e81cca848f65c174398be1b6 (diff)
parentac505b86b45462d9883f9c36fad0ef85e0885ee4 (diff)
downloadframeworks_base-ba5aebd106c61567ad6be905efd18902025735aa.zip
frameworks_base-ba5aebd106c61567ad6be905efd18902025735aa.tar.gz
frameworks_base-ba5aebd106c61567ad6be905efd18902025735aa.tar.bz2
am ac505b86: am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"
* commit 'ac505b86b45462d9883f9c36fad0ef85e0885ee4': Add lock before calling initEglImage
Diffstat (limited to 'services')
-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 517c335..99d904d 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -984,8 +984,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) {