log an error when dequeueBuffer gets a NULL Fence
Bug: 9858745
Change-Id: If35d6a7d770bf0a42d55bc55880a9ddb721fcfd0
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 998ea8a..fdb7d3d 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -175,8 +175,7 @@
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 @@
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 @@
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;
}
}