Bug 1733030 - Remove preserve_frame_state functionality r=gfx-reviewers,nical

It's not needed by Gecko, and complicates work in progress to
retain the spatial tree across display lists.

Differential Revision: https://phabricator.services.mozilla.com/D126863
This commit is contained in:
Glenn Watson 2021-10-04 20:14:04 +00:00
parent d63b7145ab
commit 41fd1abba4
12 changed files with 3 additions and 98 deletions

View File

@ -1855,11 +1855,6 @@ pub extern "C" fn wr_transaction_set_display_list(
) {
let color = if background.a == 0.0 { None } else { Some(background) };
// See the documentation of set_display_list in api.rs. I don't think
// it makes a difference in gecko at the moment(until APZ is figured out)
// but I suppose it is a good default.
let preserve_frame_state = true;
let payload = DisplayListPayload {
items_data: dl_items_data.flush_into_vec(),
cache_data: dl_cache_data.flush_into_vec(),
@ -1868,7 +1863,7 @@ pub extern "C" fn wr_transaction_set_display_list(
let dl = BuiltDisplayList::from_data(payload, dl_descriptor);
txn.set_display_list(epoch, color, viewport_size, (pipeline_id, dl), preserve_frame_state);
txn.set_display_list(epoch, color, viewport_size, (pipeline_id, dl));
}
#[no_mangle]
@ -2152,7 +2147,6 @@ pub unsafe extern "C" fn wr_transaction_clear_display_list(
epoch: WrEpoch,
pipeline_id: WrPipelineId,
) {
let preserve_frame_state = true;
let mut frame_builder = WebRenderFrameBuilder::new(pipeline_id);
frame_builder.dl_builder.begin();
@ -2161,7 +2155,6 @@ pub unsafe extern "C" fn wr_transaction_clear_display_list(
None,
LayoutSize::new(0.0, 0.0),
frame_builder.dl_builder.end(),
preserve_frame_state,
);
}

View File

@ -484,7 +484,6 @@ fn main() {
None,
layout_size,
root_builder.end(),
true,
);
}
@ -523,7 +522,6 @@ fn main() {
None,
layout_size,
root_builder.end(),
true,
);
}
Invalidations::Scrolling => {

View File

@ -212,7 +212,6 @@ pub fn main_wrapper<E: Example>(
Some(ColorF::new(0.3, 0.0, 0.0, 1.0)),
layout_size,
builder.end(),
true,
);
txn.set_root_pipeline(pipeline_id);
txn.generate_frame(0);
@ -303,7 +302,6 @@ pub fn main_wrapper<E: Example>(
Some(ColorF::new(0.3, 0.0, 0.0, 1.0)),
layout_size,
builder.end(),
true,
);
txn.generate_frame(0);
}

View File

@ -123,7 +123,6 @@ impl Example for App {
None,
doc.content_rect.size(),
builder.end(),
true,
);
txn.generate_frame(0);
api.send_transaction(doc.id, txn);

View File

@ -60,7 +60,6 @@ impl Example for App {
None,
sub_bounds.size(),
sub_builder.end(),
true,
);
api.send_transaction(document_id, txn);

View File

@ -282,7 +282,6 @@ impl Window {
None,
layout_size,
builder.end(),
true,
);
txn.set_root_pipeline(self.pipeline_id);
txn.generate_frame(0);

View File

@ -269,16 +269,12 @@ impl Transaction {
/// * `viewport_size`: The size of the viewport for this frame.
/// * `pipeline_id`: The ID of the pipeline that is supplying this display list.
/// * `display_list`: The root Display list used in this frame.
/// * `preserve_frame_state`: If a previous frame exists which matches this pipeline
/// id, this setting determines if frame state (such as scrolling
/// position) should be preserved for this new display list.
pub fn set_display_list(
&mut self,
epoch: Epoch,
background: Option<ColorF>,
viewport_size: LayoutSize,
(pipeline_id, mut display_list): (PipelineId, BuiltDisplayList),
preserve_frame_state: bool,
) {
display_list.set_send_time_ns(precise_time_ns());
self.scene_ops.push(
@ -288,7 +284,6 @@ impl Transaction {
pipeline_id,
background,
viewport_size,
preserve_frame_state,
}
);
}
@ -776,8 +771,6 @@ pub enum SceneMsg {
background: Option<ColorF>,
///
viewport_size: LayoutSize,
///
preserve_frame_state: bool,
},
///
SetDocumentView {

View File

@ -579,10 +579,8 @@ impl Document {
resource_cache,
);
let old_scrolling_states = self.scene.spatial_tree.drain();
self.scene = built_scene;
self.scratch.recycle(recycler);
self.scene.spatial_tree.finalize_and_apply_pending_scroll_offsets(old_scrolling_states);
}
}
@ -831,12 +829,6 @@ impl RenderBackend {
resume_rx.recv().ok();
}
for pipeline_id in &txn.discard_frame_state_for_pipelines {
doc.scene
.spatial_tree
.discard_frame_state_for_pipeline(*pipeline_id);
}
self.resource_cache.add_rasterized_blob_images(
txn.rasterized_blobs.take(),
&mut doc.profile,

View File

@ -65,7 +65,6 @@ pub struct BuiltTransaction {
pub interner_updates: Option<InternerUpdates>,
pub render_frame: bool,
pub invalidate_rendered_frame: bool,
pub discard_frame_state_for_pipelines: Vec<PipelineId>,
pub profile: TransactionProfile,
pub frame_stats: FullFrameStats,
}
@ -451,7 +450,6 @@ impl SceneBuilderThread {
blob_rasterizer: None,
frame_ops: Vec::new(),
removed_pipelines: Vec::new(),
discard_frame_state_for_pipelines: Vec::new(),
notifications: Vec::new(),
interner_updates,
profile: TransactionProfile::new(),
@ -504,7 +502,6 @@ impl SceneBuilderThread {
let mut profile = txn.profile.take();
let scene_build_start = precise_time_ns();
let mut discard_frame_state_for_pipelines = Vec::new();
let mut removed_pipelines = Vec::new();
let mut rebuild_scene = false;
let mut frame_stats = FullFrameStats::default();
@ -526,7 +523,6 @@ impl SceneBuilderThread {
background,
viewport_size,
display_list,
preserve_frame_state,
} => {
let (builder_start_time_ns, builder_end_time_ns, send_time_ns) =
display_list.times();
@ -557,10 +553,6 @@ impl SceneBuilderThread {
background,
viewport_size,
);
if !preserve_frame_state {
discard_frame_state_for_pipelines.push(pipeline_id);
}
}
SceneMsg::SetRootPipeline(pipeline_id) => {
if scene.root_pipeline_id != Some(pipeline_id) {
@ -638,7 +630,6 @@ impl SceneBuilderThread {
blob_rasterizer: txn.blob_rasterizer,
frame_ops: txn.frame_ops,
removed_pipelines,
discard_frame_state_for_pipelines,
notifications: txn.notifications,
interner_updates,
profile,

View File

@ -7,17 +7,15 @@ use api::{PipelineId, ScrollClamping, ScrollSensitivity, SpatialTreeItemKey};
use api::units::*;
use euclid::Transform3D;
use crate::gpu_types::TransformPalette;
use crate::internal_types::{FastHashMap, FastHashSet};
use crate::internal_types::FastHashSet;
use crate::print_tree::{PrintableTree, PrintTree, PrintTreePrinter};
use crate::scene::SceneProperties;
use crate::spatial_node::{ScrollFrameInfo, SpatialNode, SpatialNodeType, StickyFrameInfo};
use crate::spatial_node::{SpatialNode, SpatialNodeType, StickyFrameInfo};
use crate::spatial_node::{SpatialNodeUid, ScrollFrameKind, SceneSpatialNode, SpatialNodeInfo};
use std::{ops, u32};
use crate::util::{FastTransform, LayoutToWorldFastTransform, MatrixHelpers, ScaleOffset, scale_factors};
use smallvec::SmallVec;
pub type ScrollStates = FastHashMap<ExternalScrollId, ScrollFrameInfo>;
/// An id that identifies coordinate systems in the SpatialTree. Each
/// coordinate system has an id and those ids will be shared when the coordinates
/// system are the same or are in the same axis-aligned space. This allows
@ -405,12 +403,6 @@ pub struct SpatialTree {
/// they have a transform that is not a simple 2d translation.
coord_systems: Vec<CoordinateSystem>,
pending_scroll_offsets: FastHashMap<ExternalScrollId, (LayoutPoint, ScrollClamping)>,
/// A set of pipelines which should be discarded the next time this
/// tree is drained.
pipelines_to_discard: FastHashSet<PipelineId>,
root_reference_frame_index: SpatialNodeIndex,
/// Stack of current state for each parent node while traversing and updating tree
@ -544,8 +536,6 @@ impl SpatialTree {
SpatialTree {
spatial_nodes,
coord_systems: Vec::new(),
pending_scroll_offsets: FastHashMap::default(),
pipelines_to_discard: FastHashSet::default(),
root_reference_frame_index: scene.root_reference_frame_index,
update_state_stack: Vec::new(),
}
@ -725,26 +715,6 @@ impl SpatialTree {
self.root_reference_frame_index
}
pub fn drain(&mut self) -> ScrollStates {
let mut scroll_states = FastHashMap::default();
for old_node in &mut self.spatial_nodes.drain(..) {
if self.pipelines_to_discard.contains(&old_node.pipeline_id) {
continue;
}
match old_node.node_type {
SpatialNodeType::ScrollFrame(info) => {
scroll_states.insert(info.external_id, info);
}
_ => {}
}
}
self.coord_systems.clear();
self.pipelines_to_discard.clear();
scroll_states
}
pub fn scroll_node(
&mut self,
origin: LayoutPoint,
@ -757,7 +727,6 @@ impl SpatialTree {
}
}
self.pending_scroll_offsets.insert(id, (origin, clamp));
false
}
@ -836,27 +805,6 @@ impl SpatialTree {
TransformPalette::new(self.spatial_nodes.len())
}
pub fn finalize_and_apply_pending_scroll_offsets(&mut self, old_states: ScrollStates) {
for node in &mut self.spatial_nodes {
let external_id = match node.node_type {
SpatialNodeType::ScrollFrame(ScrollFrameInfo { external_id, ..}) => external_id,
_ => continue,
};
if let Some(scrolling_state) = old_states.get(&external_id) {
node.apply_old_scrolling_state(scrolling_state);
}
if let Some((offset, clamping)) = self.pending_scroll_offsets.remove(&external_id) {
node.set_scroll_origin(&offset, clamping);
}
}
}
pub fn discard_frame_state_for_pipeline(&mut self, pipeline_id: PipelineId) {
self.pipelines_to_discard.insert(pipeline_id);
}
fn print_node<T: PrintTreePrinter>(
&self,
index: SpatialNodeIndex,

View File

@ -103,7 +103,6 @@ impl<'a> RawtestHarness<'a> {
root_background_color,
layout_size,
builder.end(),
false,
);
epoch.0 += 1;
@ -1252,7 +1251,6 @@ impl<'a> RawtestHarness<'a> {
Some(ColorF::new(1.0, 1.0, 1.0, 1.0)),
layout_size,
builder.end(),
false,
);
txn.generate_frame(0);
@ -1274,7 +1272,6 @@ impl<'a> RawtestHarness<'a> {
Some(ColorF::new(1.0, 0.0, 0.0, 1.0)),
layout_size,
builder.end(),
false,
);
self.wrench.api.send_transaction(self.wrench.document_id, txn);
@ -1321,7 +1318,6 @@ impl<'a> RawtestHarness<'a> {
Some(ColorF::new(1.0, 0.0, 0.0, 1.0)),
layout_size,
builder.end(),
false,
);
txn.generate_frame(0);
self.wrench.api.send_transaction(doc_id, txn);

View File

@ -573,7 +573,6 @@ impl Wrench {
root_background_color,
self.window_size_f32(),
display_list,
false,
);
}