Scroll bar images don't have opacity marked correctly in webrender
Categories
(Core :: Graphics: WebRender, enhancement, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox74 | --- | fixed |
People
(Reporter: gw, Assigned: jrmuizel)
References
Details
Attachments
(2 files)
| Reporter | ||
Comment 1•6 years ago
|
||
I'm not too sure how these are implemented in Gecko with WR - are they blobs? Would it be feasible to determine when these are opaque and tag them as such? (this would significantly improve the efficiency of tile occlusion culling I am working on).
| Assignee | ||
Comment 2•6 years ago
|
||
They are not implemented as blobs and currently all non-blob fallback is marked as transparent. I'll attach a completely untested patch that should make them opaque if the display item thinks it's opaque (I don't know if scrollbars actually know...)
| Assignee | ||
Comment 3•6 years ago
|
||
Updated•6 years ago
|
| Assignee | ||
Comment 4•6 years ago
|
||
Mstange points out https://searchfox.org/mozilla-central/rev/3300072e993ae05d50d5c63d815260367eaf9179/widget/windows/nsNativeThemeWin.cpp#2702-2710 which suggests that this patch has a decent chance of working.
| Reporter | ||
Comment 5•6 years ago
|
||
I tested locally with this patch and it works! (at least, it makes the occlusion culling work more efficiently, I don't know if it breaks anything else).
On my 4k screen, this further reduced the allocated tile count from 34 down to 29 (by occluding all background tiles that the scrollbars cover).
So, if this passes a try run, we should definitely get it merged.
| Assignee | ||
Comment 6•6 years ago
|
||
Updated•6 years ago
|
| Reporter | ||
Comment 7•6 years ago
|
||
I think this may be having a reasonable impact on performance on Windows + DirectComposite mode. Do we know what causes the try failures?
Comment 8•6 years ago
|
||
(In reply to Glenn Watson [:gw] from comment #7)
Do we know what causes the try failures?
There's a black pixel row at the bottom of a scrollbar thumb. It looks like theme rendering isn't filling the entire surface. Maybe it's snapping the fill rect differently.
| Reporter | ||
Comment 9•6 years ago
|
||
Jeff, Andrew, this could be a significant memory (and perhaps performance) win, if we're able to solve it. Any thoughts on how much work would be to get this passing on try?
Comment 10•6 years ago
|
||
Okay, so it is the slow path, and presumably this ClearRect
causes us to draw the black line.
We intersect the opaque rect with the paint bounds, but realistically, the actual surface area created is defined by the dtRect, which is snapped to outside pixels. Presumably this is to be conservative -- this means we might get an extra row/column on any/all sides if the items inside snap differently when they paint.
As for a fix, my expectation then would be you can only be opaque if the opaque rect contains the dtRect, not the paintBounds. It is possible the dtRect will need to be calculated more accurately as well to maximize the odds we don't add that extra row (that may be non-trivial).
Comment 11•6 years ago
|
||
Let's see about confirming that theory: https://treeherder.mozilla.org/#/jobs?repo=try&revision=950ff17de2134bd896071c01909ce8e28622adbf
Comment 12•6 years ago
|
||
That appears to work, although it may mean we are overly conservative and are never opaque :).
| Assignee | ||
Comment 13•6 years ago
|
||
Glenn, the scrollbars on Mac are transparent. Do we have a plan to deal with this problem there?
| Reporter | ||
Comment 14•6 years ago
|
||
I don't think this is an issue on Mac.
The opaque background rect on Mac should extend to cover the entire window, which will allow those tiles to be occluded. It should only be an issue on Linux / Windows, where the opaque background rect is clipped to the visible area excluding the scrollbar region.
I think this was the case when I last checked, but it would be worth verifying. If you enable picture caching debugging on a simple scrollable page, do you see any fixed position tiles in the debugger or are they all occluded?
Updated•6 years ago
|
| Reporter | ||
Comment 15•6 years ago
|
||
I did some measurements with the original patch applied, and it gives a significant improvement to time spent in DWM process when DirectComposition is enabled (~29% -> 24% on a 4k screen with HD530 GPU). So it's definitely worth prioritizing this and finding a solution to get it over the line.
| Assignee | ||
Comment 16•6 years ago
|
||
(In reply to Andrew Osmond [:aosmond] from comment #10)
Okay, so it is the slow path, and presumably this ClearRect
causes us to draw the black line.
We intersect the opaque rect with the paint bounds, but realistically, the actual surface area created is defined by the dtRect, which is snapped to outside pixels. Presumably this is to be conservative -- this means we might get an extra row/column on any/all sides if the items inside snap differently when they paint.
As for a fix, my expectation then would be you can only be opaque if the opaque rect contains the dtRect, not the paintBounds. It is possible the dtRect will need to be calculated more accurately as well to maximize the odds we don't add that extra row (that may be non-trivial).
I'm concerned that with this approach that we'll sometimes have a transparent scrollbar. I'd prefer something more reliable. I'll think about how we can get that.
| Assignee | ||
Comment 17•6 years ago
|
||
I looked into this some more and scrollbars which are represented as nsDisplayThemedBackground items decide their opaqueness based on a single bool: https://searchfox.org/mozilla-central/source/layout/painting/nsDisplayList.cpp#4971 we then compute the size of the surface they draw to in two completely different ways. I wonder if instead we can just ask the nsDisplayThemedBackground item the size it wants and only create a surface of that size.
| Assignee | ||
Comment 18•6 years ago
•
|
||
My newest version of the patch passes without reftest failures. https://treeherder.mozilla.org/#/jobs?repo=try&revision=60fdcf8cf3475afb1e56d35dee30d7e970756757
| Assignee | ||
Comment 19•6 years ago
|
||
When drawing themed backgrounds we snap them therefore we can expose
that in GetOpaqueRegion(). This will help WebRender fallback choose
an appropriately sized surface for drawing them.
Comment 20•6 years ago
|
||
Updated•6 years ago
|
Comment 21•6 years ago
|
||
| bugherder | ||
| Assignee | ||
Updated•6 years ago
|
Updated•6 years ago
|
Comment 22•6 years ago
|
||
Comment 23•6 years ago
|
||
| bugherder | ||
Description
•