From ffc50c689fe8e577fd9ed1e6ecf828e27b4344e3 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Tue, 8 Jun 2021 14:24:06 -0400 Subject: [PATCH] Reset buffer tracking state in VulkanSurface. When we fail to create an SkSurface from a dequeued buffer we then call cancelBuffer on that buffer. However, we don't update our tracking to say the buffer is no longer dequeued with and doesn't own the fence any more. I don't think this is the main issue causing the crash in the attached bug because I don't think we're seeing the error in the logs for this chunk of code. However this possibly related issue was found while tracking down our use of the dequeue_fence fd. Test: manual building and running of phone Bug: 187240173 Change-Id: Icb4099eeea5be6aedd5376e07a6e3454f5d1d1e3 --- libs/hwui/renderthread/VulkanSurface.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/hwui/renderthread/VulkanSurface.cpp b/libs/hwui/renderthread/VulkanSurface.cpp index 01a2ec5116df7..fe9a30a598708 100644 --- a/libs/hwui/renderthread/VulkanSurface.cpp +++ b/libs/hwui/renderthread/VulkanSurface.cpp @@ -429,7 +429,9 @@ VulkanSurface::NativeBufferInfo* VulkanSurface::dequeueNativeBuffer() { kTopLeft_GrSurfaceOrigin, mWindowInfo.colorspace, nullptr); if (bufferInfo->skSurface.get() == nullptr) { ALOGE("SkSurface::MakeFromAHardwareBuffer failed"); - mNativeWindow->cancelBuffer(mNativeWindow.get(), buffer, fence_fd.release()); + mNativeWindow->cancelBuffer(mNativeWindow.get(), buffer, + mNativeBuffers[idx].dequeue_fence.release()); + mNativeBuffers[idx].dequeued = false; return nullptr; } }