log an error when dequeueBuffer gets a NULL Fence
Bug: 9858745 Change-Id: If35d6a7d770bf0a42d55bc55880a9ddb721fcfd0
This commit is contained in:
parent
87f9b87796
commit
ba93b3f8e4
@ -406,6 +406,13 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool async
|
||||
returnFlags |= IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION;
|
||||
}
|
||||
|
||||
|
||||
if (CC_UNLIKELY(mSlots[buf].mFence == NULL)) {
|
||||
ST_LOGE("dequeueBuffer: about to return a NULL fence from mSlot. "
|
||||
"buf=%d, w=%d, h=%d, format=%d",
|
||||
buf, buffer->width, buffer->height, buffer->format);
|
||||
}
|
||||
|
||||
dpy = mSlots[buf].mEglDisplay;
|
||||
eglFence = mSlots[buf].mEglFence;
|
||||
*outFence = mSlots[buf].mFence;
|
||||
@ -416,11 +423,9 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>* outFence, bool async
|
||||
if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) {
|
||||
status_t error;
|
||||
sp<GraphicBuffer> graphicBuffer(
|
||||
mGraphicBufferAlloc->createGraphicBuffer(
|
||||
w, h, format, usage, &error));
|
||||
mGraphicBufferAlloc->createGraphicBuffer(w, h, format, usage, &error));
|
||||
if (graphicBuffer == 0) {
|
||||
ST_LOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer "
|
||||
"failed");
|
||||
ST_LOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer failed");
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -94,13 +94,10 @@ public:
|
||||
return result;
|
||||
}
|
||||
*buf = reply.readInt32();
|
||||
bool fenceWasWritten = reply.readInt32();
|
||||
if (fenceWasWritten) {
|
||||
// If the fence was written by the callee, then overwrite the
|
||||
// caller's fence here. If it wasn't written then don't touch the
|
||||
// caller's fence.
|
||||
bool nonNull = reply.readInt32();
|
||||
if (nonNull) {
|
||||
*fence = new Fence();
|
||||
reply.read(*(fence->get()));
|
||||
reply.read(**fence);
|
||||
}
|
||||
result = reply.readInt32();
|
||||
return result;
|
||||
@ -209,7 +206,7 @@ status_t BnGraphicBufferProducer::onTransact(
|
||||
reply->writeInt32(buf);
|
||||
reply->writeInt32(fence != NULL);
|
||||
if (fence != NULL) {
|
||||
reply->write(*fence.get());
|
||||
reply->write(*fence);
|
||||
}
|
||||
reply->writeInt32(result);
|
||||
return NO_ERROR;
|
||||
|
@ -175,8 +175,7 @@ int Surface::setSwapInterval(int interval) {
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int Surface::dequeueBuffer(android_native_buffer_t** buffer,
|
||||
int* fenceFd) {
|
||||
int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) {
|
||||
ATRACE_CALL();
|
||||
ALOGV("Surface::dequeueBuffer");
|
||||
Mutex::Autolock lock(mMutex);
|
||||
@ -193,6 +192,10 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer,
|
||||
return result;
|
||||
}
|
||||
sp<GraphicBuffer>& gbuf(mSlots[buf].buffer);
|
||||
|
||||
// this should never happen
|
||||
ALOGE_IF(fence == NULL, "Surface::dequeueBuffer: received null Fence! buf=%d", buf);
|
||||
|
||||
if (result & IGraphicBufferProducer::RELEASE_ALL_BUFFERS) {
|
||||
freeAllBuffers();
|
||||
}
|
||||
@ -200,8 +203,7 @@ int Surface::dequeueBuffer(android_native_buffer_t** buffer,
|
||||
if ((result & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) {
|
||||
result = mGraphicBufferProducer->requestBuffer(buf, &gbuf);
|
||||
if (result != NO_ERROR) {
|
||||
ALOGE("dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d",
|
||||
result);
|
||||
ALOGE("dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d", result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
@ -653,7 +653,7 @@ status_t ScreenshotClient::update(const sp<IBinder>& display,
|
||||
mHaveBuffer = false;
|
||||
}
|
||||
|
||||
status_t err = s->captureScreen(display,cpuConsumer->getBufferQueue(),
|
||||
status_t err = s->captureScreen(display, cpuConsumer->getBufferQueue(),
|
||||
reqWidth, reqHeight, minLayerZ, maxLayerZ, true);
|
||||
|
||||
if (err == NO_ERROR) {
|
||||
|
Loading…
Reference in New Issue
Block a user