Skip to content

Commit f761374

Browse files
pixelflingerAndroid (Google) Code Review
authored andcommitted
Merge "Don't call hwc set() if there is nothing new to do" into ics-mr0
2 parents 23bf250 + 0d0fba4 commit f761374

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

479484
void 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(
17691777
void 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

Comments
 (0)