Open Bug 1647484 Opened 4 years ago Updated 4 months ago

https://www.apple.com/macos/big-sur-preview/ has bad performance with WebRender

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

People

(Reporter: jrmuizel, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug, )

Details

https://share.firefox.dev/3eqTGwy

Looks like we have a texture upload problem.

(In reply to Jeff Muizelaar [:jrmuizel] from comment #0)

https://share.firefox.dev/3eqTGwy

Looks like we have a texture upload problem.

Or generally stalling on the GPU.

Blocks: wr-perf

It looks like we're spending most of our time in CS_Clip. I was able to reproduce it with a capture on my Mac.

Glenn, do you want to take a quick look to see what's going on?

Flags: needinfo?(gwatson)

I only see a large amount of CS_Clip time at one part of the page - when the main image is moving around during scrolling.

There is only a single clip, but there's two factors causing it to be particularly slow in this case:

  • The clip is an image mask, which is quite large [1]. We should see why Gecko is creating an image mask in this case, in case it's something we can avoid.
  • The clip mask has tiling enabled, which is unfortunately a very inefficient path in WR right now (as each tile is replayed over the entire clip mask area). This can be fixed / improved, it just hasn't been a priority as it's rare.

[1] clip_mask_image = ImageProperties { descriptor: ImageDescriptor { format: R8, size: 1356×777, stride: None, offset: 0, flags: (empty) }, external_image: None, tiling: Some(512), visible_rect: Rect(1356×777 at (0,0)) }

Flags: needinfo?(gwatson)
Depends on: 1548396

This changes seems to help considerably:

diff --git a/gfx/webrender_bindings/src/bindings.rs b/gfx/webrender_bindings/src/bindings.rs
index 34fbde9f30cc1..5b8f2340617c2 100644
--- a/gfx/webrender_bindings/src/bindings.rs
+++ b/gfx/webrender_bindings/src/bindings.rs
@@ -1806,21 +1806,21 @@ pub extern "C" fn wr_resource_updates_add_blob_image(
     visible_rect: DeviceIntRect,
 ) {
     txn.add_blob_image(
         image_key,
         descriptor.into(),
         Arc::new(bytes.flush_into_vec()),
         visible_rect,
         if descriptor.format == ImageFormat::BGRA8 {
             Some(256)
         } else {
-            None
+            Some(4096)
         },
     );
 }
 
 #[no_mangle]
 pub extern "C" fn wr_resource_updates_add_external_image(
     txn: &mut Transaction,
     image_key: WrImageKey,
     descriptor: &WrImageDescriptor,
     external_image_id: ExternalImageId,
Severity: -- → S3

(In reply to Jeff Muizelaar [:jrmuizel] from comment #4)

This is the mask: https://www.apple.com/v/macos/big-sur-preview/a/images/overview/experience/experience_hardware_mask__dcufdss65xoy_large.svg. Disabling it makes the clipping time go away.

It is set on the selector html.css-mask .section-experience .image-experience glass-hardware, and applies to an element at .sticky-wrapper > .sticky-content > .hardware-wrapper > .image-experience > glass-hardware. Unsetting the mask-image and -webkit-mask-image properties also eliminates the texture upload cost from the profile... at least sometimes, depending on the viewport size, it seems. So it seems we're uploading the rasterized mask many times.

Blocks: 1648487

uh why would this website issue block support for macOS 11?

I see an excessive amount of glyph rasterization happening every frame during scrolling. The text on the header is constantly re-rasterized even though it doesn't move.

Depends on: 1681339
Blocks: 1681339
No longer depends on: 1681339

The glyphs rasterization issue is fixed. This page is overall not too bad on linux. The main source of jank on linux is some webgl readback on the content side.

No longer blocks: 1681339

(In reply to Nicolas Silva [:nical] from comment #9)

some webgl readback on the content side.

That should be fixed when using the EGL backend (MOZ_X11_EGL=1 or MOZ_ENABLE_WAYLAND=1) on mesa drivers.

No longer blocks: 1648487
You need to log in before you can comment on or make changes to this bug.