summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnjaneya Prasad Musunuri <aprasad@codeaurora.org>2016-07-05 10:35:59 +0530
committerSteve Kondik <steve@cyngn.com>2016-08-03 14:19:04 -0700
commit52b8462635f1e807a88784634161f3b7598e1b7b (patch)
tree3ab660305dfb054d3d7f6416148b3f78878ce8cc
parent2ab013db02c930d38b4ac92beca0994ac7051c00 (diff)
downloadframeworks_native-52b8462635f1e807a88784634161f3b7598e1b7b.zip
frameworks_native-52b8462635f1e807a88784634161f3b7598e1b7b.tar.gz
frameworks_native-52b8462635f1e807a88784634161f3b7598e1b7b.tar.bz2
surfaceflinger: Add check for number of queued buffers
Pop buffer item from shadow queue only when number of queued buffer items is greater than zero. Change-Id: I039bc133842293c29e3e130efd65f521ef0049c6 CRs-Fixed: 1009466
-rw-r--r--services/surfaceflinger/Layer.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 3e932df..6a9cdb7 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1448,11 +1448,16 @@ Region Layer::latchBuffer(bool& recomputeVisibleRegions)
// Remove any stale buffers that have been dropped during
// updateTexImage
- while (mQueueItems[0].mFrameNumber != currentFrameNumber) {
+ while ((mQueuedFrames > 0) && (mQueueItems[0].mFrameNumber != currentFrameNumber)) {
mQueueItems.removeAt(0);
android_atomic_dec(&mQueuedFrames);
}
+ if (mQueuedFrames == 0) {
+ ALOGE("[%s] mQueuedFrames is zero !!", mName.string());
+ return outDirtyRegion;
+ }
+
mQueueItems.removeAt(0);
}