diff options
author | Mathias Agopian <mathias@google.com> | 2013-08-01 15:48:40 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2013-08-01 15:48:40 -0700 |
commit | ba93b3f8e403636b614a4a379f9421bc70dca84f (patch) | |
tree | 4df2e51cd7003803a8f7d75f1fa5896493c9da4a /libs | |
parent | 87f9b877964b7d7db9b59ba45b73b4b1a779ecf8 (diff) | |
download | frameworks_native-ba93b3f8e403636b614a4a379f9421bc70dca84f.zip frameworks_native-ba93b3f8e403636b614a4a379f9421bc70dca84f.tar.gz frameworks_native-ba93b3f8e403636b614a4a379f9421bc70dca84f.tar.bz2 |
log an error when dequeueBuffer gets a NULL Fence
Bug: 9858745
Change-Id: If35d6a7d770bf0a42d55bc55880a9ddb721fcfd0
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/BufferQueue.cpp | 13 | ||||
-rw-r--r-- | libs/gui/IGraphicBufferProducer.cpp | 11 | ||||
-rw-r--r-- | libs/gui/Surface.cpp | 10 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 2 |
4 files changed, 20 insertions, 16 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp index 45488ff..e20ac86 100644 --- a/libs/gui/BufferQueue.cpp +++ b/libs/gui/BufferQueue.cpp @@ -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; } diff --git a/libs/gui/IGraphicBufferProducer.cpp b/libs/gui/IGraphicBufferProducer.cpp index 48b2870..e3d2a20 100644 --- a/libs/gui/IGraphicBufferProducer.cpp +++ b/libs/gui/IGraphicBufferProducer.cpp @@ -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; 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 @@ 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; } } diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 94f21b6..bad4138 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -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) { |