Title: [258899] trunk/Source/WebCore
- Revision
- 258899
- Author
- justin_...@apple.com
- Date
- 2020-03-23 19:38:39 -0700 (Mon, 23 Mar 2020)
Log Message
[ Mac wk2 Debug ] webgpu/whlsl/vector-compare.html is flaky crashing.
https://bugs.webkit.org/show_bug.cgi?id=209024
Reviewed by Myles C. Maxfield.
Prevent GPUBindGroup destructor from accidentally dereferencing GPUBindGroupAllocator too many times
if the owning GPUDevice has already been destroyed. A GPUBindGroupAllocator should reset whenever its
spawned GPUBindGroups are all cleaned up.
Covered by existing tests.
* platform/graphics/gpu/GPUBindGroupAllocator.h:
* platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm:
(WebCore::GPUBindGroupAllocator::allocateAndSetEncoders):
(WebCore::GPUBindGroupAllocator::tryReset):
* platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
(WebCore::GPUBindGroup::~GPUBindGroup):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (258898 => 258899)
--- trunk/Source/WebCore/ChangeLog 2020-03-24 02:22:49 UTC (rev 258898)
+++ trunk/Source/WebCore/ChangeLog 2020-03-24 02:38:39 UTC (rev 258899)
@@ -1,3 +1,23 @@
+2020-03-23 Justin Fan <justin_...@apple.com>
+
+ [ Mac wk2 Debug ] webgpu/whlsl/vector-compare.html is flaky crashing.
+ https://bugs.webkit.org/show_bug.cgi?id=209024
+
+ Reviewed by Myles C. Maxfield.
+
+ Prevent GPUBindGroup destructor from accidentally dereferencing GPUBindGroupAllocator too many times
+ if the owning GPUDevice has already been destroyed. A GPUBindGroupAllocator should reset whenever its
+ spawned GPUBindGroups are all cleaned up.
+
+ Covered by existing tests.
+
+ * platform/graphics/gpu/GPUBindGroupAllocator.h:
+ * platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm:
+ (WebCore::GPUBindGroupAllocator::allocateAndSetEncoders):
+ (WebCore::GPUBindGroupAllocator::tryReset):
+ * platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm:
+ (WebCore::GPUBindGroup::~GPUBindGroup):
+
2020-03-23 Wenson Hsieh <wenson_hs...@apple.com>
Remove the unused method PasteboardStrategy::uniqueName()
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupAllocator.h (258898 => 258899)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupAllocator.h 2020-03-24 02:22:49 UTC (rev 258898)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUBindGroupAllocator.h 2020-03-24 02:38:39 UTC (rev 258899)
@@ -69,6 +69,7 @@
#endif
Ref<GPUErrorScopes> m_errorScopes;
+ int m_numBindGroups { 0 };
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm (258898 => 258899)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm 2020-03-24 02:22:49 UTC (rev 258898)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupAllocatorMetal.mm 2020-03-24 02:38:39 UTC (rev 258899)
@@ -116,6 +116,7 @@
END_BLOCK_OBJC_EXCEPTIONS;
m_lastOffset = newOffset;
+ ++m_numBindGroups;
return offsets;
}
@@ -153,11 +154,14 @@
void GPUBindGroupAllocator::tryReset()
{
- if (!hasOneRef())
- return;
+ --m_numBindGroups;
+
+ ASSERT(m_numBindGroups > -1);
- m_argumentBuffer = nullptr;
- m_lastOffset = 0;
+ if (!m_numBindGroups) {
+ m_argumentBuffer = nullptr;
+ m_lastOffset = 0;
+ }
}
#endif // USE(METAL)
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm (258898 => 258899)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm 2020-03-24 02:22:49 UTC (rev 258898)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUBindGroupMetal.mm 2020-03-24 02:38:39 UTC (rev 258899)
@@ -239,9 +239,7 @@
GPUBindGroup::~GPUBindGroup()
{
- GPUBindGroupAllocator& rawAllocator = m_allocator.leakRef();
- rawAllocator.deref();
- rawAllocator.tryReset();
+ m_allocator->tryReset();
}
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes