Bug 217506

Summary: [Cocoa] [GPU Process] Perform image decoding of color fonts in the Web Process
Product: WebKit Reporter: Myles C. Maxfield <mmaxfield>
Component: TextAssignee: Myles C. Maxfield <mmaxfield>
Status: RESOLVED FIXED    
Severity: Normal CC: annulen, ews-watchlist, gyuyoung.kim, mmaxfield, ryuan.choi, sergio, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 217539, 217541, 217749, 218346    
Bug Blocks:    
Attachments:
Description Flags
WIP
none
WIP
none
WIP
ews-feeder: commit-queue-
WIP
none
WIP
none
Almost ready
none
WIP
none
Needs tests
ews-feeder: commit-queue-
Needs tests
none
Ahem with sbix table
none
Needs COLR test
none
Patch
none
WIP
none
WIP
none
Patch
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
none
Patch
none
Rebased
none
Patch
ews-feeder: commit-queue-
Patch
none
Patch
simon.fraser: review+, ews-feeder: commit-queue-
Patch for committing ews-feeder: commit-queue-

Myles C. Maxfield
Reported 2020-10-09 00:10:17 PDT
[Cocoa] [GPU Process] Perform image decoding of color fonts in the Web Process
Attachments
WIP (45.27 KB, patch)
2020-10-09 00:11 PDT, Myles C. Maxfield
no flags
WIP (29.61 KB, patch)
2020-10-09 20:01 PDT, Myles C. Maxfield
no flags
WIP (29.62 KB, patch)
2020-10-09 20:02 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
WIP (29.69 KB, patch)
2020-10-09 20:20 PDT, Myles C. Maxfield
no flags
WIP (35.31 KB, patch)
2020-10-13 00:18 PDT, Myles C. Maxfield
no flags
Almost ready (36.35 KB, patch)
2020-10-13 18:53 PDT, Myles C. Maxfield
no flags
WIP (49.21 KB, patch)
2020-10-14 00:35 PDT, Myles C. Maxfield
no flags
Needs tests (36.60 KB, patch)
2020-10-15 18:47 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Needs tests (36.61 KB, patch)
2020-10-15 18:50 PDT, Myles C. Maxfield
no flags
Ahem with sbix table (39.04 KB, application/x-font-ttf)
2020-10-15 21:15 PDT, Myles C. Maxfield
no flags
Needs COLR test (77.98 KB, patch)
2020-10-15 22:09 PDT, Myles C. Maxfield
no flags
Patch (86.00 KB, patch)
2020-10-16 01:00 PDT, Myles C. Maxfield
no flags
WIP (89.46 KB, patch)
2020-10-26 18:09 PDT, Myles C. Maxfield
no flags
WIP (92.17 KB, patch)
2020-10-26 22:57 PDT, Myles C. Maxfield
no flags
Patch (95.79 KB, patch)
2020-10-27 17:16 PDT, Myles C. Maxfield
no flags
Patch (95.94 KB, patch)
2020-10-28 16:40 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Patch (96.16 KB, patch)
2020-10-28 18:06 PDT, Myles C. Maxfield
no flags
Patch (96.17 KB, patch)
2020-10-28 19:15 PDT, Myles C. Maxfield
no flags
Patch (140.89 KB, patch)
2020-10-28 23:29 PDT, Myles C. Maxfield
no flags
Rebased (45.74 KB, patch)
2020-10-29 20:02 PDT, Myles C. Maxfield
no flags
Patch (51.41 KB, patch)
2020-10-29 21:16 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Patch (51.38 KB, patch)
2020-10-29 22:24 PDT, Myles C. Maxfield
no flags
Patch (56.02 KB, patch)
2020-10-30 09:30 PDT, Myles C. Maxfield
simon.fraser: review+
ews-feeder: commit-queue-
Patch for committing (56.03 KB, patch)
2020-10-30 11:24 PDT, Myles C. Maxfield
ews-feeder: commit-queue-
Myles C. Maxfield
Comment 1 2020-10-09 00:11:26 PDT
Myles C. Maxfield
Comment 2 2020-10-09 00:11:28 PDT
Myles C. Maxfield
Comment 3 2020-10-09 00:13:11 PDT
I need to: 1. Split this patch up into 3 pieces 2. Work out the details (see comments in the WIP patch) 3. Add tests
Simon Fraser (smfr)
Comment 4 2020-10-09 09:31:13 PDT
Comment on attachment 410919 [details] WIP View in context: https://bugs.webkit.org/attachment.cgi?id=410919&action=review Are we going to record all glyph drawing? Currently we don't have a way to measure perf impact (no motionmark test draws text into canvas); should we wait to land this until we can measure its perf impact? > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h:50 > + DrawGlyphsRecorder(Recorder&); explicit
Myles C. Maxfield
Comment 5 2020-10-09 20:01:17 PDT
Myles C. Maxfield
Comment 6 2020-10-09 20:02:32 PDT
Myles C. Maxfield
Comment 7 2020-10-09 20:20:38 PDT
Myles C. Maxfield
Comment 8 2020-10-09 23:39:33 PDT
After playing around with this for a little while, the only canvas tests I could write that were broken by this patch are: 1. The placement of images and their shadows 2. Shadows of COLR glyphs
Myles C. Maxfield
Comment 9 2020-10-13 00:18:17 PDT
Myles C. Maxfield
Comment 10 2020-10-13 18:53:20 PDT
Created attachment 411291 [details] Almost ready
Myles C. Maxfield
Comment 11 2020-10-14 00:35:50 PDT
Myles C. Maxfield
Comment 12 2020-10-15 18:47:36 PDT
Created attachment 411517 [details] Needs tests
Myles C. Maxfield
Comment 13 2020-10-15 18:50:14 PDT
Created attachment 411520 [details] Needs tests
Myles C. Maxfield
Comment 14 2020-10-15 21:15:38 PDT
Created attachment 411531 [details] Ahem with sbix table
Myles C. Maxfield
Comment 15 2020-10-15 22:09:38 PDT
Created attachment 411534 [details] Needs COLR test
Myles C. Maxfield
Comment 16 2020-10-16 01:00:02 PDT
Myles C. Maxfield
Comment 17 2020-10-16 01:02:30 PDT
This is almost ready. Two things are remaining: 1. Performance testing 2. sbix images seem to be horizontally flipped
Myles C. Maxfield
Comment 18 2020-10-16 01:04:26 PDT
3. There are a few FIXMEs
Myles C. Maxfield
Comment 19 2020-10-16 01:07:11 PDT
Comment on attachment 411542 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=411542&action=review > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:133 > + updateCTM(m_originalCTM); There might be more to do here.
Myles C. Maxfield
Comment 20 2020-10-16 12:02:22 PDT
We probably should never set the CTM. We probably should always append a modification instead. Just in case, to be defensive.
Myles C. Maxfield
Comment 21 2020-10-26 18:09:10 PDT
Created attachment 412368 [details] WIP Remaining: 1. Outline shadows are not drawn in the right place 2. Make sure non-emulated shadows work 3. Perf testing
Myles C. Maxfield
Comment 22 2020-10-26 22:57:31 PDT
Created attachment 412395 [details] WIP Perf testing is the last remaining step
Myles C. Maxfield
Comment 23 2020-10-27 17:16:39 PDT
Myles C. Maxfield
Comment 24 2020-10-28 16:40:22 PDT
Myles C. Maxfield
Comment 25 2020-10-28 18:06:59 PDT
Myles C. Maxfield
Comment 26 2020-10-28 19:13:05 PDT
Without patch: With 1 canvas element: 125.58 | -1.87% / +1.35% Only 1 canvas element: 169.66 | -1.97% / +1.48% With patch: With 1 canvas element: 126.87 | -1.68% / +1.08% Only 1 canvas element: 171.21 | -1.54% / +1.67% Not a regression!
Myles C. Maxfield
Comment 27 2020-10-28 19:15:32 PDT
Myles C. Maxfield
Comment 28 2020-10-28 23:29:15 PDT
Myles C. Maxfield
Comment 29 2020-10-29 10:55:58 PDT
Simon Fraser (smfr)
Comment 30 2020-10-29 11:00:38 PDT
Comment on attachment 412617 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=412617&action=review > Source/WebCore/ChangeLog:8 > + Reviewed by NOBODY (OOPS!). > + > + Test: fast/text/canvas-sbix.html More words here please. > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h:103 > + float m_originalShadowBlur; initialize > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h:108 > + float m_currentShadowBlur; initialize > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorder.h:110 > + bool m_currentShadowsIgnoreTransforms; initialize > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:111 > + m_originalFillColor = state.fillColor; > + m_originalFillGradient = state.fillGradient; > + m_originalFillPattern = state.fillPattern; > + > + m_originalStrokeColor = state.strokeColor; > + m_originalStrokeGradient = state.strokeGradient; > + m_originalStrokePattern = state.strokePattern; > + > + m_currentFillColor = m_originalFillColor; > + m_currentStrokeColor = m_originalStrokeColor; Could you group things into structs to make this one assignment? > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:157 > + m_originalShadowOffset = state.shadowOffset; > + m_originalShadowBlur = state.shadowBlur; > + m_originalShadowColor = state.shadowColor; > + m_originalShadowsIgnoreTransforms = state.shadowsIgnoreTransforms; > + > + m_currentShadowOffset = m_originalShadowOffset; > + m_currentShadowBlur = m_originalShadowBlur; > + m_currentShadowColor = m_originalShadowColor; > + m_currentShadowsIgnoreTransforms = m_originalShadowsIgnoreTransforms; Could also clean this up. > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:171 > +void DrawGlyphsRecorder::updateCTM(AffineTransform ctm) const AffineTransform& > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:233 > + newState.shadowOffset = shadowOffset; > + newState.shadowBlur = shadowBlur; > + newState.shadowColor = shadowColor; Here too > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:246 > + m_currentShadowOffset = shadowOffset; > + m_currentShadowBlur = shadowBlur; > + m_currentShadowColor = shadowColor; Here too
Myles C. Maxfield
Comment 31 2020-10-29 20:02:47 PDT
Myles C. Maxfield
Comment 32 2020-10-29 20:43:21 PDT
Comment on attachment 412617 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=412617&action=review >> Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:233 >> + newState.shadowColor = shadowColor; > > Here too I can't do it here, because newState is a GraphicsContextState, and modifying that is outside the scope of this patch. I can do it in the above places, though. >> Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:246 >> + m_currentShadowColor = shadowColor; > > Here too I don't think it's a good fit in this particular place, because that 4th argument is a different type and has some logic on the line below. I've moved the shadow stuff into a struct for encapsulation, but I don't think this particular place can be a single line assignment.
Myles C. Maxfield
Comment 33 2020-10-29 21:16:15 PDT
Myles C. Maxfield
Comment 34 2020-10-29 22:24:09 PDT
Myles C. Maxfield
Comment 35 2020-10-30 09:30:55 PDT
Simon Fraser (smfr)
Comment 36 2020-10-30 09:44:21 PDT
Comment on attachment 412757 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=412757&action=review > Source/WebCore/ChangeLog:14 > + character, Core Text will end up telling Core Graphics to draw all the outlines, and then telling Core > + Graphics to draw the emoji image (using Core Graphics's normal image drawing routines). This makes it sound like the emoji are z-ordered on top but I don't think they are. > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:106 > + m_originalState.ctm = m_owner.currentState().ctm; // FIXME: Deal with device scale. How important is this FIXME? > Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:309 > + // We want the GPU process's CTM and text matrix to match the current CTM and text matrix. This code shouldn't reference the GPU process.
Myles C. Maxfield
Comment 37 2020-10-30 11:21:44 PDT
Comment on attachment 412757 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=412757&action=review >> Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:106 >> + m_originalState.ctm = m_owner.currentState().ctm; // FIXME: Deal with device scale. > > How important is this FIXME? I think it's important. Right now our display list infrastructure doesn't handle retina displays. All display lists assume a 1x base CTM.
Myles C. Maxfield
Comment 38 2020-10-30 11:22:31 PDT
Comment on attachment 412757 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=412757&action=review >>> Source/WebCore/platform/graphics/displaylists/DisplayListDrawGlyphsRecorderCoreText.cpp:106 >>> + m_originalState.ctm = m_owner.currentState().ctm; // FIXME: Deal with device scale. >> >> How important is this FIXME? > > I think it's important. Right now our display list infrastructure doesn't handle retina displays. All display lists assume a 1x base CTM. I've rewritten this to be "// FIXME: Deal with base CTM."
Myles C. Maxfield
Comment 39 2020-10-30 11:24:18 PDT
Created attachment 412778 [details] Patch for committing
Myles C. Maxfield
Comment 40 2020-10-30 17:01:11 PDT
Myles C. Maxfield
Comment 41 2020-10-30 20:34:38 PDT
Note You need to log in before you can comment on or make changes to this bug.