Closed Bug 1606771 Opened 3 months ago Closed 2 months ago

Performance on https://old.reddit.com/r/skyrim/ is really bad with WebRender because of border-image-repeat: round fallback

Categories

(Core :: Graphics: WebRender, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: jrmuizel, Assigned: nical)

References

(Blocks 2 open bugs)

Details

Attachments

(6 files, 2 obsolete files)

Here's a profile: https://perfht.ml/2QFavJA

Blocks: wr-perf
Priority: -- → P3

It would be interesting to know why this isn't being handled by bug 1409773

And the answer is because the repeat style is "round".

Depends on: 1488457
Summary: Performance on https://old.reddit.com/r/skyrim/ is really bad with WebRender (blob image badness) → Performance on https://old.reddit.com/r/skyrim/ is really bad with WebRender (blob image badness) because of border-image-repeat: round
Summary: Performance on https://old.reddit.com/r/skyrim/ is really bad with WebRender (blob image badness) because of border-image-repeat: round → Performance on https://old.reddit.com/r/skyrim/ is really bad with WebRender because of border-image-repeat: round fallback
Depends on: wr-perf-p1
Assignee: nobody → nical.bugzilla
Blocks: wr-perf-p1
No longer depends on: wr-perf-p1

For the record Chrome solves this problem by supporting image subsets. (sk_sp<SkImage> SkImage::makeSubset()) This lets it do subimage tiling and sampling without having to make copies. We could do something similar that would eliminate the performance disaster even if we were still using blob images.

Unlike the border areas that only nead their own dimensions, the middle area of a border-image determines its repetition parameter based on the size of the borders. A new flag is provided for the brush_image shader to know whether to use the segment's own rect or look at the borders when computing the pattern's size.

Depends on D59370

It is common for a border image pattern to be exactly a multiple of its containing rect. In these cases it is important that when we compute the floor() of the number of times the pattern fits, the result lands back to the whole number. However, floating point inaccuracie can cause us to get a number of patterns almost equal to the expected whole number but slighly below, off by an epsilon, which removes an entire repetition. Worse, this can play out differently for different borders of a same rechangle because the width or height of the segment's source UVs used in the computation can be different by an epsilon while they should be equal in theory.
This patch works around the issue by biasing the floor() operation by a small amount.

Depends on D59675

Depends on D59900

Attachment #9121245 - Attachment is obsolete: true
Duplicate of this bug: 1609784
Attachment #9119803 - Attachment description: Bug 1606771 - Implement border-image-repeat: round in WebRender. r=jrmuizel → Bug 1606771 - Implement border-image-repeat: round in WebRender. r=mstange
Attachment #9120809 - Attachment is obsolete: true

Depends on D59901

The computation of the repetition depends on the aspect ratio of the segment's uv rectangle, which was previously represented by the dx/dy variables in the shader. These were mistakenly computing the ratio of the normalized uvs within the primitive's total uv rect, which was incorrect since the normalization introduces a non-uniform scale.
This patch fixes it by taking the uv size in device pixels instead of the the normalized textel rect. dx and dy are also renamed into segment_uv_size which is a more informative name.

Depends on D60487

Pushed by nsilva@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6b61867f80b1
Implement border-image-repeat: round in WebRender. r=jrmuizel,kvark
https://hg.mozilla.org/integration/autoland/rev/834d49acd3c0
Fix the middle area of border-image nine-patches. r=gw
https://hg.mozilla.org/integration/autoland/rev/fcea11e2d25a
Fall back to blob for border-image-repeat with fill but no edges. r=gw
https://hg.mozilla.org/integration/autoland/rev/b77165c76450
Fix border image repetition computation. r=gw
https://hg.mozilla.org/integration/autoland/rev/5ad1eff4ce66
Add a reftest. r=kvark
https://hg.mozilla.org/integration/autoland/rev/ee4b15857843
Pass more reftests. r=mstange

The page is not a blob image festival anymore and works smoothly on today's Nightly.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.