Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAllow picture caching to work across scenes (display lists). #3359
Conversation
|
This gives us the ability to cache picture tiles between both frames and scenes. This is a somewhat more interesting patch than all the previous primitive interning changes :) Note that it's still not actually hooked up to create pictures with tile caches enabled (in master), so this shouldn't have any effect on current gecko. Nonetheless, pending try run to be safe: |
indeed! :) a few concerns below
webrender/src/batch.rs, line 1004 at r1 (raw file):
how is it possible for a tile to be visible but not used? webrender/src/picture.rs, line 124 at r1 (raw file):
It's not clear to me why this is needed. My basic understanding was that when a tile is cached for a particular surface, it doesn't depend on the spatial node of this surface, but it depends on all the children spatial nodes that affect primitives intersecting with the tile. Is there ever a case where just checking for webrender/src/picture.rs, line 198 at r1 (raw file):
is it possible for a tile to be valid but not allocated in the texture cache? webrender/src/picture.rs, line 412 at r1 (raw file):
this hashmap is getting grown from zero every time, which is unfortunate. We might want to re-use the existing allocation somehow webrender/src/picture.rs, line 441 at r1 (raw file):
We shouldn't compare those and even access the webrender/src/picture.rs, line 788 at r1 (raw file):
if it was evicted, do we still want to request it? I thought we are going to re-render it instead webrender/src/picture.rs, line 876 at r1 (raw file):
sounds like webrender/src/picture.rs, line 1395 at r1 (raw file):
nit: could be webrender/src/picture.rs, line 2153 at r1 (raw file):
is this changed because we are now manually tracking the tile cache lifetimes? webrender/src/prim_store.rs, line 2618 at r1 (raw file):
for each object with a similar |
This patch hooks up the primitive interning work with the tile caching work. Since we have a uid that guarantees uniqueness of the content of primitives and clip nodes, we can use that to construct a (reasonably) efficient hash key for the content of a tile. Along with some additional information (such as the state of the transforms used by the tile), we can construct a hash key for the content of a tile that is stable across new display lists, even if the shape of the clip-scroll tree changes in ways that don't affect the tile. This patch takes advantage of that to retain tiles when a new scene is built, where the content of a tile would result in the same output.
webrender/src/batch.rs, line 1004 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
If the tile is within the 2d grid boundaries and is visible, but doesn't currently have any primitives in it. webrender/src/picture.rs, line 124 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
The goal here is to ensure that the node indices for a given tile are stable even if the clip-scroll tree itself looks quite different between display lists, so that the hash key is the same. It's quite subtle, and quite possible I'm missing something here too - perhaps worth discussing on IRC. webrender/src/picture.rs, line 198 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
No, that shouldn't be possible. Fixed. webrender/src/picture.rs, line 412 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
It is unfortunate. On the plus side, opacity bindings are very rare and I think we can remove them completely once picture caching is in place. webrender/src/picture.rs, line 441 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Good point! Fixed. webrender/src/picture.rs, line 788 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
The request (perhaps badly named) just updates the epoch and timestamp fields if it is allocated. webrender/src/picture.rs, line 876 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Ah, it does already check for a valid handle - so I removed the webrender/src/picture.rs, line 1395 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Fixed. webrender/src/picture.rs, line 2153 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Having it as eager makes it easier to see in the texture cache debugger that tiles are being dropped, but it's overkill. Leaving it as Auto just means that the texture cache can evict when it wants to, but doesn't need to evict as soon as the tile is unused, if there's no GPU memory pressure. webrender/src/prim_store.rs, line 2618 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
That sounds like a good idea - it could be similar to the drop for GL resources in device. |
|
@kvark Thanks for the review! Addressed those comments, and rebased on current master. Try run looks good (the failures are expected given previous PRs pending update in m-c). |
webrender/src/picture.rs, line 124 at r1 (raw file): Previously, gw3583 (Glenn Watson) wrote…
yeah, I'm just having a hard time imagining that use case webrender/src/prim_store.rs, line 2618 at r1 (raw file): Previously, gw3583 (Glenn Watson) wrote…
added to #3357 (comment) |
|
@bors-servo r+ |
|
|
Allow picture caching to work across scenes (display lists). This patch hooks up the primitive interning work with the tile caching work. Since we have a uid that guarantees uniqueness of the content of primitives and clip nodes, we can use that to construct a (reasonably) efficient hash key for the content of a tile. Along with some additional information (such as the state of the transforms used by the tile), we can construct a hash key for the content of a tile that is stable across new display lists, even if the shape of the clip-scroll tree changes in ways that don't affect the tile. This patch takes advantage of that to retain tiles when a new scene is built, where the content of a tile would result in the same output. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/3359) <!-- Reviewable:end -->
|
|
…73abdb59e76d (WR PR #3359). r=kats servo/webrender#3359 Differential Revision: https://phabricator.services.mozilla.com/D13247 --HG-- extra : moz-landing-system : lando
…73abdb59e76d (WR PR #3359). r=kats servo/webrender#3359 Differential Revision: https://phabricator.services.mozilla.com/D13247
…73abdb59e76d (WR PR #3359). r=kats servo/webrender#3359 Differential Revision: https://phabricator.services.mozilla.com/D13247 UltraBlame original commit: 8692990356a7e39a67ee65909ff01f621d0830fb
…73abdb59e76d (WR PR #3359). r=kats servo/webrender#3359 Differential Revision: https://phabricator.services.mozilla.com/D13247 UltraBlame original commit: 8692990356a7e39a67ee65909ff01f621d0830fb
…73abdb59e76d (WR PR #3359). r=kats servo/webrender#3359 Differential Revision: https://phabricator.services.mozilla.com/D13247 UltraBlame original commit: 8692990356a7e39a67ee65909ff01f621d0830fb
gw3583 commentedNov 27, 2018
•
edited by larsbergstrom
This patch hooks up the primitive interning work with the tile
caching work.
Since we have a uid that guarantees uniqueness of the content of
primitives and clip nodes, we can use that to construct a
(reasonably) efficient hash key for the content of a tile.
Along with some additional information (such as the state of the
transforms used by the tile), we can construct a hash key for
the content of a tile that is stable across new display lists,
even if the shape of the clip-scroll tree changes in ways that
don't affect the tile.
This patch takes advantage of that to retain tiles when a new
scene is built, where the content of a tile would result in
the same output.
This change is