From 0059724cf8d83b018be2b55dc400166fe86e2af4 Mon Sep 17 00:00:00 2001 From: Marissa Wall Date: Wed, 27 Mar 2019 10:35:19 -0700 Subject: blast: fix caching crash Trying to cache a null buffer causes a crash. We shouldn't try to cache them at all because they take up room in the cache and don't have any peformance benefits. This patch adds support to just send null buffers instead of caching them. Bug: 129357029 Test: run Chrome, put it in the background and monitor the logs Change-Id: I6dc026b5bc8b860a04bef1284c1a7adb4f1c96f3 --- libs/gui/SurfaceComposerClient.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 39cd62fa10..7aef476f4a 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -406,6 +406,12 @@ void SurfaceComposerClient::Transaction::cacheBuffers() { continue; } + // Don't try to cache a null buffer. Sending null buffers is cheap so we shouldn't waste + // time trying to cache them. + if (!s->buffer) { + continue; + } + uint64_t cacheId = 0; status_t ret = BufferCache::getInstance().getCacheId(s->buffer, &cacheId); if (ret == NO_ERROR) { -- cgit v1.2.3-59-g8ed1b