summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2012-02-04 15:44:04 -0800
committer Mathias Agopian <mathias@google.com> 2012-02-04 15:44:04 -0800
commitb048cef231075a5e41d224b73fe11fec62f335b1 (patch)
tree14f8a8498a9456e5a52f336387fabf47f2143eab
parent2040427ec7612aae48d0c283abbc460e34dd0868 (diff)
fix UI freezes
In some situations SF would mark a window as "has a pending update" but would never process that update because the window is not visible (fully transparent, hidden by another window, etc...), this window would then be "stuck" until some other window updated. Change-Id: Ifa18a9aef3a53f2593b473556702688ae62d9503
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp39
1 files changed, 18 insertions, 21 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index ee37efb034..041d195c60 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -419,9 +419,7 @@ void SurfaceFlinger::onMessageReceived(int32_t what)
// post surfaces (if needed)
handlePageFlip();
- if (!mDirtyRegion.isEmpty()) {
- signalRefresh();
- }
+ signalRefresh();
} break;
case MessageQueue::REFRESH: {
@@ -430,33 +428,32 @@ void SurfaceFlinger::onMessageReceived(int32_t what)
const DisplayHardware& hw(graphicPlane(0).displayHardware());
handleRefresh();
- if (!mDirtyRegion.isEmpty()) {
- if (CC_UNLIKELY(mHwWorkListDirty)) {
- // build the h/w work list
- handleWorkList();
- }
- if (CC_LIKELY(hw.canDraw())) {
- // repaint the framebuffer (if needed)
- handleRepaint();
- // inform the h/w that we're done compositing
- hw.compositionComplete();
- postFramebuffer();
- } else {
- // pretend we did the post
- hw.compositionComplete();
- }
+ if (CC_UNLIKELY(mHwWorkListDirty)) {
+ // build the h/w work list
+ handleWorkList();
+ }
+ if (CC_LIKELY(hw.canDraw())) {
+ // repaint the framebuffer (if needed)
+ handleRepaint();
+ // inform the h/w that we're done compositing
+ hw.compositionComplete();
+ postFramebuffer();
} else {
+ // pretend we did the post
hw.compositionComplete();
}
+
} break;
}
}
void SurfaceFlinger::postFramebuffer()
{
- // this should never happen. we do the flip anyways so we don't
- // risk to cause a deadlock with hwc
- ALOGW_IF(mSwapRegion.isEmpty(), "mSwapRegion is empty");
+ // mSwapRegion can be empty here is some cases, for instance if a hidden
+ // or fully transparent window is updating.
+ // in that case, we need to flip anyways to not risk a deadlock with
+ // h/w composer.
+
const DisplayHardware& hw(graphicPlane(0).displayHardware());
const nsecs_t now = systemTime();
mDebugInSwapBuffers = now;