Closed Bug 1422466 Opened 7 years ago Closed 7 years ago

Drop a copy from TextDrawTarget::FillGlyphs

Categories

(Core :: Graphics: WebRender, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: jrmuizel, Assigned: jrmuizel, NeedInfo)

References

(Blocks 1 open bug)

Details

(Whiteboard: [wr-mvp])

Attachments

(1 file, 1 obsolete file)

After bug 1422414 the loop basically just does a memcpy. We can just skip it if we pretend the types are the same.
Attached patch PoC (obsolete) — Splinter Review
We should try harder to ensure that the types are the same.
Assignee: nobody → jmuizelaar
Status: NEW → ASSIGNED
Priority: -- → P1
Whiteboard: [wr-reserve]
Attachment #8933864 - Attachment is obsolete: true
Blocks: 1422039
Comment on attachment 8933919 [details]
Bug 1422466. Drop a copy from TextDrawTarget::FillGlyphs.

https://reviewboard.mozilla.org/r/204840/#review210398

::: layout/generic/TextDrawTarget.h:124
(Diff revision 2)
> -
> -    for (size_t i = 0; i < aBuffer.mNumGlyphs; i++) {
> -      wr::GlyphInstance& targetGlyph = glyphs[i];
> -      const gfx::Glyph& sourceGlyph = aBuffer.mGlyphs[i];
> -      targetGlyph.index = sourceGlyph.mIndex;
> -      targetGlyph.point = mSc.ToRelativeLayoutPoint(
> +
> +    // Compare gfx::Glyph and wr::GlyphInstance to make sure that they are
> +    // structurally equivalent to ensure that our cast above was ok
> +    static_assert(std::is_same<decltype(aBuffer.mGlyphs[0].mIndex), decltype(glyphs[0].index)>()
> +                  && std::is_same<decltype(aBuffer.mGlyphs[0].mPosition.x), decltype(glyphs[0].point.x)>()
> +                  && std::is_same<decltype(aBuffer.mGlyphs[0].mPosition.y), decltype(glyphs[0].point.y)>()

This is supposed to move the glyphs from global space to local space by applying the the stacking context's offset. Do you have a reason to believe this must always be 0?
Attachment #8933919 - Flags: review?(a.beingessner) → review-
Yeah, see https://bugzilla.mozilla.org/show_bug.cgi?id=1422414. The stacking context offset is always zero now (and has been for a little while).
Ah, great!
Comment on attachment 8933919 [details]
Bug 1422466. Drop a copy from TextDrawTarget::FillGlyphs.

https://reviewboard.mozilla.org/r/204840/#review210426
Attachment #8933919 - Flags: review- → review+
Whiteboard: [wr-reserve] → [wr-mvp]
Pushed by jmuizelaar@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/719224b9a2dd
Drop a copy from TextDrawTarget::FillGlyphs. r=Gankro
Backed out 1 changesets (bug 1422466) for build bustage on a CLOSED TREE

Push with bustage: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=719224b9a2dd25180b4fe58d039dc91d9c579259

Backout: https://hg.mozilla.org/integration/autoland/rev/5a71560d58db074a628624d99f12d84e0d2d07b7

Log: https://treeherder.mozilla.org/logviewer.html#?job_id=149443565&repo=autoland&lineNumber=17299

03:35:32     INFO -  z:/build/build/src/gfx/layers/wr/WebRenderBridgeChild.cpp(297): error C2039: 'IsEmpty': is not a member of 'mozilla::Range<const mozilla::wr::GlyphInstance>'
03:35:32     INFO -  z:\build\build\src\obj-firefox\dist\include\mozilla/webrender/WebRenderAPI.h(393): note: see declaration of 'mozilla::Range<const mozilla::wr::GlyphInstance>'
03:35:32     INFO -  z:/build/build/src/gfx/layers/wr/WebRenderBridgeChild.cpp(297): error C2955: 'mozilla::detail::AssertionConditionType': use of class template requires template argument list
03:35:32     INFO -  z:\build\build\src\obj-firefox\dist\include\mozilla/Assertions.h(396): note: see declaration of 'mozilla::detail::AssertionConditionType'
03:35:32     INFO -  z:/build/build/src/gfx/layers/wr/WebRenderBridgeChild.cpp(297): error C2057: expected constant expression
03:35:32     INFO -  z:/build/build/src/config/rules.mk:1028: recipe for target 'Unified_cpp_gfx_layers11.obj' failed
03:35:32     INFO -  mozmake.EXE[4]: *** [Unified_cpp_gfx_layers11.obj] Error 2
03:35:32     INFO -  mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/gfx/layers'
03:35:32     INFO -  mozmake.EXE[4]: *** Waiting for unfinished jobs....
03:35:32     INFO -  mozmake.EXE[4]: Entering directory 'z:/build/build/src/obj-firefox/dom/base'
03:35:32     INFO -  mozmake.EXE[4]: Leaving directory 'z:/build/build/src/obj-firefox/dom/base'
Flags: needinfo?(jmuizelaar)
Comment 10 is really for bug 1422662, not this bug.
Flags: needinfo?(cpearce)
Pushed by jmuizelaar@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7edd58cc444f
Drop a copy from TextDrawTarget::FillGlyphs. r=Gankro
https://hg.mozilla.org/mozilla-central/rev/7edd58cc444f
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
No longer blocks: 1422039
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: