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 @@ -788,6 +788,8 @@ void SurfaceFlinger::handlePageFlip()
788788 }
789789
790790 unlockPageFlip (currentLayers);
791+
792+ mDirtyRegion .orSelf (getAndClearInvalidateRegion ());
791793 mDirtyRegion .andSelf (screenRegion);
792794}
793795
@@ -1798,12 +1800,24 @@ status_t SurfaceFlinger::onTransact(
17981800}
17991801
18001802void SurfaceFlinger::repaintEverything () {
1801- Mutex::Autolock _l (mStateLock );
18021803 const DisplayHardware& hw (graphicPlane (0 ).displayHardware ());
1803- mDirtyRegion .set (hw.bounds ());
1804+ const Rect bounds (hw.getBounds ());
1805+ setInvalidateRegion (Region (bounds));
18041806 signalEvent ();
18051807}
18061808
1809+ void SurfaceFlinger::setInvalidateRegion (const Region& reg) {
1810+ Mutex::Autolock _l (mInvalidateLock );
1811+ mInvalidateRegion = reg;
1812+ }
1813+
1814+ Region SurfaceFlinger::getAndClearInvalidateRegion () {
1815+ Mutex::Autolock _l (mInvalidateLock );
1816+ Region reg (mInvalidateRegion );
1817+ mInvalidateRegion .clear ();
1818+ return reg;
1819+ }
1820+
18071821// ---------------------------------------------------------------------------
18081822
18091823status_t SurfaceFlinger::renderScreenToTexture (DisplayID dpy,
Original file line number Diff line number Diff line change @@ -308,6 +308,9 @@ class SurfaceFlinger :
308308 void composeSurfaces (const Region& dirty);
309309
310310
311+ void setInvalidateRegion (const Region& reg);
312+ Region getAndClearInvalidateRegion ();
313+
311314 ssize_t addClientLayer (const sp<Client>& client,
312315 const sp<LayerBaseClient>& lbc);
313316 status_t addLayer_l (const sp<LayerBase>& layer);
@@ -367,6 +370,10 @@ class SurfaceFlinger :
367370 bool mLayersRemoved ;
368371 DefaultKeyedVector< wp<IBinder>, wp<Layer> > mLayerMap ;
369372
373+ // access must be protected by mInvalidateLock
374+ mutable Mutex mInvalidateLock ;
375+ Region mInvalidateRegion ;
376+
370377 // constant members (no synchronization needed for access)
371378 sp<IMemoryHeap> mServerHeap ;
372379 surface_flinger_cblk_t * mServerCblk ;
You can’t perform that action at this time.
0 commit comments