RESOLVED FIXED Bug 220476
[GPUProcess] Move DOM / Canvas rendering off the main thread in the GPUProcess
https://bugs.webkit.org/show_bug.cgi?id=220476
Summary [GPUProcess] Move DOM / Canvas rendering off the main thread in the GPUProcess
Chris Dumez
Reported 2021-01-08 12:52:27 PST
Move DOM / Canvas rendering off the main thread in the GPUProcess. I am still waiting on A/B perf testing from the bots, but local testing seems to show this is likely perf-neutral: === * Rendering off the main thread: 146.87 +/- 9% 149.21 +/- 4% * Rendering on main thread: 148.29 +/- 2% 145.89 +/- 8% === The good news though is that this architecture would allow us to block the thread on a semaphore more aggressively when waiting for new DisplayList entries. We currently are not able to be as aggressive as we'd like because we'd block the main thread.
Attachments
Patch (24.83 KB, patch)
2021-01-08 13:00 PST, Chris Dumez
no flags
Patch (24.46 KB, patch)
2021-01-08 17:07 PST, Chris Dumez
no flags
Patch (34.70 KB, patch)
2021-01-11 17:28 PST, Chris Dumez
no flags
Patch (39.97 KB, patch)
2021-01-12 17:00 PST, Chris Dumez
no flags
Patch (40.16 KB, patch)
2021-01-12 22:12 PST, Chris Dumez
no flags
Patch (54.94 KB, patch)
2021-01-13 14:42 PST, Chris Dumez
no flags
Patch (54.58 KB, patch)
2021-01-13 14:54 PST, Chris Dumez
no flags
Patch (54.55 KB, patch)
2021-01-13 16:42 PST, Chris Dumez
no flags
Patch (54.08 KB, patch)
2021-01-15 13:06 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2021-01-08 13:00:44 PST
Simon Fraser (smfr)
Comment 2 2021-01-08 13:53:18 PST
Comment on attachment 417293 [details] Patch Does this move all ImageBuffer IPC receiving onto a single thread that's not the main thread?
Chris Dumez
Comment 3 2021-01-08 13:57:43 PST
(In reply to Simon Fraser (smfr) from comment #2) > Comment on attachment 417293 [details] > Patch > > Does this move all ImageBuffer IPC receiving onto a single thread that's not > the main thread? It moves all *RemoteRenderingBackend* IPC receiving to a *serial workqueue* that's not the main thread. This means all the following IPC messages: CreateImageBuffer(WebCore::FloatSize logicalSize, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, enum:uint8_t WebCore::PixelFormat pixelFormat, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) WakeUpAndApplyDisplayList(struct WebKit::GPUProcessWakeupMessageArguments arguments) GetImageData(enum:uint8_t WebCore::AlphaPremultiplication outputFormat, WebCore::IntRect srcRect, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) -> (IPC::ImageDataReference imageData) Synchronous GetDataURLForImageBuffer(String mimeType, Optional<double> quality, enum:uint8_t WebCore::PreserveResolution preserveResolution, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) -> (String urlString) Synchronous GetDataForImageBuffer(String mimeType, Optional<double> quality, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) -> (Vector<uint8_t> data) Synchronous GetBGRADataForImageBuffer(WebCore::RenderingResourceIdentifier renderingResourceIdentifier) -> (Vector<uint8_t> data) Synchronous CacheNativeImage(WebKit::ShareableBitmap::Handle handle, WebCore::RenderingResourceIdentifier renderingResourceIdentifier) CacheFont(IPC::FontReference font) DeleteAllFonts() DidCreateSharedDisplayListHandle(WebCore::DisplayList::ItemBufferIdentifier identifier, WebKit::SharedMemory::IPCHandle handle, WebCore::RenderingResourceIdentifier destinationBufferIdentifier) ReleaseRemoteResource(WebCore::RenderingResourceIdentifier renderingResourceIdentifier) I am not sure what you mean my ImageBuffer IPC. I don't know see a messages.in file corresponding to ImageBuffer specifically.
Tim Horton
Comment 4 2021-01-08 13:58:57 PST
RemoteRenderingBackend is the IPC proxy through which ImageBuffer work flows
Chris Dumez
Comment 5 2021-01-08 17:07:27 PST
Chris Dumez
Comment 6 2021-01-11 08:25:03 PST
A/B testing came back. The current iteration of the patch seems to be a close to 1% regression on MotionMark unfortunately.
Chris Dumez
Comment 7 2021-01-11 17:28:11 PST
Chris Dumez
Comment 8 2021-01-12 17:00:35 PST
Chris Dumez
Comment 9 2021-01-12 22:12:16 PST
Chris Dumez
Comment 10 2021-01-13 14:42:10 PST
Chris Dumez
Comment 11 2021-01-13 14:54:26 PST
Chris Dumez
Comment 12 2021-01-13 16:42:06 PST
Chris Dumez
Comment 13 2021-01-15 08:55:33 PST
Ping review?
Radar WebKit Bug Importer
Comment 14 2021-01-15 12:53:21 PST
EWS
Comment 15 2021-01-15 13:01:02 PST
Tools/Scripts/svn-apply failed to apply attachment 417581 [details] to trunk. Please resolve the conflicts and upload a new patch.
Chris Dumez
Comment 16 2021-01-15 13:06:37 PST
EWS
Comment 17 2021-01-15 13:51:57 PST
Committed r271533: <https://trac.webkit.org/changeset/271533> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417726 [details].
youenn fablet
Comment 18 2021-01-18 07:07:50 PST
With this patch, RemoteRenderingBackend::cacheNativeImage is called in a background thread. This can call ShareableBitmap::createGraphicsContext which has an assertion to be called in main thread. This reproduces for me by running webrtc/video.html with GPU process enabled in WTR/debug.
youenn fablet
Comment 19 2021-01-19 01:51:14 PST
(In reply to youenn fablet from comment #18) > With this patch, RemoteRenderingBackend::cacheNativeImage is called in a > background thread. This can call ShareableBitmap::createGraphicsContext > which has an assertion to be called in main thread. > This reproduces for me by running webrtc/video.html with GPU process enabled > in WTR/debug. https://build.webkit.org/results/Apple-Catalina-Debug-WK2-GPUProcess-Tests/r271596%20(5773)/results.html
Chris Dumez
Comment 20 2021-01-19 09:05:31 PST
(In reply to youenn fablet from comment #18) > With this patch, RemoteRenderingBackend::cacheNativeImage is called in a > background thread. This can call ShareableBitmap::createGraphicsContext > which has an assertion to be called in main thread. > This reproduces for me by running webrtc/video.html with GPU process enabled > in WTR/debug. Ok, will look now. Thanks.
Chris Dumez
Comment 21 2021-01-19 09:11:18 PST
(In reply to Chris Dumez from comment #20) > (In reply to youenn fablet from comment #18) > > With this patch, RemoteRenderingBackend::cacheNativeImage is called in a > > background thread. This can call ShareableBitmap::createGraphicsContext > > which has an assertion to be called in main thread. > > This reproduces for me by running webrtc/video.html with GPU process enabled > > in WTR/debug. > > Ok, will look now. Thanks. Follow-up in <https://trac.webkit.org/changeset/271601>.
Note You need to log in before you can comment on or make changes to this bug.