From 7013b6f31163d9850fffec36f9dfc1ea61877a42 Mon Sep 17 00:00:00 2001 From: Alec Mouri Date: Fri, 12 Feb 2021 11:16:54 -0800 Subject: Check status codes of GraphicBuffers on allocation We're getting reports of buffers transiently missing usage bits when allocated from SurfaceFlinger causing strange issues. Fatal logging when there is an allocation error will hopefully aid in triaging future bug reports. Bug: 157562905 Bug: 179786581 Test: build, boots Change-Id: I715295c0b6b3450e71181d93391dd99616f89d26 --- services/surfaceflinger/RegionSamplingThread.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'services/surfaceflinger/RegionSamplingThread.cpp') diff --git a/services/surfaceflinger/RegionSamplingThread.cpp b/services/surfaceflinger/RegionSamplingThread.cpp index 9186538c0a..09615f920d 100644 --- a/services/surfaceflinger/RegionSamplingThread.cpp +++ b/services/surfaceflinger/RegionSamplingThread.cpp @@ -447,6 +447,9 @@ void RegionSamplingThread::captureSample() { GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE; buffer = new GraphicBuffer(sampledBounds.getWidth(), sampledBounds.getHeight(), PIXEL_FORMAT_RGBA_8888, 1, usage, "RegionSamplingThread"); + const status_t bufferStatus = buffer->initCheck(); + LOG_ALWAYS_FATAL_IF(bufferStatus != OK, "captureSample: Buffer failed to allocate: %d", + bufferStatus); } const sp captureListener = new SyncScreenCaptureListener(); -- cgit v1.2.3-59-g8ed1b