SurfaceTexture: fix a bug with buffer reallocation
This change fixes an issue involving buffer reallocation and the ALLOW_DEQUEUE_CURRENT_BUFFER mode in SurfaceTexture. The bug happened when the buffer slot currently attached to the GL texture was selected for dequeuing, but the dequeue operation caused the buffer to be reallocated. Because the buffer is new, the image producer could fill the buffer and queue it before an updateTexImage call, which would result in the "slot %d is current" error in queueBuffer. Bug: 5631630 Change-Id: Icdd8bc5cad3c7db43953446d9be2603aaea11a8d
This commit is contained in:
parent
6a6ff2015d
commit
aaa3ecff4b
@ -434,6 +434,11 @@ status_t SurfaceTexture::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h,
|
||||
mSlots[buf].mEglImage = EGL_NO_IMAGE_KHR;
|
||||
mSlots[buf].mEglDisplay = EGL_NO_DISPLAY;
|
||||
}
|
||||
if (mCurrentTexture == buf) {
|
||||
// The current texture no longer references the buffer in this slot
|
||||
// since we just allocated a new buffer.
|
||||
mCurrentTexture = INVALID_BUFFER_SLOT;
|
||||
}
|
||||
returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION;
|
||||
}
|
||||
ST_LOGV("dequeueBuffer: returning slot=%d buf=%p flags=%#x", buf,
|
||||
|
Loading…
Reference in New Issue
Block a user