summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/SurfaceFlingerConsumer.cpp
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2015-04-28 14:42:06 -0700
committerDan Stoza <stoza@google.com>2015-05-01 12:23:44 -0700
commitecc504043fddb7a75042ce402c67aedfac04d5e2 (patch)
treeef6b8080362a8655a3291e5757dd72d202701898 /services/surfaceflinger/SurfaceFlingerConsumer.cpp
parent7b2fc930077b1e6ca5946cae6834902318209474 (diff)
downloadframeworks_native-ecc504043fddb7a75042ce402c67aedfac04d5e2.zip
frameworks_native-ecc504043fddb7a75042ce402c67aedfac04d5e2.tar.gz
frameworks_native-ecc504043fddb7a75042ce402c67aedfac04d5e2.tar.bz2
SurfaceFlinger: Fix PTS on stale buffers
SurfaceFlinger's (Layer's) shadow copy of the BufferQueue queue was getting out of sync for a few reasons. This change fixes these by doing the following: - Adds a check to re-synchronize the shadow copy every time we successfully acquire a buffer by first dropping stale buffers before removing the current buffer. - Avoids trying to perform updates for buffers which have been rejected (for incorrect dimensions) by SurfaceFlinger. - Adds IGraphicBufferConsumer::setShadowQueueSize, which allows the consumer to notify the BufferQueue that it is maintaining a shadow copy of the queue and prevents it from dropping so many buffers during acquireBuffer that it ends up returning a buffer for which the consumer has not yet received an onFrameAvailable call. Bug: 20096136 Change-Id: I78d0738428005fc19b3be85cc8f1db498043612f (cherry picked from commit 2e36f2283f48ab764b496490c73a132acf21df3a)
Diffstat (limited to 'services/surfaceflinger/SurfaceFlingerConsumer.cpp')
-rw-r--r--services/surfaceflinger/SurfaceFlingerConsumer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlingerConsumer.cpp b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
index 19c497a..a9a2958 100644
--- a/services/surfaceflinger/SurfaceFlingerConsumer.cpp
+++ b/services/surfaceflinger/SurfaceFlingerConsumer.cpp
@@ -74,7 +74,7 @@ status_t SurfaceFlingerConsumer::updateTexImage(BufferRejecter* rejecter,
int buf = item.mBuf;
if (rejecter && rejecter->reject(mSlots[buf].mGraphicBuffer, item)) {
releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer, EGL_NO_SYNC_KHR);
- return NO_ERROR;
+ return BUFFER_REJECTED;
}
// Release the previous buffer.
@@ -125,6 +125,10 @@ sp<NativeHandle> SurfaceFlingerConsumer::getSidebandStream() const {
return mConsumer->getSidebandStream();
}
+void SurfaceFlingerConsumer::setShadowQueueSize(size_t size) {
+ mConsumer->setShadowQueueSize(size);
+}
+
// We need to determine the time when a buffer acquired now will be
// displayed. This can be calculated:
// time when previous buffer's actual-present fence was signaled