Bug 239488 - REGRESSION(r292803) WinCairo GPU process significant performance drop
Summary: REGRESSION(r292803) WinCairo GPU process significant performance drop
Status: RESOLVED DUPLICATE of bug 239399
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Fujii Hironori
URL:
Keywords:
Depends on: 239494
Blocks:
  Show dependency treegraph
 
Reported: 2022-04-19 00:55 PDT by Fujii Hironori
Modified: 2022-04-21 02:43 PDT (History)
1 user (show)

See Also:


Attachments
WIP patch (1021 bytes, patch)
2022-04-20 21:27 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Patch (1.89 KB, patch)
2022-04-20 22:46 PDT, Fujii Hironori
kkinnunen: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Fujii Hironori 2022-04-19 00:55:40 PDT
WinCairo WebKit2 significant performance regression

1. Start WinCairo WebKit2 MiniBrowser
2. Browsing some web sites

Very slow.

r292784 Good
r292803 Bad
Comment 1 Fujii Hironori 2022-04-19 13:22:16 PDT
r292803 caused this bug.
Bug 238516 – RemoteRenderingBackend should have dedicated IPC::Connection for out-of-stream messages

Disabling GPU process doesn't seem to work around this issue.

> reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /t REG_DWORD /d 0 /f
> reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_webgl /t REG_DWORD /d 0 /f
Comment 2 Fujii Hironori 2022-04-19 14:04:46 PDT
(In reply to Fujii Hironori from comment #1)
> Disabling GPU process doesn't seem to work around this issue.
> 
> > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_canvas_rendering /t REG_DWORD /d 0 /f
> > reg add HKEY_CURRENT_USER\Software\WebKit /v gpu_process_webgl /t REG_DWORD /d 0 /f

This was wrong. These flags were removed.
  Bug 238766 – Remove GPU process system feature flags

I think there is no good way to disable GPU process for WinCairo. I applied the following patch to disable GPU process, and confirmed it worked around the issue.

diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp
index 257a744f94c2..37daefef8ca3 100644
--- a/Source/WebKit/UIProcess/WebPageProxy.cpp
+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp
@@ -8455,14 +8455,14 @@ WebPageCreationParameters WebPageProxy::creationParameters(WebProcessProxy& proc
     // FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
     parameters.shouldCaptureVideoInGPUProcess = preferences().captureVideoInGPUProcessEnabled();
     // FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
-    parameters.shouldRenderCanvasInGPUProcess = preferences().useGPUProcessForCanvasRenderingEnabled();
+    parameters.shouldRenderCanvasInGPUProcess = false;
     // FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
     parameters.shouldRenderDOMInGPUProcess = preferences().useGPUProcessForDOMRenderingEnabled();
     // FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
     parameters.shouldPlayMediaInGPUProcess = preferences().useGPUProcessForMediaEnabled();
 #if ENABLE(WEBGL)
     // FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
-    parameters.shouldRenderWebGLInGPUProcess = preferences().useGPUProcessForWebGLEnabled();
+    parameters.shouldRenderWebGLInGPUProcess = false;
 #endif
 
     // FIXME: This is also being passed over the to WebProcess via the PreferencesStore.
Comment 3 Fujii Hironori 2022-04-20 13:26:48 PDT
I don't know what is the trigger causes this performance drop.

1. Start WinCairo WK2 MiniBrowser
2. Go to https://webkit.org/
3. Scrolling the page is smooth
4. Go to https://www.reddit.com/
5. loading the page and scrolling the page is very slow
6. Push Back button to go to https://webkit.org/
7. loading the page and scrolling the page is very slow
Comment 4 Fujii Hironori 2022-04-20 18:47:16 PDT
If a page has a canvas element, WebPage::ensureRemoteRenderingBackendProxy creates m_remoteRenderingBackendProxy.

WebPage::finalizeRenderingUpdate calls m_remoteRenderingBackendProxy->finalizeRenderingUpdate() if m_remoteRenderingBackendProxy is available.

RemoteRenderingBackendProxy::finalizeRenderingUpdate sends a FinalizeRenderingUpdate stream message.

RemoteRenderingBackendProxy::streamConnection has 3 seconds tiemout.
This is causing the performance drop.
Comment 5 Fujii Hironori 2022-04-20 21:27:17 PDT
Created attachment 458039 [details]
WIP patch
Comment 6 Fujii Hironori 2022-04-20 21:30:58 PDT
RemoteRenderingBackendProxy::streamConnection waits for DidCreateWakeUpSemaphoreForDisplayListStream message for 3 seconds.
But, DidCreateWakeUpSemaphoreForDisplayListStream message doesn't come because the dedicated connection isn't opened in the server side.
Comment 7 Fujii Hironori 2022-04-20 22:46:46 PDT
Created attachment 458040 [details]
Patch
Comment 8 Kimmo Kinnunen 2022-04-20 22:52:14 PDT
Comment on attachment 458040 [details]
Patch

The issue that prompted this was fixed in bug 239399 
Note: WinCairo could start building and testing with ENABLE_IPC_TESTING, we're working on improving the test coverage of IPC
Comment 9 Fujii Hironori 2022-04-20 23:44:59 PDT
Oh, I didn't notice it. Thank you.

*** This bug has been marked as a duplicate of bug 239399 ***
Comment 10 Kimmo Kinnunen 2022-04-21 02:43:40 PDT
I think this is still a good fix, you may reconsider not duping but just landing the fix.