OSDN Git Service

don't emit GL commands when sf is in freeze mode
authorMathias Agopian <mathias@google.com>
Mon, 28 Sep 2009 05:47:27 +0000 (22:47 -0700)
committerMathias Agopian <mathias@google.com>
Mon, 28 Sep 2009 05:47:32 +0000 (22:47 -0700)
We were emitting GL commands, calling composition complete and releasing clients
without ever calling eglSwapBuffers(), which is completely wrong on non-direct
renders. This could cause transient drawing artifacts when unfreezing the
screen (upon orientaion change for instance) and could also block the clients
for ever as they are waiting for their previous buffer to be rendered.

libs/surfaceflinger/SurfaceFlinger.cpp

index 065425d..4ee176c 100644 (file)
@@ -491,7 +491,7 @@ bool SurfaceFlinger::threadLoop()
     handlePageFlip();
 
     const DisplayHardware& hw(graphicPlane(0).displayHardware());
-    if (LIKELY(hw.canDraw())) {
+    if (LIKELY(hw.canDraw() && !isFrozen())) {
         // repaint the framebuffer (if needed)
         handleRepaint();
 
@@ -512,14 +512,6 @@ bool SurfaceFlinger::threadLoop()
 
 void SurfaceFlinger::postFramebuffer()
 {
-    if (isFrozen()) {
-        // we are not allowed to draw, but pause a bit to make sure
-        // apps don't end up using the whole CPU, if they depend on
-        // surfaceflinger for synchronization.
-        usleep(8333); // 8.3ms ~ 120fps
-        return;
-    }
-
     if (!mInvalidRegion.isEmpty()) {
         const DisplayHardware& hw(graphicPlane(0).displayHardware());
         const nsecs_t now = systemTime();