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
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index 39cd62f..7aef476 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -406,6 +406,12 @@
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) {