Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync changes from mozilla-central gfx/wr #3838

Merged
merged 2 commits into from Jan 21, 2020
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

Bug 1607836 - Preallocate picture task dependency vectors. r=gw

Unlike other types of render tasks, pictures can have hundreds of dependencies. The dependency vector is re-built every frame, leading to a lot of vector re-allocations in some pages.

Depends on D60151

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

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/dfe4fa983d2b1eaaa3db2141a5e1c0f5ae58d5d7
  • Loading branch information
nical authored and moz-gfx committed Jan 21, 2020
commit dd9a549e79740c4b943dbb78f3a09d6b63981387
@@ -438,6 +438,7 @@ impl FrameBuilder {

let pic = &mut scene.prim_store.pictures[scene.root_pic_index.0];
pic.restore_context(
ROOT_SURFACE_INDEX,
prim_list,
pic_context,
pic_state,
@@ -3277,6 +3277,10 @@ pub struct PicturePrimitive {

/// The config options for this picture.
pub options: PictureOptions,

/// Keep track of the number of render tasks dependencies to pre-allocate
/// the dependency array next frame.
num_render_tasks: usize,
}

impl PicturePrimitive {
@@ -3419,6 +3423,7 @@ impl PicturePrimitive {
tile_cache,
options,
segments_are_valid: false,
num_render_tasks: 0,
}
}

@@ -3461,6 +3466,9 @@ impl PicturePrimitive {
return None;
}

let task_id = frame_state.surfaces[parent_surface_index.0].render_tasks.unwrap().port;
frame_state.render_tasks[task_id].children.reserve(self.num_render_tasks);

// Extract the raster and surface spatial nodes from the raster
// config, if this picture establishes a surface. Otherwise just
// pass in the spatial node indices from the parent context.
@@ -4225,6 +4233,7 @@ impl PicturePrimitive {

pub fn restore_context(
&mut self,
parent_surface_index: SurfaceIndex,
prim_list: PrimitiveList,
context: PictureContext,
state: PictureState,
@@ -4235,6 +4244,9 @@ impl PicturePrimitive {
frame_state.pop_dirty_region();
}

let task_id = frame_state.surfaces[parent_surface_index.0].render_tasks.unwrap().port;
self.num_render_tasks = frame_state.render_tasks[task_id].children.len();

self.prim_list = prim_list;
self.state = Some(state);
}
@@ -2732,6 +2732,7 @@ impl PrimitiveStore {
// Restore the dependencies (borrow check dance)
self.pictures[pic_context_for_children.pic_index.0]
.restore_context(
pic_context.surface_index,
prim_list,
pic_context_for_children,
pic_state_for_children,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.