Skip to content
Permalink
Browse files
REGRESSION(r271929): MobileSafari hangs upon launch due to a trivial …
…deadlock in IOSurfacePool::setPoolSize

https://bugs.webkit.org/show_bug.cgi?id=221027

Reviewed by Tim Horton.

Avoid the deadlock by not grabbing the lock in IOSurfacePool::evict when discarding all surfaces.
To do this, we extract the code in discardAllSurfaces as discardAllSurfacesInternal and use it in evict.

* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::IOSurfacePool::evict): Calls discardAllSurfacesInternal.
(WebCore::IOSurfacePool::discardAllSurfaces):
(WebCore::IOSurfacePool::discardAllSurfacesInternal): Extracted out of discardAllSurfaces.
* platform/graphics/cg/IOSurfacePool.h:


Canonical link: https://commits.webkit.org/233389@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271943 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
rniwa committed Jan 27, 2021
1 parent ebddfff commit 3800af32381c096d94c1df42db7ea9e42e1cccae
Showing 3 changed files with 24 additions and 1 deletion.
@@ -1,3 +1,19 @@
2021-01-27 Ryosuke Niwa <rniwa@webkit.org>

REGRESSION(r271929): MobileSafari hangs upon launch due to a trivial deadlock in IOSurfacePool::setPoolSize
https://bugs.webkit.org/show_bug.cgi?id=221027

Reviewed by Tim Horton.

Avoid the deadlock by not grabbing the lock in IOSurfacePool::evict when discarding all surfaces.
To do this, we extract the code in discardAllSurfaces as discardAllSurfacesInternal and use it in evict.

* platform/graphics/cg/IOSurfacePool.cpp:
(WebCore::IOSurfacePool::evict): Calls discardAllSurfacesInternal.
(WebCore::IOSurfacePool::discardAllSurfaces):
(WebCore::IOSurfacePool::discardAllSurfacesInternal): Extracted out of discardAllSurfaces.
* platform/graphics/cg/IOSurfacePool.h:

2021-01-27 Imanol Fernandez <ifernandez@igalia.com>

Complete WebXRRigidTransform implementation
@@ -241,7 +241,7 @@ void IOSurfacePool::evict(size_t additionalSize)
DUMP_POOL_STATISTICS("before evict");

if (additionalSize >= m_maximumBytesCached) {
discardAllSurfaces();
discardAllSurfacesInternal();
DUMP_POOL_STATISTICS("after evict all");
return;
}
@@ -326,6 +326,11 @@ void IOSurfacePool::scheduleCollectionTimer()
void IOSurfacePool::discardAllSurfaces()
{
auto locker = holdLock(m_lock);
discardAllSurfacesInternal();
}

void IOSurfacePool::discardAllSurfacesInternal()
{
m_bytesCached = 0;
m_inUseBytesCached = 0;
m_surfaceDetails.clear();
@@ -97,6 +97,8 @@ class IOSurfacePool {

void platformGarbageCollectNow();

void discardAllSurfacesInternal();

void showPoolStatistics(const char*);

RunLoop::Timer<IOSurfacePool> m_collectionTimer;

0 comments on commit 3800af3

Please sign in to comment.