File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed
Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff 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
17181720void 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
17271741status_t SurfaceFlinger::renderScreenToTexture (DisplayID dpy,
Original file line number Diff line number Diff 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 ;
You can’t perform that action at this time.
0 commit comments