Open Bug 1417046 Opened 7 years ago Updated 29 days ago

An nsDisplayThemedBackground of the size of the window is emitted

Categories

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

enhancement

Tracking

()

Tracking Status
firefox57 --- unaffected
firefox58 --- unaffected

People

(Reporter: nical, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [wr-reserve] [gfx-noted])

Attachments

(1 obsolete file)

This causes us to first allocate a rather large shmem, then ask the platform widget machinery to paint a uniform color all over it, and then we send it to webrender which has to allocate a dedicated texture and upload it. I believe that in most cases webrender ends up covering most of it with a rectangle display item, so it's not visible unless you are lucky enough to have a buggy nvidia driver that doesn't render some of the draw calls and you end up seeing it.

Thanks to being mostly or entirely covered and webrender's z-culling mechanism, this display item should not affect memory bandwidth much, but it adds a draw call and a screenfull of wasted memory (plus the startup cost of creating/sending/uploading it).
Yeah, we need to avoid this. I don't see this on Mac so I assume you're seeing it on Linux?
Some options for fixing it in order of my preference:
 - Update the CSS to not have the -moz-appearance in the first place.
 - Add an implementation of CreateWebRenderCommands() for nsDisplayThemedBackground that knows when painting a solid color and convert that to webrender commands.
Priority: -- → P3
Whiteboard: [gfx-noted][wr-mvp] [triage] → [gfx-noted][wr-mvp] [triage][wr-reserve-candidate]
Whiteboard: [gfx-noted][wr-mvp] [triage][wr-reserve-candidate] → [wr-reserve] [gfx-noted]
Depends on: 1418361
Do we see this on Windows?
Flags: needinfo?(nical.bugzilla)
I think that we don't. We used to see this on Mac but it was fixed there.
Flags: needinfo?(nical.bugzilla)
Did a lot of digging inside GTK3. It remains possible that a theme might use a gradient or image and/or box shadow as a window background. However, GTK3 doesn't really have a nice (or any) ways to query those things out of the style context. But for most intents, we are probably safe just assuming there is only the background color. Not sure if any styles actually do anything else.

That said, we already safely query the background color of the window's style context in gtk/nsLookAndFeel, so this just retrieves that and builds the necessary rect from it.
Attachment #8944330 - Flags: review?(nical.bugzilla)
Attachment #8944330 - Attachment is obsolete: true
Attachment #8944330 - Flags: review?(nical.bugzilla)
This maybe doesn't affect Windows? We seem to be getting by without fixing it.
Blocks: stage-wr-next
No longer blocks: stage-wr-trains

It isn't as dramatic as it used to be. Now I see mostly an nsThemedBackground of size 1920 by 88 (probably for the chrome) rather than the size of the whole window. Still it is painted quite frequently when interacting with the UI so it would be great to avoid it.

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

It isn't as dramatic as it used to be. Now I see mostly an nsThemedBackground of size 1920 by 88 (probably for the chrome) rather than the size of the whole window. Still it is painted quite frequently when interacting with the UI so it would be great to avoid it.

On Linux that's probably for the titlebar. We could possibly avoid that by extracting the titlebar color in the theme code and painting it ourselves. Though might cause issues with titlebars that are gradients.

Severity: normal → S3
Blocks: wr-blob-perf
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: