Title: [274982] trunk/Source/WebCore
- Revision
- 274982
- Author
- [email protected]
- Date
- 2021-03-24 16:02:31 -0700 (Wed, 24 Mar 2021)
Log Message
Preload graphics drivers on a background thread instead of the main thread
https://bugs.webkit.org/show_bug.cgi?id=223713
Reviewed by Simon Fraser.
Preload graphics drivers on a background thread instead of the main thread. We have evidence of prewarmGlobally() hanging
the main thread (rdar://75279383) so we should do pre-warming off the main thread whenever possible.
r265418 introduced this graphics loader preloading and an earlier version of this patch was simply calling MTLCopyAllDevices()
on a background queue. However, that patch was updated before landing to do the work on the main thread. I think we should go
back to the earlier iteration.
* page/ProcessWarming.cpp:
(WebCore::ProcessWarming::prewarmGlobally):
* platform/graphics/gpu/GPUDevice.h:
* platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
(WebCore::GPUDevice::prewarm):
* platform/graphics/gpu/dawn/GPUDeviceDawn.cpp:
(WebCore::GPUDevice::prewarm):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (274981 => 274982)
--- trunk/Source/WebCore/ChangeLog 2021-03-24 23:01:12 UTC (rev 274981)
+++ trunk/Source/WebCore/ChangeLog 2021-03-24 23:02:31 UTC (rev 274982)
@@ -1,3 +1,25 @@
+2021-03-24 Chris Dumez <[email protected]>
+
+ Preload graphics drivers on a background thread instead of the main thread
+ https://bugs.webkit.org/show_bug.cgi?id=223713
+
+ Reviewed by Simon Fraser.
+
+ Preload graphics drivers on a background thread instead of the main thread. We have evidence of prewarmGlobally() hanging
+ the main thread (rdar://75279383) so we should do pre-warming off the main thread whenever possible.
+
+ r265418 introduced this graphics loader preloading and an earlier version of this patch was simply calling MTLCopyAllDevices()
+ on a background queue. However, that patch was updated before landing to do the work on the main thread. I think we should go
+ back to the earlier iteration.
+
+ * page/ProcessWarming.cpp:
+ (WebCore::ProcessWarming::prewarmGlobally):
+ * platform/graphics/gpu/GPUDevice.h:
+ * platform/graphics/gpu/cocoa/GPUDeviceMetal.mm:
+ (WebCore::GPUDevice::prewarm):
+ * platform/graphics/gpu/dawn/GPUDeviceDawn.cpp:
+ (WebCore::GPUDevice::prewarm):
+
2021-03-24 Antoine Quint <[email protected]>
Fix interpolation of the border-spacing property
Modified: trunk/Source/WebCore/page/ProcessWarming.cpp (274981 => 274982)
--- trunk/Source/WebCore/page/ProcessWarming.cpp 2021-03-24 23:01:12 UTC (rev 274981)
+++ trunk/Source/WebCore/page/ProcessWarming.cpp 2021-03-24 23:02:31 UTC (rev 274982)
@@ -85,7 +85,7 @@
#endif
#if ENABLE(GPU_DRIVER_PREWARMING)
- GPUDevice::tryCreate(WTF::nullopt);
+ GPUDevice::prewarm();
#endif
}
Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h (274981 => 274982)
--- trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2021-03-24 23:01:12 UTC (rev 274981)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUDevice.h 2021-03-24 23:02:31 UTC (rev 274982)
@@ -70,6 +70,7 @@
class GPUDevice : public RefCounted<GPUDevice>, public CanMakeWeakPtr<GPUDevice> {
public:
static RefPtr<GPUDevice> tryCreate(const Optional<GPURequestAdapterOptions>&);
+ static void prewarm();
RefPtr<GPUBuffer> tryCreateBuffer(const GPUBufferDescriptor&, GPUBufferMappedOption, GPUErrorScopes&);
RefPtr<GPUTexture> tryCreateTexture(const GPUTextureDescriptor&) const;
Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm (274981 => 274982)
--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm 2021-03-24 23:01:12 UTC (rev 274981)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPUDeviceMetal.mm 2021-03-24 23:02:31 UTC (rev 274982)
@@ -42,6 +42,14 @@
return true;
}
+void GPUDevice::prewarm()
+{
+ // Call MTLCopyAllDevices() on a background thread to avoid hanging the main thread.
+ dispatch_async(dispatch_get_global_queue(0, 0), ^{
+ MTLCopyAllDevices();
+ });
+}
+
RefPtr<GPUDevice> GPUDevice::tryCreate(const Optional<GPURequestAdapterOptions>& options)
{
RetainPtr<MTLDevice> devicePtr;
Modified: trunk/Source/WebCore/platform/graphics/gpu/dawn/GPUDeviceDawn.cpp (274981 => 274982)
--- trunk/Source/WebCore/platform/graphics/gpu/dawn/GPUDeviceDawn.cpp 2021-03-24 23:01:12 UTC (rev 274981)
+++ trunk/Source/WebCore/platform/graphics/gpu/dawn/GPUDeviceDawn.cpp 2021-03-24 23:02:31 UTC (rev 274982)
@@ -35,6 +35,10 @@
return nullptr;
}
+void GPUDevice::prewarm()
+{
+}
+
GPUDevice::GPUDevice(PlatformDeviceSmartPtr&& device)
: m_platformDevice(WTFMove(device))
{
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes