diff --git a/core/jni/android_view_ThreadedRenderer.cpp b/core/jni/android_view_ThreadedRenderer.cpp index 192e3bb7028f0..8c28cc94880a2 100644 --- a/core/jni/android_view_ThreadedRenderer.cpp +++ b/core/jni/android_view_ThreadedRenderer.cpp @@ -877,7 +877,8 @@ static jobject android_view_ThreadedRenderer_createHardwareBitmapFromRenderNode( sp producer; sp rawConsumer; BufferQueue::createBufferQueue(&producer, &rawConsumer); - rawConsumer->setMaxBufferCount(1); + // We only need 1 buffer but some drivers have bugs so workaround it by setting max count to 2 + rawConsumer->setMaxBufferCount(2); sp consumer = new BufferItemConsumer(rawConsumer, GRALLOC_USAGE_HW_TEXTURE | GRALLOC_USAGE_SW_READ_NEVER | GRALLOC_USAGE_SW_WRITE_NEVER); consumer->setDefaultBufferSize(width, height); diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp index cbc5163244c18..9c80ab304b800 100644 --- a/libs/hwui/renderthread/CanvasContext.cpp +++ b/libs/hwui/renderthread/CanvasContext.cpp @@ -437,8 +437,8 @@ void CanvasContext::draw() { if (mNativeSurface.get()) { int durationUs; nsecs_t dequeueStart = mNativeSurface->getLastDequeueStartTime(); - if (dequeueStart < mCurrentFrameInfo->get(FrameInfoIndex::Vsync)) { - // Ignoring dequeue duration as it happened prior to vsync + if (dequeueStart < mCurrentFrameInfo->get(FrameInfoIndex::SyncStart)) { + // Ignoring dequeue duration as it happened prior to frame render start // and thus is not part of the frame. swap.dequeueDuration = 0; } else {