summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2016-08-31 17:32:46 -0700
committerChris Craik <ccraik@google.com>2016-08-31 17:32:47 -0700
commit06e2e9cf4c3fe1eaac3271c9a346d5cc7fe5c3a8 (patch)
treed6eb5230e13665a9bba1fc7b0b5c48f01292c5c5 /libs
parentc6c45d225cba9ecc4521de61c3af49cc038d685a (diff)
downloadandroid-frameworks-base-06e2e9cf4c3fe1eaac3271c9a346d5cc7fe5c3a8.tar.gz
android-frameworks-base-06e2e9cf4c3fe1eaac3271c9a346d5cc7fe5c3a8.tar.xz
Wait on frame work fences when frames are dropped
bug:30895941 Prevents a race where frame work could interleave between frames, causing SurfaceView position updates to be delivered out of order. Change-Id: I01e4cc557b69dcf33e877a0e16c0d115ec95e4cc
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp3
-rw-r--r--libs/hwui/renderthread/CanvasContext.h4
-rw-r--r--libs/hwui/renderthread/DrawFrameTask.cpp3
3 files changed, 8 insertions, 2 deletions
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index dcaec42..70b9a43 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -633,6 +633,9 @@ void CanvasContext::prepareAndDraw(RenderNode* node) {
prepareTree(info, frameInfo, systemTime(CLOCK_MONOTONIC), node);
if (info.out.canDrawThisFrame) {
draw();
+ } else {
+ // wait on fences so tasks don't overlap next frame
+ waitOnFences();
}
}
diff --git a/libs/hwui/renderthread/CanvasContext.h b/libs/hwui/renderthread/CanvasContext.h
index 3eef29b..e182175 100644
--- a/libs/hwui/renderthread/CanvasContext.h
+++ b/libs/hwui/renderthread/CanvasContext.h
@@ -168,6 +168,8 @@ public:
ANDROID_API int64_t getFrameNumber();
+ void waitOnFences();
+
private:
friend class RegisterFrameCallbackTask;
// TODO: Replace with something better for layer & other GL object
@@ -178,8 +180,6 @@ private:
void freePrefetchedLayers(TreeObserver* observer);
- void waitOnFences();
-
bool isSwapChainStuffed();
EGLint mLastFrameWidth = 0;
diff --git a/libs/hwui/renderthread/DrawFrameTask.cpp b/libs/hwui/renderthread/DrawFrameTask.cpp
index c9c07b3..e3b6dc6 100644
--- a/libs/hwui/renderthread/DrawFrameTask.cpp
+++ b/libs/hwui/renderthread/DrawFrameTask.cpp
@@ -104,6 +104,9 @@ void DrawFrameTask::run() {
if (CC_LIKELY(canDrawThisFrame)) {
context->draw();
+ } else {
+ // wait on fences so tasks don't overlap next frame
+ context->waitOnFences();
}
if (!canUnblockUiThread) {