RESOLVED FIXED201157
[FTW] Use DirectX SharedResource as basis for SharedBitmap
https://bugs.webkit.org/show_bug.cgi?id=201157
Summary [FTW] Use DirectX SharedResource as basis for SharedBitmap
Brent Fulgham
Reported 2019-08-26 15:54:44 PDT
Currently an ID2D1Bitmap is used as the backing store for the SharedBitmap used to share data between the WebContent Process and the UIProcess. However, this involves moving GPU memory to local memory, copying the memory into the Shared Memory in the SharedBitmap, then building a new GPU bitmap on the UIProcess side from the shared memory store. Profiling indicates that this is the single largest place WebKit spends its time. Instead, we should use Direct2D's ability to render to an IDXGISurface, which can be shared between multiple processes. This should avoid the GPU->CPU copy, the Direct2D-allocated CPU->Shared Memory copy, and the shared memory to GPU copy.
Attachments
Patch (54.78 KB, patch)
2019-08-29 23:13 PDT, Brent Fulgham
no flags
Patch for landing (68.09 KB, patch)
2019-08-30 11:00 PDT, Brent Fulgham
no flags
Brent Fulgham
Comment 1 2019-08-29 22:20:21 PDT
With this change: After Bug 201122 I measured: > AppleWin 4.35 > WinCairo 8.39 > FTW 28.71 After these changes: FTW 71.42
Brent Fulgham
Comment 2 2019-08-29 23:13:09 PDT
Alex Christensen
Comment 3 2019-08-30 08:44:26 PDT
Comment on attachment 377681 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377681&action=review > Source/WebKit/Platform/SharedMemory.h:83 > + static bool decodeHandle(IPC::Decoder&, HANDLE&); Could you make this return Optional<HANDLE>? > Source/WebKit/Shared/win/ShareableBitmapDirect2D.cpp:60 > +bool ShareableBitmap::Configuration::decodeSharedResourceHandle(IPC::Decoder& decoder) These wrappers seem a bit excessive. This code looks like it just belongs in the call site.
Brent Fulgham
Comment 4 2019-08-30 09:29:08 PDT
Comment on attachment 377681 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=377681&action=review >> Source/WebKit/Platform/SharedMemory.h:83 >> + static bool decodeHandle(IPC::Decoder&, HANDLE&); > > Could you make this return Optional<HANDLE>? Sure! >> Source/WebKit/Shared/win/ShareableBitmapDirect2D.cpp:60 >> +bool ShareableBitmap::Configuration::decodeSharedResourceHandle(IPC::Decoder& decoder) > > These wrappers seem a bit excessive. This code looks like it just belongs in the call site. Okay. When I started I was trying to minimize changes to ShareableBItmap.cpp, but I ended up tweaking them anyway. I'lll move these lines.
Brent Fulgham
Comment 5 2019-08-30 11:00:54 PDT
Created attachment 377729 [details] Patch for landing
WebKit Commit Bot
Comment 6 2019-08-30 11:20:29 PDT
Comment on attachment 377729 [details] Patch for landing Clearing flags on attachment: 377729 Committed r249335: <https://trac.webkit.org/changeset/249335>
WebKit Commit Bot
Comment 7 2019-08-30 11:20:31 PDT
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 8 2019-08-30 11:21:21 PDT
Note You need to log in before you can comment on or make changes to this bug.