@@ -445,6 +445,11 @@ bool SurfaceFlinger::threadLoop()
445445 // post surfaces (if needed)
446446 handlePageFlip ();
447447
448+ if (mDirtyRegion .isEmpty ()) {
449+ // nothing new to do.
450+ return true ;
451+ }
452+
448453 if (UNLIKELY (mHwWorkListDirty )) {
449454 // build the h/w work list
450455 handleWorkList ();
@@ -478,6 +483,9 @@ bool SurfaceFlinger::threadLoop()
478483
479484void SurfaceFlinger::postFramebuffer ()
480485{
486+ // this should never happen. we do the flip anyways so we don't
487+ // risk to cause a deadlock with hwc
488+ LOGW_IF (mSwapRegion .isEmpty (), " mSwapRegion is empty" );
481489 const DisplayHardware& hw (graphicPlane (0 ).displayHardware ());
482490 const nsecs_t now = systemTime ();
483491 mDebugInSwapBuffers = now;
@@ -938,7 +946,7 @@ void SurfaceFlinger::setupHardwareComposer(Region& dirtyInOut)
938946 // data.
939947 //
940948 // Also we want to make sure to not clear areas that belong to
941- // layers above that won't redraw (we would just erasing them),
949+ // layers above that won't redraw (we would just be erasing them),
942950 // that is, we can't erase anything outside the dirty region.
943951
944952 Region transparent;
@@ -1769,7 +1777,7 @@ status_t SurfaceFlinger::onTransact(
17691777void SurfaceFlinger::repaintEverything () {
17701778 Mutex::Autolock _l (mStateLock );
17711779 const DisplayHardware& hw (graphicPlane (0 ).displayHardware ());
1772- mDirtyRegion .set (hw.bounds ()); // careful that's not thread-safe
1780+ mDirtyRegion .set (hw.bounds ());
17731781 signalEvent ();
17741782}
17751783
0 commit comments