Closed Bug 1745894 Opened 3 years ago Closed 3 years ago

[wayland] Scrolling performance regression since changes to titlebar corners, especially when playing video in a second window

Categories

(Core :: Graphics: WebRender, defect)

Firefox 96
defect

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox-esr91 --- unaffected
firefox95 --- unaffected
firefox96 --- fixed
firefox97 --- fixed

People

(Reporter: ke5trel, Assigned: emilio)

References

(Blocks 2 open bugs, Regression)

Details

(Keywords: perf, regression)

Attachments

(1 file, 1 obsolete file)

STR:

  1. Start with MOZ_ENABLE_WAYLAND=1 on Ubuntu 21.10.
  2. Play a youtube video.
  3. Open second non-maximized window with a simple page (eg https://en.wikipedia.org).
  4. Scroll page with mousewheel.

Scrolling is choppy while video is playing. Reduced scrolling performance may also be noticed when a video is not playing but is less obvious. Switch to SW-WR if not reproducible with HW-WR.

Does not happen with ui.titlebarRadius = 0, browser.tabs.inTitlebar = 0, MOZ_ENABLE_WAYLAND=0 or maximized window (single monitor).

Regression window:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=e3ed61b61357e78f89a316d68dd5cc69ffd099ac&tochange=eb8c23dda78d3ed4bf244c3e72c76e81833086ff

Regressed by Bug 1509931.

Flags: needinfo?(emilio)

Is there any chance you could take a profile so that I know exactly what's going on on your machine? I can't see a terribly noticeable slowdown (but I haven't checked with SWWR yet).

Flags: needinfo?(emilio) → needinfo?(ke5trel)

But over all I'm fairly confused about how this could even be the case, it is my understanding that scrolling of the website and painting of the chrome area is relatively independent... So maybe it slowed down chrome painting a whole lot but that'd be somewhat surprising. I guess the body border radius introduces a potential clip over the content area (but it should never really clip anything so I'd be surprised if WebRender got slower because of that).

Maybe some of the graphics folks can know off the top of their head how this rule:

/* On Wayland the compositor draws the titlebar border and shadow as well, so
 * trim it by setting the radius on an ancestor of the toolbox-background */
@media (-moz-gtk-wayland) {
  :root[tabsintitlebar][sizemode="normal"]:not([gtktiledwindow="true"]) > body {
    border-top-left-radius: env(-moz-gtk-csd-titlebar-radius);
    border-top-right-radius: env(-moz-gtk-csd-titlebar-radius);
  }
}

Can harm scrolling performance?

Component: Widget: Gtk → Graphics: WebRender

I restricted it somewhat intentionally, though perhaps we can get away
with removing the IsThemed() special-case altogether since border-radius
almost always removes native appearance on content.

Anyways, this should be safer, if a bit special-case-y.

Assignee: nobody → emilio
Status: NEW → ASSIGNED

For posterity, Glenn said:

I think I'd try and see if that change results in WR/compositor creating a heap more non-opque tiles which would result in more blending work for the compositor during scrolling?
The other thing it might do is mean that the background tiles don't get occluded by the front content tiles?
Lots of the logic for determining opaque / occluded tiles is fairly simple, and might fail in the case of unexpected clip masks, I suspect

If comment 4 does fix the issue for the reporter, I'll try to reduce something or investigate a bit more.

The comment 4 test build fixes it. Here's a profile without fix and a profile with fix, captured using SW-WR.

Flags: needinfo?(ke5trel)
Blocks: gtktitlebar

This is a better fix for the double decorations than clipping them using
CSS.

Attachment #9255320 - Attachment is obsolete: true
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/c07386b652ce Don't draw window decorations when painting headerbar on wayland. r=stransky
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 97 Branch

The patch landed in nightly and beta is affected.
:emilio, is this bug important enough to require an uplift?
If not please set status_beta to wontfix.

For more information, please visit auto_nag documentation.

Flags: needinfo?(emilio)

Comment on attachment 9255477 [details]
Bug 1745894 - Don't draw window decorations when painting headerbar on wayland. r=stransky

Beta/Release Uplift Approval Request

  • User impact if declined: Perf regression in some configurations.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce:
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Simple change to the regressing bug to avoid hitting a WebRender slow path.
  • String changes made/needed: none
Flags: needinfo?(emilio)
Attachment #9255477 - Flags: approval-mozilla-beta?

Comment on attachment 9255477 [details]
Bug 1745894 - Don't draw window decorations when painting headerbar on wayland. r=stransky

Approved for 96.0b8

Attachment #9255477 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Has Regression Range: --- → yes
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: