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

Merged
merged 11 commits into from Jan 9, 2020
Prev

Backed out 8 changesets (bug 1607697) for Build bustages. CLOSED TREE

Backed out changeset a3942fa2644c (bug 1607697)
Backed out changeset 6bf3305bb689 (bug 1607697)
Backed out changeset 3af5a9700d47 (bug 1607697)
Backed out changeset 6101f5e31e46 (bug 1607697)
Backed out changeset d70cc2bb33f6 (bug 1607697)
Backed out changeset 8490fa04e0ee (bug 1607697)
Backed out changeset 6c1778a36720 (bug 1607697)
Backed out changeset 9e830c9157ae (bug 1607697)

[wrupdater] From https://hg.mozilla.org/mozilla-central/rev/c2dd65b196d31e375f8dd4b1ac91e955847ac3c7
  • Loading branch information
dgluca authored and moz-gfx committed Jan 8, 2020
commit 3e575cc5bbd345700f4d4755ec152d31daf5f2c9
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#![allow(dead_code)]
#![cfg_attr(feature = "cargo-clippy", allow(clippy::excessive_precision))]

use api::ColorF;

@@ -165,7 +165,7 @@ fn push_component_transfer_data(
request: &mut GpuDataRequest,
) {
match func_comp {
SFilterDataComponent::Identity => {}
SFilterDataComponent::Identity => { return; }
SFilterDataComponent::Table(values) |
SFilterDataComponent::Discrete(values) => {
// Push a 256 entry lookup table.
@@ -600,7 +600,7 @@ pub fn compute_valid_tiles_if_bounds_change(
return Some(TileRange::zero());
}

let intersection = intersection.unwrap_or_else(DeviceIntRect::zero);
let intersection = intersection.unwrap_or(DeviceIntRect::zero());

let left = prev_rect.min_x() != new_rect.min_x();
let right = prev_rect.max_x() != new_rect.max_x();
@@ -41,9 +41,6 @@ doesn't only contain trivial geometry, it can also store another
[stacking_contexts]: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context
*/

#![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal, clippy::new_without_default, clippy::too_many_arguments))]


// Cribbed from the |matches| crate, for simplicity.
macro_rules! matches {
($expression:expr, $($pattern:tt)+) => {
@@ -742,7 +742,7 @@ impl Tile {
self.clipped_rect = self.rect
.intersection(&ctx.local_rect)
.and_then(|r| r.intersection(&ctx.local_clip_rect))
.unwrap_or_else(PictureRect::zero);
.unwrap_or(PictureRect::zero());

self.world_rect = ctx.pic_to_world_mapper
.map(&self.rect)
@@ -938,7 +938,7 @@ impl Tile {
// Ensure that the dirty rect doesn't extend outside the local tile rect.
self.dirty_rect = self.dirty_rect
.intersection(&self.rect)
.unwrap_or_else(PictureRect::zero);
.unwrap_or(PictureRect::zero());

// See if this tile is a simple color, in which case we can just draw
// it as a rect, and avoid allocating a texture surface and drawing it.
@@ -1350,7 +1350,7 @@ impl DirtyRegion {
/// Creates a record of this dirty region for exporting to test infrastructure.
pub fn record(&self) -> RecordedDirtyRegion {
let mut rects: Vec<WorldRect> =
self.dirty_rects.iter().map(|r| r.world_rect).collect();
self.dirty_rects.iter().map(|r| r.world_rect.clone()).collect();
rects.sort_unstable_by_key(|r| (r.origin.y as usize, r.origin.x as usize));
RecordedDirtyRegion { rects }
}
@@ -1828,7 +1828,7 @@ impl TileCacheInstance {

let needed_rect_in_pic_space = desired_rect_in_pic_space
.intersection(&pic_rect)
.unwrap_or_else(PictureRect::zero);
.unwrap_or(PictureRect::zero());

let p0 = needed_rect_in_pic_space.origin;
let p1 = needed_rect_in_pic_space.bottom_right();
@@ -2009,9 +2009,10 @@ impl TileCacheInstance {
// If the clip has the same spatial node, the relative transform
// will always be the same, so there's no need to depend on it.
let clip_node = &data_stores.clip[clip_instance.handle];
if clip_node.item.spatial_node_index != self.spatial_node_index
&& !prim_info.spatial_nodes.contains(&clip_node.item.spatial_node_index) {
prim_info.spatial_nodes.push(clip_node.item.spatial_node_index);
if clip_node.item.spatial_node_index != self.spatial_node_index {
if !prim_info.spatial_nodes.contains(&clip_node.item.spatial_node_index) {
prim_info.spatial_nodes.push(clip_node.item.spatial_node_index);
}
}
}

@@ -2122,10 +2123,10 @@ impl TileCacheInstance {

// If a text run is on a child surface, the subpx mode will be
// correctly determined as we recurse through pictures in take_context.
if on_picture_surface
&& subpx_requested
&& !self.backdrop.rect.contains_rect(&pic_clip_rect) {
self.subpixel_mode = SubpixelMode::Deny;
if on_picture_surface && subpx_requested {
if !self.backdrop.rect.contains_rect(&pic_clip_rect) {
self.subpixel_mode = SubpixelMode::Deny;
}
}
}
}
@@ -2174,13 +2175,13 @@ impl TileCacheInstance {
}
};

if is_suitable_backdrop
&& !prim_clip_chain.needs_mask
&& pic_clip_rect.contains_rect(&self.backdrop.rect) {
self.backdrop = BackdropInfo {
rect: pic_clip_rect,
kind: backdrop_candidate,
};
if is_suitable_backdrop {
if !prim_clip_chain.needs_mask && pic_clip_rect.contains_rect(&self.backdrop.rect) {
self.backdrop = BackdropInfo {
rect: pic_clip_rect,
kind: backdrop_candidate,
}
}
}
}

@@ -3610,7 +3611,7 @@ impl PicturePrimitive {
// the tile rects below for occlusion testing to the relevant area.
let local_clip_rect = tile_cache.local_rect
.intersection(&tile_cache.local_clip_rect)
.unwrap_or_else(PictureRect::zero);
.unwrap_or(PictureRect::zero());

let world_clip_rect = map_pic_to_world
.map(&local_clip_rect)
@@ -4404,11 +4405,13 @@ impl PicturePrimitive {
debug_assert_eq!(surface_index, raster_config.surface_index);

// Check if any of the surfaces can't be rasterized in local space but want to.
if raster_config.establishes_raster_root
&& (surface_rect.size.width > MAX_SURFACE_SIZE
|| surface_rect.size.height > MAX_SURFACE_SIZE) {
raster_config.establishes_raster_root = false;
state.are_raster_roots_assigned = false;
if raster_config.establishes_raster_root {
if surface_rect.size.width > MAX_SURFACE_SIZE ||
surface_rect.size.height > MAX_SURFACE_SIZE
{
raster_config.establishes_raster_root = false;
state.are_raster_roots_assigned = false;
}
}

// Set the estimated and precise local rects. The precise local rect
@@ -5105,7 +5108,7 @@ impl TileNode {
.collect();

self.kind = TileNodeKind::Node {
children,
children: children,
};
}
Some(TileModification::Merge) => {
@@ -365,7 +365,7 @@ impl FontContext {
}

pub fn delete_font(&mut self, font_key: &FontKey) {
if self.faces.remove(font_key).is_some() {
if let Some(_) = self.faces.remove(font_key) {
self.variations.retain(|k, _| k.0 != *font_key);
}
}
@@ -253,7 +253,7 @@ impl FontContext {
let b = pixel[2];
print!("({}, {}, {}) ", r, g, b,);
}
println!();
println!("");
}
}

@@ -125,7 +125,7 @@ impl PrimitiveOpacity {
}
}

pub fn combine(self, other: PrimitiveOpacity) -> PrimitiveOpacity {
pub fn combine(&self, other: PrimitiveOpacity) -> PrimitiveOpacity {
PrimitiveOpacity{
is_opaque: self.is_opaque && other.is_opaque
}
@@ -378,13 +378,13 @@ impl ClipTaskIndex {
pub struct PictureIndex(pub usize);

impl GpuCacheHandle {
pub fn as_int(self, gpu_cache: &GpuCache) -> i32 {
pub fn as_int(&self, gpu_cache: &GpuCache) -> i32 {
gpu_cache.get_address(self).as_int()
}
}

impl GpuCacheAddress {
pub fn as_int(self) -> i32 {
pub fn as_int(&self) -> i32 {
// TODO(gw): Temporarily encode GPU Cache addresses as a single int.
// In the future, we can change the PrimitiveInstanceData struct
// to use 2x u16 for the vertex attribute instead of an i32.
@@ -2018,8 +2018,10 @@ impl PrimitiveStore {
let pic = &self.pictures[pic_index.0];
prim_instance.prim_origin = pic.precise_local_rect.origin;

if prim_instance.is_chased() && pic.estimated_local_rect != pic.precise_local_rect {
println!("\testimate {:?} adjusted to {:?}", pic.estimated_local_rect, pic.precise_local_rect);
if prim_instance.is_chased() {
if pic.estimated_local_rect != pic.precise_local_rect {
println!("\testimate {:?} adjusted to {:?}", pic.estimated_local_rect, pic.precise_local_rect);
}
}

let mut shadow_rect = pic.precise_local_rect;
@@ -2251,11 +2253,9 @@ impl PrimitiveStore {
frame_state.scratch.push_debug_rect(debug_rect, debug_color, debug_color.scale_alpha(0.5));
}
} else if frame_context.debug_flags.contains(::api::DebugFlags::OBSCURE_IMAGES) {
let is_image = matches!(
prim_instance.kind,
PrimitiveInstanceKind::Image { .. } | PrimitiveInstanceKind::YuvImage { .. }
);
if is_image {
if matches!(prim_instance.kind, PrimitiveInstanceKind::Image { .. } |
PrimitiveInstanceKind::YuvImage { .. })
{
// We allow "small" images, since they're generally UI elements.
let rect = clipped_world_rect * frame_context.global_device_pixel_scale;
if rect.size.width > 70.0 && rect.size.height > 70.0 {
@@ -958,12 +958,12 @@ impl ProfileGraph {

for value in &self.values {
stats.min_value = stats.min_value.min(*value);
stats.mean_value += *value;
stats.mean_value = stats.mean_value + *value;
stats.max_value = stats.max_value.max(*value);
}

if !self.values.is_empty() {
stats.mean_value /= self.values.len() as f32;
stats.mean_value = stats.mean_value / self.values.len() as f32;
}

stats
@@ -456,10 +456,11 @@ impl Document {
}
};

if self.hit_tester.is_some()
&& self.scroll_nearest_scrolling_ancestor(delta, node_index) {
self.hit_tester_is_valid = false;
self.frame_is_valid = false;
if self.hit_tester.is_some() {
if self.scroll_nearest_scrolling_ancestor(delta, node_index) {
self.hit_tester_is_valid = false;
self.frame_is_valid = false;
}
}

return DocumentOps {
@@ -1632,19 +1633,19 @@ impl RenderBackend {
serde_json::to_string(&debug_root).unwrap()
}

fn report_memory(&mut self, tx: MsgSender<Box<MemoryReport>>) {
let mut report = Box::new(MemoryReport::default());
fn report_memory(&mut self, tx: MsgSender<MemoryReport>) {
let mut report = MemoryReport::default();
let ops = self.size_of_ops.as_mut().unwrap();
let op = ops.size_of_op;
report.gpu_cache_metadata = self.gpu_cache.size_of(ops);
for doc in self.documents.values() {
for (_id, doc) in &self.documents {
report.clip_stores += doc.scene.clip_store.size_of(ops);
report.hit_testers += doc.hit_tester.size_of(ops);

doc.data_stores.report_memory(ops, &mut report)
}

(*report) += self.resource_cache.report_memory(op);
report += self.resource_cache.report_memory(op);

// Send a message to report memory on the scene-builder thread, which
// will add its report to this one and send the result back to the original
@@ -1885,7 +1886,7 @@ impl RenderBackend {

scenes_to_build.push(LoadScene {
document_id: id,
scene,
scene: scene,
view: view.clone(),
config: self.frame_config.clone(),
output_pipelines: doc.output_pipelines.clone(),
@@ -1452,7 +1452,7 @@ impl RenderTask {
if let RenderTaskKind::SvgFilter(ref mut filter_task) = self.kind {
match filter_task.info {
SvgFilterInfo::ColorMatrix(ref matrix) => {
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(GpuCacheHandle::new);
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(|| GpuCacheHandle::new());
if let Some(mut request) = gpu_cache.request(handle) {
for i in 0..5 {
request.push([matrix[i*4], matrix[i*4+1], matrix[i*4+2], matrix[i*4+3]]);
@@ -1461,20 +1461,20 @@ impl RenderTask {
}
SvgFilterInfo::DropShadow(color) |
SvgFilterInfo::Flood(color) => {
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(GpuCacheHandle::new);
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(|| GpuCacheHandle::new());
if let Some(mut request) = gpu_cache.request(handle) {
request.push(color.to_array());
}
}
SvgFilterInfo::ComponentTransfer(ref data) => {
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(GpuCacheHandle::new);
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(|| GpuCacheHandle::new());
if let Some(request) = gpu_cache.request(handle) {
data.update(request);
}
}
SvgFilterInfo::Composite(ref operator) => {
if let CompositeOperator::Arithmetic(k_vals) = operator {
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(GpuCacheHandle::new);
let handle = filter_task.extra_gpu_cache_handle.get_or_insert_with(|| GpuCacheHandle::new());
if let Some(mut request) = gpu_cache.request(handle) {
request.push(*k_vals);
}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.