File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -874,8 +874,16 @@ status_t Layer::BufferManager::initEglImage(EGLDisplay dpy,
874874 ssize_t index = mActiveBuffer ;
875875 if (index >= 0 ) {
876876 if (!mFailover ) {
877- Image& texture (mBufferData [index].texture );
878- err = mTextureManager .initEglImage (&texture, dpy, buffer);
877+ {
878+ // Without that lock, there is a chance of race condition
879+ // where while composing a specific index, requestBuf
880+ // with the same index can be executed and touch the same data
881+ // that is being used in initEglImage.
882+ // (e.g. dirty flag in texture)
883+ Mutex::Autolock _l (mLock );
884+ Image& texture (mBufferData [index].texture );
885+ err = mTextureManager .initEglImage (&texture, dpy, buffer);
886+ }
879887 // if EGLImage fails, we switch to regular texture mode, and we
880888 // free all resources associated with using EGLImages.
881889 if (err == NO_ERROR) {
You can’t perform that action at this time.
0 commit comments