Bug 1591580 - Support picture caching for parent process content. r=kvark

For content that comes from the parent process (e.g. about:support)
the shape of the display list is slightly different. In these cases
ensure that we setup picture caching slice markers on the root
stacking context.

Differential Revision: https://phabricator.services.mozilla.com/D51540

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Glenn Watson 2019-11-04 19:33:24 +00:00
Родитель d6de8cab3a
Коммит 005d8ccd27
2 изменённых файлов: 25 добавлений и 5 удалений

Просмотреть файл

@ -58,6 +58,16 @@
//! which defines the scissor rect used when replaying the tile's drawing commands and
//! can be used for partial present.
//!
//! ## Display List shape
//!
//! WR will first look for an iframe item in the root stacking context to apply
//! picture caching to. If that's not found, it will apply to the entire root
//! stacking context of the display list. Apart from that, the format of the
//! display list is not important to picture caching. Each time a new scroll root
//! is encountered, a new picture cache slice will be created. If the display
//! list contains more than some arbitrary number of slices (currently 8), the
//! content will all be squashed into a single slice, in order to save GPU memory
//! and compositing performance.
use api::{MixBlendMode, PipelineId, PremultipliedColorF, FilterPrimitiveKind};
use api::{PropertyBinding, PropertyBindingId, FilterPrimitive, FontRenderMode};

Просмотреть файл

@ -352,9 +352,8 @@ pub struct SceneBuilder<'a> {
/// Helper struct to map spatial nodes to external scroll offsets.
external_scroll_mapper: ScrollOffsetMapper,
/// If true, a stacking context with create_tile_cache set to true was found
/// during building.
found_explicit_tile_cache: bool,
/// If true, picture caching setup has already been completed.
picture_caching_initialized: bool,
/// The current recursion depth of iframes encountered. Used to restrict picture
/// caching slices to only the top-level content frame.
@ -407,7 +406,7 @@ impl<'a> SceneBuilder<'a> {
root_pic_index: PictureIndex(0),
rf_mapper: ReferenceFrameMapper::new(),
external_scroll_mapper: ScrollOffsetMapper::new(),
found_explicit_tile_cache: false,
picture_caching_initialized: false,
iframe_depth: 0,
content_slice_count: 0,
picture_cache_spatial_nodes: FastHashSet::default(),
@ -503,6 +502,9 @@ impl<'a> SceneBuilder<'a> {
return;
}
// Ensure that setup_picture_caching has executed
debug_assert!(self.picture_caching_initialized);
// Unconditionally insert a marker to create a picture cache slice on the
// first cluster. This handles implicit picture caches, and also the common
// case, by allowing the root / background primitives to be cached in a slice.
@ -1883,7 +1885,7 @@ impl<'a> SceneBuilder<'a> {
self.content_slice_count = stacking_context.init_picture_caching(&self.clip_scroll_tree);
// Mark that a user supplied tile cache was specified.
self.found_explicit_tile_cache = true;
self.picture_caching_initialized = true;
}
// If the parent context primitives list is empty, it's faster
@ -1904,6 +1906,14 @@ impl<'a> SceneBuilder<'a> {
};
if self.sc_stack.is_empty() {
// If we didn't encounter a content iframe, then set up picture caching slice markers
// on the root stacking context. This can happen in Gecko when the parent process
// provides the content display list (e.g. about:support, about:config etc).
if !self.picture_caching_initialized {
self.content_slice_count = stacking_context.init_picture_caching(&self.clip_scroll_tree);
self.picture_caching_initialized = true;
}
self.setup_picture_caching(
&mut stacking_context.prim_list,
);