Add lock before calling initEglImage
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)
This commit is contained in:
parent
d59b5d0087
commit
0d11baf889
@ -874,8 +874,16 @@ status_t Layer::BufferManager::initEglImage(EGLDisplay dpy,
|
|||||||
ssize_t index = mActiveBuffer;
|
ssize_t index = mActiveBuffer;
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
if (!mFailover) {
|
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
|
// if EGLImage fails, we switch to regular texture mode, and we
|
||||||
// free all resources associated with using EGLImages.
|
// free all resources associated with using EGLImages.
|
||||||
if (err == NO_ERROR) {
|
if (err == NO_ERROR) {
|
||||||
|
Loading…
Reference in New Issue
Block a user