Merge "gui: Surface::dequeueBuffer no locker holds mutex while blocking in binder"
This commit is contained in:
commit
c0308d7600
@ -178,19 +178,38 @@ int Surface::setSwapInterval(int interval) {
|
||||
int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) {
|
||||
ATRACE_CALL();
|
||||
ALOGV("Surface::dequeueBuffer");
|
||||
|
||||
int reqW;
|
||||
int reqH;
|
||||
bool swapIntervalZero;
|
||||
uint32_t reqFormat;
|
||||
uint32_t reqUsage;
|
||||
|
||||
{
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
reqW = mReqWidth ? mReqWidth : mUserWidth;
|
||||
reqH = mReqHeight ? mReqHeight : mUserHeight;
|
||||
|
||||
swapIntervalZero = mSwapIntervalZero;
|
||||
reqFormat = mReqFormat;
|
||||
reqUsage = mReqUsage;
|
||||
} // Drop the lock so that we can still touch the Surface while blocking in IGBP::dequeueBuffer
|
||||
|
||||
int buf = -1;
|
||||
int reqW = mReqWidth ? mReqWidth : mUserWidth;
|
||||
int reqH = mReqHeight ? mReqHeight : mUserHeight;
|
||||
sp<Fence> fence;
|
||||
status_t result = mGraphicBufferProducer->dequeueBuffer(&buf, &fence, mSwapIntervalZero,
|
||||
reqW, reqH, mReqFormat, mReqUsage);
|
||||
status_t result = mGraphicBufferProducer->dequeueBuffer(&buf, &fence, swapIntervalZero,
|
||||
reqW, reqH, reqFormat, reqUsage);
|
||||
|
||||
if (result < 0) {
|
||||
ALOGV("dequeueBuffer: IGraphicBufferProducer::dequeueBuffer(%d, %d, %d, %d)"
|
||||
"failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage,
|
||||
ALOGV("dequeueBuffer: IGraphicBufferProducer::dequeueBuffer(%d, %d, %d, %d, %d)"
|
||||
"failed: %d", swapIntervalZero, reqW, reqH, reqFormat, reqUsage,
|
||||
result);
|
||||
return result;
|
||||
}
|
||||
|
||||
Mutex::Autolock lock(mMutex);
|
||||
|
||||
sp<GraphicBuffer>& gbuf(mSlots[buf].buffer);
|
||||
|
||||
// this should never happen
|
||||
|
Loading…
Reference in New Issue
Block a user