am ac505b86: am f0556bb9: am 86d1d747: Merge "Add lock before calling initEglImage"

* commit 'ac505b86b45462d9883f9c36fad0ef85e0885ee4':
  Add lock before calling initEglImage
This commit is contained in:
Conley Owens 2011-04-27 13:41:12 -07:00 committed by Android Git Automerger
commit ddc25bb92e
1 changed files with 10 additions and 2 deletions

View File

@ -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) {