diff options
author | Mathias Agopian <mathias@google.com> | 2011-05-19 15:38:14 -0700 |
---|---|---|
committer | Mathias Agopian <mathias@google.com> | 2011-05-19 19:40:02 -0700 |
commit | ca4d3602c07837d0b2ac6878685a8e327b5f30f0 (patch) | |
tree | b4c46c6f136284af91f3d5629b6342c9dcbcf814 /services/surfaceflinger/SurfaceFlinger.h | |
parent | 20aeb1caa4e2232153d3a59923722c19a3563a78 (diff) | |
download | frameworks_native-ca4d3602c07837d0b2ac6878685a8e327b5f30f0.zip frameworks_native-ca4d3602c07837d0b2ac6878685a8e327b5f30f0.tar.gz frameworks_native-ca4d3602c07837d0b2ac6878685a8e327b5f30f0.tar.bz2 |
Fix a race that could cause GL commands to be executed from the wrong thread.
Change-Id: Ia3d407f7bf2f5553f46cfdade70b7b0badb35beb
Diffstat (limited to 'services/surfaceflinger/SurfaceFlinger.h')
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 1e16943..992861a 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -227,6 +227,7 @@ public: status_t addLayer(const sp<LayerBase>& layer); status_t invalidateLayerVisibility(const sp<LayerBase>& layer); void invalidateHwcGeometry(); + void destroyLayer(LayerBase const* layer); sp<Layer> getLayer(const sp<ISurface>& sur) const; @@ -255,7 +256,7 @@ private: uint32_t w, uint32_t h, uint32_t flags); status_t removeSurface(const sp<Client>& client, SurfaceID sid); - status_t destroySurface(const sp<LayerBaseClient>& layer); + status_t destroySurface(const wp<LayerBaseClient>& layer); status_t setClientState(const sp<Client>& client, int32_t count, const layer_state_t* states); @@ -300,9 +301,8 @@ public: // hack to work around gcc 4.0.3 bug private: void handleConsoleEvents(); void handleTransaction(uint32_t transactionFlags); - void handleTransactionLocked( - uint32_t transactionFlags, - Vector< sp<LayerBase> >& ditchedLayers); + void handleTransactionLocked(uint32_t transactionFlags); + void handleDestroyLayers(); void computeVisibleRegions( const LayerVector& currentLayers, @@ -424,6 +424,11 @@ private: // these are thread safe mutable Barrier mReadyToRunBarrier; + + // protected by mDestroyedLayerLock; + mutable Mutex mDestroyedLayerLock; + Vector<LayerBase const *> mDestroyedLayers; + // atomic variables enum { eConsoleReleased = 1, |