Skip to content

Commit 9ec98cd

Browse files
pixelflingerAndroid Git Automerger
authored andcommitted
am aa938c8: Merge "mDirtyRegion is single threaded, but could be accessed from a hwc thread" into ics-mr0
* commit 'aa938c8d9c0e71c9b556657cb33794210ce6ebf8': mDirtyRegion is single threaded, but could be accessed from a hwc thread
2 parents 1625b2a + aa938c8 commit 9ec98cd

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

services/surfaceflinger/SurfaceFlinger.cpp

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,8 @@ void SurfaceFlinger::handlePageFlip()
742742
}
743743

744744
unlockPageFlip(currentLayers);
745+
746+
mDirtyRegion.orSelf(getAndClearInvalidateRegion());
745747
mDirtyRegion.andSelf(screenRegion);
746748
}
747749

@@ -1716,12 +1718,24 @@ status_t SurfaceFlinger::onTransact(
17161718
}
17171719

17181720
void SurfaceFlinger::repaintEverything() {
1719-
Mutex::Autolock _l(mStateLock);
17201721
const DisplayHardware& hw(graphicPlane(0).displayHardware());
1721-
mDirtyRegion.set(hw.bounds());
1722+
const Rect bounds(hw.getBounds());
1723+
setInvalidateRegion(Region(bounds));
17221724
signalEvent();
17231725
}
17241726

1727+
void SurfaceFlinger::setInvalidateRegion(const Region& reg) {
1728+
Mutex::Autolock _l(mInvalidateLock);
1729+
mInvalidateRegion = reg;
1730+
}
1731+
1732+
Region SurfaceFlinger::getAndClearInvalidateRegion() {
1733+
Mutex::Autolock _l(mInvalidateLock);
1734+
Region reg(mInvalidateRegion);
1735+
mInvalidateRegion.clear();
1736+
return reg;
1737+
}
1738+
17251739
// ---------------------------------------------------------------------------
17261740

17271741
status_t SurfaceFlinger::renderScreenToTexture(DisplayID dpy,

services/surfaceflinger/SurfaceFlinger.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ class SurfaceFlinger :
303303
void composeSurfaces(const Region& dirty);
304304

305305

306+
void setInvalidateRegion(const Region& reg);
307+
Region getAndClearInvalidateRegion();
308+
306309
ssize_t addClientLayer(const sp<Client>& client,
307310
const sp<LayerBaseClient>& lbc);
308311
status_t addLayer_l(const sp<LayerBase>& layer);
@@ -348,6 +351,10 @@ class SurfaceFlinger :
348351
bool mLayersRemoved;
349352
DefaultKeyedVector< wp<IBinder>, wp<Layer> > mLayerMap;
350353

354+
// access must be protected by mInvalidateLock
355+
mutable Mutex mInvalidateLock;
356+
Region mInvalidateRegion;
357+
351358
// constant members (no synchronization needed for access)
352359
sp<IMemoryHeap> mServerHeap;
353360
surface_flinger_cblk_t* mServerCblk;

0 commit comments

Comments
 (0)