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 upAdd support for caching render tasks across frames and display lists. #2284
Conversation
|
r? @kvark I still need to do a try run - will kick one off shortly. As you may expect, this has some quite significant performance and power saving wins. Next step for box shadows is to optimize the clip masks and the application of the box shadows (which are still way slower than they need to be). |
|
Implementation looks good to me, minus a few non-blocking concerns. Amazing work! Concept-wise, this triggers an alarm. Treating some parts of the texture cache as renderable while mostly using it as a texel storage is not going to make driver's life easier for determining the internal representation of the image (tiling mode, color compression, also cache flush points). I suppose moving the persistent rendered results into separate texture(s) is not a great option in terms of batching and complexity. Perhaps, we'll investigate later if doing a blit from our temporary render target into texture cache is better than rendering into the texture cache directly. Blit requires the TRANSFER_DST flags in Vulkan, which we already need for copying stuff from CPU into the texture cache (with PBOs), so blitting would not incur any additional requirements for the image layout and such. Reviewed 21 of 21 files at r1. webrender/res/brush_image.glsl, line 65 at r1 (raw file):
could also unconditionally have webrender/src/batch.rs, line 472 at r1 (raw file):
nit: can we match webrender/src/render_task.rs, line 660 at r1 (raw file):
please add some comments explain what this is webrender/src/render_task.rs, line 693 at r1 (raw file):
can we do this by asking the texture cache if each particular entry has been evicted (as opposed to introducing webrender/src/render_task.rs, line 712 at r1 (raw file):
nit: webrender/src/render_task.rs, line 723 at r1 (raw file):
note to self: refactor to avoid passing a closure there, e.g. by having a temporary object/builder webrender/src/texture_cache.rs, line 429 at r1 (raw file):
could also go with webrender/src/tiling.rs, line 519 at r1 (raw file):
that's one weird implementation... only having Comments from Reviewable |
|
Review status: 15 of 21 files reviewed at latest revision, 8 unresolved discussions. webrender/res/brush_image.glsl, line 65 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Merged the two similar branches with some ifdef hackery. webrender/src/batch.rs, line 472 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/render_task.rs, line 660 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/render_task.rs, line 693 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Good idea. I added webrender/src/render_task.rs, line 712 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/texture_cache.rs, line 429 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/tiling.rs, line 519 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Good point - fixed. Comments from Reviewable |
|
@kvark Thanks for the review! All comments addressed, I think. I also wondered about whether it makes sense to blit from the intermediate cache in to the texture cache instead of drawing directly. It should be trivial to make it work like that in the future if profiling shows it to be worthwhile. |
|
Reviewed 6 of 6 files at r2. Comments from Reviewable |
|
@bors-servo r+ |
|
|
|
|
|
Rebased and squashed. @bors-servo r=kvark |
|
|
Add support for caching render tasks across frames and display lists. This patch adds the infrastructure required to allow render tasks to be rendered into the texture cache, where they can be stored and referenced across multiple frames. Since the cache key is based on the contents of the task itself, the cache items remain valid even when a new display list is provided, so long as the content of the cached task is the same. When the cache is determined to be valid, the render task is just drawn as a simple image, rather than executing the complex render task chain used to build the output. Convert box-shadows to make use of this new feature. When a new box-shadow is required, the render task chain is set up to draw the minimal box-shadow, and blur it. The blurred result is then stored in the texture cache, available for use on this and subsequent frames. Since items are drawn into the texture cache, this will also help with batching in the future, as we collapse more items to be able to use a simple shader that draws an image from the texture cache. Remove blur regions since they are no longer used or required. Remove old render task sharing within a single frame, it's redundant now. TODO (as future work): * Support caching of RGBA8 render tasks. * Convert other tasks (e.g. clips, drop-shadows) to use cacheable tasks. * Use this as basis for optimizing rendering of static Pictures (e.g. a picture with a filter chain + image). <!-- 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/2284) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
|
|
|
|
This patch adds the infrastructure required to allow render tasks to be rendered into the texture cache, where they can be stored and referenced across multiple frames. Since the cache key is based on the contents of the task itself, the cache items remain valid even when a new display list is provided, so long as the content of the cached task is the same. When the cache is determined to be valid, the render task is just drawn as a simple image, rather than executing the complex render task chain used to build the output. Convert box-shadows to make use of this new feature. When a new box-shadow is required, the render task chain is set up to draw the minimal box-shadow, and blur it. The blurred result is then stored in the texture cache, available for use on this and subsequent frames. Since items are drawn into the texture cache, this will also help with batching in the future, as we collapse more items to be able to use a simple shader that draws an image from the texture cache. Remove blur regions since they are no longer used or required. Remove old render task sharing within a single frame, it's redundant now. TODO (as future work): * Support caching of RGBA8 render tasks. * Convert other tasks (e.g. clips, drop-shadows) to use cacheable tasks. * Use this as basis for optimizing rendering of static Pictures (e.g. a picture with a filter chain + image).
|
@bors-servo r=kvark |
|
|
Add support for caching render tasks across frames and display lists. This patch adds the infrastructure required to allow render tasks to be rendered into the texture cache, where they can be stored and referenced across multiple frames. Since the cache key is based on the contents of the task itself, the cache items remain valid even when a new display list is provided, so long as the content of the cached task is the same. When the cache is determined to be valid, the render task is just drawn as a simple image, rather than executing the complex render task chain used to build the output. Convert box-shadows to make use of this new feature. When a new box-shadow is required, the render task chain is set up to draw the minimal box-shadow, and blur it. The blurred result is then stored in the texture cache, available for use on this and subsequent frames. Since items are drawn into the texture cache, this will also help with batching in the future, as we collapse more items to be able to use a simple shader that draws an image from the texture cache. Remove blur regions since they are no longer used or required. Remove old render task sharing within a single frame, it's redundant now. TODO (as future work): * Support caching of RGBA8 render tasks. * Convert other tasks (e.g. clips, drop-shadows) to use cacheable tasks. * Use this as basis for optimizing rendering of static Pictures (e.g. a picture with a filter chain + image). <!-- 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/2284) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
Add support for caching render tasks across frames and display lists. This patch adds the infrastructure required to allow render tasks to be rendered into the texture cache, where they can be stored and referenced across multiple frames. Since the cache key is based on the contents of the task itself, the cache items remain valid even when a new display list is provided, so long as the content of the cached task is the same. When the cache is determined to be valid, the render task is just drawn as a simple image, rather than executing the complex render task chain used to build the output. Convert box-shadows to make use of this new feature. When a new box-shadow is required, the render task chain is set up to draw the minimal box-shadow, and blur it. The blurred result is then stored in the texture cache, available for use on this and subsequent frames. Since items are drawn into the texture cache, this will also help with batching in the future, as we collapse more items to be able to use a simple shader that draws an image from the texture cache. Remove blur regions since they are no longer used or required. Remove old render task sharing within a single frame, it's redundant now. TODO (as future work): * Support caching of RGBA8 render tasks. * Convert other tasks (e.g. clips, drop-shadows) to use cacheable tasks. * Use this as basis for optimizing rendering of static Pictures (e.g. a picture with a filter chain + image). <!-- 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/2284) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
Add support for caching render tasks across frames and display lists. This patch adds the infrastructure required to allow render tasks to be rendered into the texture cache, where they can be stored and referenced across multiple frames. Since the cache key is based on the contents of the task itself, the cache items remain valid even when a new display list is provided, so long as the content of the cached task is the same. When the cache is determined to be valid, the render task is just drawn as a simple image, rather than executing the complex render task chain used to build the output. Convert box-shadows to make use of this new feature. When a new box-shadow is required, the render task chain is set up to draw the minimal box-shadow, and blur it. The blurred result is then stored in the texture cache, available for use on this and subsequent frames. Since items are drawn into the texture cache, this will also help with batching in the future, as we collapse more items to be able to use a simple shader that draws an image from the texture cache. Remove blur regions since they are no longer used or required. Remove old render task sharing within a single frame, it's redundant now. TODO (as future work): * Support caching of RGBA8 render tasks. * Convert other tasks (e.g. clips, drop-shadows) to use cacheable tasks. * Use this as basis for optimizing rendering of static Pictures (e.g. a picture with a filter chain + image). <!-- 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/2284) <!-- Reviewable:end -->
|
|
|
gwbors says this is good enough, even with travis failures. |
glennw commentedJan 11, 2018
•
edited by larsbergstrom
This patch adds the infrastructure required to allow render tasks
to be rendered into the texture cache, where they can be stored
and referenced across multiple frames.
Since the cache key is based on the contents of the task itself,
the cache items remain valid even when a new display list is provided,
so long as the content of the cached task is the same. When the cache
is determined to be valid, the render task is just drawn as a simple
image, rather than executing the complex render task chain used to
build the output.
Convert box-shadows to make use of this new feature. When a new
box-shadow is required, the render task chain is set up to draw the
minimal box-shadow, and blur it. The blurred result is then stored in
the texture cache, available for use on this and subsequent frames.
Since items are drawn into the texture cache, this will also help
with batching in the future, as we collapse more items to be able to
use a simple shader that draws an image from the texture cache.
Remove blur regions since they are no longer used or required.
Remove old render task sharing within a single frame, it's redundant now.
TODO (as future work):
This change is