Reuse scaled fonts across blob item recordings

RESOLVED FIXED in Firefox 64

Status

()

enhancement
P3
normal
RESOLVED FIXED
11 months ago
9 months ago

People

(Reporter: jrmuizel, Assigned: lsalzman)

Tracking

(Blocks 2 bugs)

63 Branch
mozilla64
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox63 wontfix, firefox64 fixed)

Details

(Whiteboard: [gfx-noted])

Attachments

(1 attachment)

Reporter

Description

11 months ago
For each piece of SVG text we record a new scaled font. This can be quite wasteful in recording size and time.
Reporter

Updated

11 months ago
Blocks: 1478078
Reporter

Updated

11 months ago
Blocks: 1480613
Reporter

Comment 1

11 months ago
An idea of how to do this is to add a shared section to blob recordings. This could contain all of the scaled fonts, unscaled fonts and even source surfaces. Items would include a list of all the shared items that they depend on and the blob merging would only copy over the dependencies needed.
Reporter

Updated

11 months ago
Blocks: 1480196
Priority: -- → P3
Whiteboard: [gfx-noted]
I would prefer if we could somehow hook into wr's "native" font management since this has historically been messy and bug-ridden.
Reporter

Comment 3

10 months ago
(In reply to Alexis Beingessner [:Gankro] from comment #2)
> I would prefer if we could somehow hook into wr's "native" font management
> since this has historically been messy and bug-ridden.

Note this is not about sharing fonts between blobs. Just between the different recordings in the same blob.
Assignee

Comment 4

10 months ago
I have an idea for how to make sharing work even across separate blobs. I will try to implement it and see if it turns into something worth committing.
Assignee: nobody → lsalzman
Status: NEW → ASSIGNED
Assignee

Comment 5

10 months ago
Added a query for getting font instance data out of WR in PR https://github.com/servo/webrender/pull/3002

This will be used later for solving this.
Assignee

Comment 6

10 months ago
The kernel idea here is that we send over all ScaledFonts used in a blob images as WR FontInstances. Then all the blob image has to do is query that FontInstance data to recreate a ScaledFont if necessary, which will stick around for the rest of the lifetime of the FontInstance. This allows the ScaledFont to not only be reused across recordings within a blob image, but across any number of blob images that share the same ScaledFont.

The advantage of this approach is that creation/deletion of these ScaledFonts are properly synchronized with blob image creation/deletion, because it all gets processed on the WR thread with normal FontInstance management. We don't have to add any extra bookkeeping on the content side to track lifetimes either because all our existing FontInstance handling takes care of that.
Attachment #9005666 - Flags: review?(jmuizelaar)
Reporter

Comment 7

10 months ago
Comment on attachment 9005666 [details] [diff] [review]
reuse scaled fonts across blob image recordings

Review of attachment 9005666 [details] [diff] [review]:
-----------------------------------------------------------------

I like it.
Attachment #9005666 - Flags: review?(jmuizelaar) → review+
Depends on: 1487885
Reporter

Updated

10 months ago
Depends on: 1488887
No longer depends on: 1488887

Comment 8

10 months ago
Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ada6c9fc290c
reuse scaled fonts across blob image recordings. r=jrmuizel
Assignee

Updated

10 months ago
Blocks: 1474180

Comment 9

10 months ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/ada6c9fc290c
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
Depends on: 1489170
You need to log in before you can comment on or make changes to this bug.