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 #3844

Merged
merged 6 commits into from Jan 25, 2020

Backed out 5 changesets (bug 1558926) for WebRender build bustages. C…

…LOSED TREE

Backed out changeset 974bcab6b1bf (bug 1558926)
Backed out changeset 1865e6d29dcf (bug 1558926)
Backed out changeset 92b415dac733 (bug 1558926)
Backed out changeset 30481c41873a (bug 1558926)
Backed out changeset a4d9a1af297a (bug 1558926)

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/65b1787817bdd4addf847582f564a68afabdb932
  • Loading branch information
cristianbrindusan authored and moz-gfx committed Jan 25, 2020
commit ef9c7ee3476be7107959eb93f72027c39b9bdd8c
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

use api::{BuiltDisplayList, DisplayItemCache, ColorF, DynamicProperties, Epoch, FontRenderMode};
use api::{BuiltDisplayList, ColorF, DynamicProperties, Epoch, FontRenderMode};
use api::{PipelineId, PropertyBinding, PropertyBindingId, MixBlendMode, StackingContext};
use api::units::*;
use crate::composite::CompositorKind;
@@ -127,18 +127,19 @@ impl SceneProperties {
/// A representation of the layout within the display port for a given document or iframe.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Clone)]
pub struct ScenePipeline {
pub pipeline_id: PipelineId,
pub viewport_size: LayoutSize,
pub content_size: LayoutSize,
pub background_color: Option<ColorF>,
pub display_list: BuiltDisplayList,
pub display_list_cache: DisplayItemCache,
}

/// A complete representation of the layout bundling visible pipelines together.
#[cfg_attr(feature = "capture", derive(Serialize))]
#[cfg_attr(feature = "replay", derive(Deserialize))]
#[derive(Clone)]
pub struct Scene {
pub root_pipeline_id: Option<PipelineId>,
pub pipelines: FastHashMap<PipelineId, ScenePipeline>,
@@ -167,20 +168,12 @@ impl Scene {
viewport_size: LayoutSize,
content_size: LayoutSize,
) {
let pipeline = self.pipelines.remove(&pipeline_id);
let mut display_list_cache = pipeline.map_or(Default::default(), |p| {
p.display_list_cache
});

display_list_cache.update(&display_list);

let new_pipeline = ScenePipeline {
pipeline_id,
viewport_size,
content_size,
background_color,
display_list,
display_list_cache,
};

self.pipelines.insert(pipeline_id, new_pipeline);
@@ -255,7 +255,6 @@ pub struct SceneBuilderThread {
size_of_ops: Option<MallocSizeOfOps>,
hooks: Option<Box<dyn SceneBuilderHooks + Send>>,
simulate_slow_ms: u32,
removed_pipelines: FastHashSet<PipelineId>
}

pub struct SceneBuilderThreadChannels {
@@ -300,7 +299,6 @@ impl SceneBuilderThread {
size_of_ops,
hooks,
simulate_slow_ms: 0,
removed_pipelines: FastHashSet::default(),
}
}

@@ -531,24 +529,7 @@ impl SceneBuilderThread {
.or_insert_with(|| Document::new(Scene::new()));
let scene = &mut doc.scene;

for &(pipeline_id, epoch) in &txn.epoch_updates {
scene.update_epoch(pipeline_id, epoch);
}

if let Some(id) = txn.set_root_pipeline {
scene.set_root_pipeline_id(id);
}

for &(pipeline_id, _) in &txn.removed_pipelines {
scene.remove_pipeline(pipeline_id);
self.removed_pipelines.insert(pipeline_id);
}

for update in txn.display_list_updates.drain(..) {
if self.removed_pipelines.contains(&update.pipeline_id) {
continue;
}

scene.set_display_list(
update.pipeline_id,
update.epoch,
@@ -559,7 +540,17 @@ impl SceneBuilderThread {
);
}

self.removed_pipelines.clear();
for &(pipeline_id, epoch) in &txn.epoch_updates {
scene.update_epoch(pipeline_id, epoch);
}

if let Some(id) = txn.set_root_pipeline {
scene.set_root_pipeline_id(id);
}

for &(pipeline_id, _) in &txn.removed_pipelines {
scene.remove_pipeline(pipeline_id)
}

let mut built_scene = None;
let mut interner_updates = None;
@@ -449,9 +449,8 @@ impl<'a> SceneBuilder<'a> {
device_pixel_scale,
);

let cache = &root_pipeline.display_list_cache;
builder.build_items(
&mut root_pipeline.display_list.iter_with_cache(cache),
&mut root_pipeline.display_list.iter(),
root_pipeline.pipeline_id,
true,
);
@@ -688,54 +687,30 @@ impl<'a> SceneBuilder<'a> {
apply_pipeline_clip: bool,
) {
loop {
let item = match traversal.next() {
Some(item) => item,
None => break,
};
let subtraversal = {
let item = match traversal.next() {
Some(item) => item,
None => break,
};

let subtraversal = match item.item() {
DisplayItem::PushStackingContext(ref info) => {
let space = self.get_space(&info.spatial_id);
let mut subtraversal = item.sub_iter();
self.build_stacking_context(
&mut subtraversal,
pipeline_id,
&info.stacking_context,
space,
info.origin,
item.filters(),
&item.filter_datas(),
item.filter_primitives(),
info.prim_flags,
apply_pipeline_clip,
);
Some(subtraversal)
match item.item() {
DisplayItem::PopReferenceFrame |
DisplayItem::PopStackingContext => return,
_ => (),
}
DisplayItem::PushReferenceFrame(ref info) => {
let parent_space = self.get_space(&info.parent_spatial_id);
let mut subtraversal = item.sub_iter();
self.build_reference_frame(
&mut subtraversal,
pipeline_id,
parent_space,
info.origin,
&info.reference_frame,
apply_pipeline_clip,
);
Some(subtraversal)
}
DisplayItem::PopReferenceFrame |
DisplayItem::PopStackingContext => return,
_ => None,

self.build_item(
item,
pipeline_id,
apply_pipeline_clip,
)
};

// If build_item created a sub-traversal, we need `traversal` to have the
// same state as the completed subtraversal, so we reinitialize it here.
if let Some(mut subtraversal) = subtraversal {
subtraversal.merge_debug_stats_from(traversal);
*traversal = subtraversal;
} else {
self.build_item(item, pipeline_id, apply_pipeline_clip);
}
}

@@ -983,10 +958,8 @@ impl<'a> SceneBuilder<'a> {

self.rf_mapper.push_scope();
self.iframe_depth += 1;

let cache = &pipeline.display_list_cache;
self.build_items(
&mut pipeline.display_list.iter_with_cache(cache),
&mut pipeline.display_list.iter(),
pipeline.pipeline_id,
true,
);
@@ -1088,10 +1061,10 @@ impl<'a> SceneBuilder<'a> {

fn build_item<'b>(
&'b mut self,
item: DisplayItemRef,
item: DisplayItemRef<'a, 'b>,
pipeline_id: PipelineId,
apply_pipeline_clip: bool,
) {
) -> Option<BuiltDisplayListIter<'a>> {
match *item.item() {
DisplayItem::Image(ref info) => {
let (layout, _, clip_and_scroll) = self.process_common_properties_with_bounds(
@@ -1326,6 +1299,36 @@ impl<'a> SceneBuilder<'a> {
item.gradient_stops(),
);
}
DisplayItem::PushStackingContext(ref info) => {
let space = self.get_space(&info.spatial_id);
let mut subtraversal = item.sub_iter();
self.build_stacking_context(
&mut subtraversal,
pipeline_id,
&info.stacking_context,
space,
info.origin,
item.filters(),
item.filter_datas(),
item.filter_primitives(),
info.prim_flags,
apply_pipeline_clip,
);
return Some(subtraversal);
}
DisplayItem::PushReferenceFrame(ref info) => {
let parent_space = self.get_space(&info.parent_spatial_id);
let mut subtraversal = item.sub_iter();
self.build_reference_frame(
&mut subtraversal,
pipeline_id,
parent_space,
info.origin,
&info.reference_frame,
apply_pipeline_clip,
);
return Some(subtraversal);
}
DisplayItem::Iframe(ref info) => {
let space = self.get_space(&info.space_and_clip.spatial_id);
self.build_iframe(
@@ -1453,18 +1456,10 @@ impl<'a> SceneBuilder<'a> {
DisplayItem::SetFilterData |
DisplayItem::SetFilterPrimitives => {}

// Special items that are handled in the parent method
DisplayItem::PushStackingContext(..) |
DisplayItem::PushReferenceFrame(..) |
DisplayItem::PopReferenceFrame |
DisplayItem::PopStackingContext => {
unreachable!("Should have returned in parent method.")
}

DisplayItem::ReuseItem(..) => {
unreachable!("Iterator logic error")
}

DisplayItem::PushShadow(info) => {
let clip_and_scroll = self.get_clip_and_scroll(
&info.space_and_clip.clip_id,
@@ -1478,6 +1473,8 @@ impl<'a> SceneBuilder<'a> {
self.pop_all_shadows();
}
}

None
}

// Given a list of clip sources, a positioning node and
@@ -33,10 +33,6 @@ pub const MAX_BLUR_RADIUS: f32 = 300.;
/// events.
pub type ItemTag = (u64, u16);

/// An identifier used to refer to previously sent display items. Currently it
/// refers to individual display items, but this may change later.
pub type ItemKey = u16;

bitflags! {
#[repr(C)]
#[derive(Deserialize, MallocSizeOf, Serialize, PeekPoke)]
@@ -78,8 +74,6 @@ pub struct CommonItemProperties {
pub hit_info: Option<ItemTag>,
/// Various flags describing properties of this primitive.
pub flags: PrimitiveFlags,
/// The unique id of this display item.
pub item_key: Option<ItemKey>
}

impl CommonItemProperties {
@@ -94,7 +88,6 @@ impl CommonItemProperties {
clip_id: space_and_clip.clip_id,
hit_info: None,
flags: PrimitiveFlags::default(),
item_key: None,
}
}
}
@@ -163,8 +156,6 @@ pub enum DisplayItem {
PopReferenceFrame,
PopStackingContext,
PopAllShadows,

ReuseItem(ItemKey),
}

/// This is a "complete" version of the DisplayItem, with all implicit trailing
@@ -205,8 +196,6 @@ pub enum DebugDisplayItem {
PopReferenceFrame,
PopStackingContext,
PopAllShadows,

ReuseItem(ItemKey),
}

#[derive(Clone, Copy, Debug, Default, Deserialize, PartialEq, Serialize, PeekPoke)]
@@ -1480,7 +1469,6 @@ impl DisplayItem {
DisplayItem::Rectangle(..) => "rectangle",
DisplayItem::ScrollFrame(..) => "scroll_frame",
DisplayItem::SetGradientStops => "set_gradient_stops",
DisplayItem::ReuseItem(..) => "reuse_item",
DisplayItem::StickyFrame(..) => "sticky_frame",
DisplayItem::Text(..) => "text",
DisplayItem::YuvImage(..) => "yuv_image",
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.