зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1462611 - Update webrender to commit bb354abbf84602d3d8357c63c4f0b1139ec4deb1. r=jrmuizel
MozReview-Commit-ID: KiJVmU52MMd --HG-- extra : rebase_source : edda638057baa61935e15c2d940994ab6dad0035
This commit is contained in:
Родитель
a6fd990875
Коммит
26304e2c11
|
@ -129,25 +129,16 @@ impl TextureUpdateList {
|
|||
}
|
||||
}
|
||||
|
||||
/// Mostly wraps a tiling::Frame, adding a bit of extra information.
|
||||
/// Wraps a tiling::Frame, but conceptually could hold more information
|
||||
pub struct RenderedDocument {
|
||||
/// The pipeline info contains:
|
||||
/// - The last rendered epoch for each pipeline present in the frame.
|
||||
/// This information is used to know if a certain transformation on the layout has
|
||||
/// been rendered, which is necessary for reftests.
|
||||
/// - Pipelines that were removed from the scene.
|
||||
pub pipeline_info: PipelineInfo,
|
||||
|
||||
pub frame: tiling::Frame,
|
||||
}
|
||||
|
||||
impl RenderedDocument {
|
||||
pub fn new(
|
||||
pipeline_info: PipelineInfo,
|
||||
frame: tiling::Frame,
|
||||
) -> Self {
|
||||
RenderedDocument {
|
||||
pipeline_info,
|
||||
frame,
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +162,7 @@ pub enum ResultMsg {
|
|||
updates: TextureUpdateList,
|
||||
cancel_rendering: bool,
|
||||
},
|
||||
PublishPipelineInfo(PipelineInfo),
|
||||
PublishDocument(
|
||||
DocumentId,
|
||||
RenderedDocument,
|
||||
|
|
|
@ -42,6 +42,7 @@ use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
|
|||
use std::mem::replace;
|
||||
use std::sync::mpsc::{channel, Sender, Receiver};
|
||||
use std::u32;
|
||||
#[cfg(feature = "replay")]
|
||||
use tiling::Frame;
|
||||
use time::precise_time_ns;
|
||||
|
||||
|
@ -170,13 +171,15 @@ impl Document {
|
|||
|
||||
fn can_render(&self) -> bool { self.frame_builder.is_some() }
|
||||
|
||||
fn has_pixels(&self) -> bool {
|
||||
!self.view.window_size.is_empty_or_negative()
|
||||
}
|
||||
|
||||
// TODO: We will probably get rid of this soon and always forward to the scene building thread.
|
||||
fn build_scene(&mut self, resource_cache: &mut ResourceCache) {
|
||||
let max_texture_size = resource_cache.max_texture_size();
|
||||
|
||||
if self.view.window_size.width == 0 ||
|
||||
self.view.window_size.height == 0 ||
|
||||
self.view.window_size.width > max_texture_size ||
|
||||
if self.view.window_size.width > max_texture_size ||
|
||||
self.view.window_size.height > max_texture_size {
|
||||
error!("ERROR: Invalid window dimensions {}x{}. Please call api.set_window_size()",
|
||||
self.view.window_size.width,
|
||||
|
@ -241,10 +244,6 @@ impl Document {
|
|||
).unwrap_or(false);
|
||||
|
||||
let scene_request = if build_scene {
|
||||
if self.view.window_size.width == 0 || self.view.window_size.height == 0 {
|
||||
error!("ERROR: Invalid window dimensions! Please call api.set_window_size()");
|
||||
}
|
||||
|
||||
Some(SceneRequest {
|
||||
scene: self.pending.scene.clone(),
|
||||
removed_pipelines: replace(&mut self.pending.removed_pipelines, Vec::new()),
|
||||
|
@ -273,7 +272,6 @@ impl Document {
|
|||
) -> RenderedDocument {
|
||||
let accumulated_scale_factor = self.view.accumulated_scale_factor();
|
||||
let pan = self.view.pan.to_f32() / accumulated_scale_factor;
|
||||
let removed_pipelines = replace(&mut self.current.removed_pipelines, Vec::new());
|
||||
|
||||
let frame = {
|
||||
let frame_builder = self.frame_builder.as_mut().unwrap();
|
||||
|
@ -294,17 +292,15 @@ impl Document {
|
|||
frame
|
||||
};
|
||||
|
||||
self.make_rendered_document(frame, removed_pipelines)
|
||||
RenderedDocument::new(frame)
|
||||
}
|
||||
|
||||
pub fn make_rendered_document(&mut self, frame: Frame, removed_pipelines: Vec<PipelineId>) -> RenderedDocument {
|
||||
RenderedDocument::new(
|
||||
PipelineInfo {
|
||||
epochs: self.current.scene.pipeline_epochs.clone(),
|
||||
removed_pipelines,
|
||||
},
|
||||
frame
|
||||
)
|
||||
pub fn updated_pipeline_info(&mut self) -> PipelineInfo {
|
||||
let removed_pipelines = replace(&mut self.current.removed_pipelines, Vec::new());
|
||||
PipelineInfo {
|
||||
epochs: self.current.scene.pipeline_epochs.clone(),
|
||||
removed_pipelines,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn discard_frame_state_for_pipeline(&mut self, pipeline_id: PipelineId) {
|
||||
|
@ -1044,7 +1040,7 @@ impl RenderBackend {
|
|||
|
||||
debug_assert!(op.render || !op.composite);
|
||||
|
||||
if op.render {
|
||||
if op.render && doc.has_pixels() {
|
||||
profile_scope!("generate frame");
|
||||
|
||||
*frame_counter += 1;
|
||||
|
@ -1069,6 +1065,9 @@ impl RenderBackend {
|
|||
(pending_update, rendered_document)
|
||||
};
|
||||
|
||||
let msg = ResultMsg::PublishPipelineInfo(doc.updated_pipeline_info());
|
||||
self.result_tx.send(msg).unwrap();
|
||||
|
||||
// Publish the frame
|
||||
let msg = ResultMsg::PublishDocument(
|
||||
document_id,
|
||||
|
@ -1079,6 +1078,13 @@ impl RenderBackend {
|
|||
self.result_tx.send(msg).unwrap();
|
||||
profile_counters.reset();
|
||||
doc.render_on_hittest = false;
|
||||
} else if op.render {
|
||||
// WR-internal optimization to avoid doing a bunch of render work if
|
||||
// there's no pixels. We still want to pretend to render and request
|
||||
// a composite to make sure that the callbacks (particularly the
|
||||
// new_frame_ready callback below) has the right flags.
|
||||
let msg = ResultMsg::PublishPipelineInfo(doc.updated_pipeline_info());
|
||||
self.result_tx.send(msg).unwrap();
|
||||
}
|
||||
|
||||
if transaction_msg.generate_frame {
|
||||
|
@ -1240,7 +1246,7 @@ impl RenderBackend {
|
|||
&mut self.gpu_cache,
|
||||
&mut profile_counters.resources,
|
||||
);
|
||||
//TODO: write down full `RenderedDocument`?
|
||||
//TODO: write down doc's pipeline info?
|
||||
// it has `pipeline_epoch_map`,
|
||||
// which may capture necessary details for some cases.
|
||||
let file_name = format!("frame-{}-{}", (id.0).0, id.1);
|
||||
|
@ -1351,7 +1357,7 @@ impl RenderBackend {
|
|||
let render_doc = match CaptureConfig::deserialize::<Frame, _>(root, frame_name) {
|
||||
Some(frame) => {
|
||||
info!("\tloaded a built frame with {} passes", frame.passes.len());
|
||||
doc.make_rendered_document(frame, Vec::new())
|
||||
RenderedDocument::new(frame)
|
||||
}
|
||||
None => {
|
||||
doc.build_scene(&mut self.resource_cache);
|
||||
|
|
|
@ -1798,19 +1798,18 @@ impl Renderer {
|
|||
// Pull any pending results and return the most recent.
|
||||
while let Ok(msg) = self.result_rx.try_recv() {
|
||||
match msg {
|
||||
ResultMsg::PublishPipelineInfo(mut pipeline_info) => {
|
||||
for (pipeline_id, epoch) in pipeline_info.epochs {
|
||||
self.pipeline_info.epochs.insert(pipeline_id, epoch);
|
||||
}
|
||||
self.pipeline_info.removed_pipelines.extend(pipeline_info.removed_pipelines.drain(..));
|
||||
}
|
||||
ResultMsg::PublishDocument(
|
||||
document_id,
|
||||
mut doc,
|
||||
texture_update_list,
|
||||
profile_counters,
|
||||
) => {
|
||||
// Update the list of available epochs for use during reftests.
|
||||
// This is a workaround for https://github.com/servo/servo/issues/13149.
|
||||
for (pipeline_id, epoch) in &doc.pipeline_info.epochs {
|
||||
self.pipeline_info.epochs.insert(*pipeline_id, *epoch);
|
||||
}
|
||||
self.pipeline_info.removed_pipelines.extend(doc.pipeline_info.removed_pipelines.drain(..));
|
||||
|
||||
// Add a new document to the active set, expressed as a `Vec` in order
|
||||
// to re-order based on `DocumentLayer` during rendering.
|
||||
match self.active_documents.iter().position(|&(id, _)| id == document_id) {
|
||||
|
|
|
@ -1 +1 @@
|
|||
672f480af48b0ad69c1b2781151278d99816763a
|
||||
bb354abbf84602d3d8357c63c4f0b1139ec4deb1
|
||||
|
|
|
@ -47,6 +47,7 @@ impl<'a> RawtestHarness<'a> {
|
|||
self.test_very_large_blob();
|
||||
self.test_save_restore();
|
||||
self.test_capture();
|
||||
self.test_zero_height_window();
|
||||
}
|
||||
|
||||
fn render_and_get_pixels(&mut self, window_rect: DeviceUintRect) -> Vec<u8> {
|
||||
|
@ -659,6 +660,34 @@ impl<'a> RawtestHarness<'a> {
|
|||
assert!(pixels0 == pixels2);
|
||||
}
|
||||
|
||||
fn test_zero_height_window(&mut self) {
|
||||
println!("\tzero height test...");
|
||||
|
||||
let layout_size = LayoutSize::new(120.0, 0.0);
|
||||
let window_size = DeviceUintSize::new(layout_size.width as u32, layout_size.height as u32);
|
||||
let doc_id = self.wrench.api.add_document(window_size, 1);
|
||||
|
||||
let mut builder = DisplayListBuilder::new(self.wrench.root_pipeline_id, layout_size);
|
||||
let info = LayoutPrimitiveInfo::new(LayoutRect::new(LayoutPoint::zero(), LayoutSize::new(100.0, 100.0)));
|
||||
builder.push_rect(&info, ColorF::new(0.0, 1.0, 0.0, 1.0));
|
||||
|
||||
let mut txn = Transaction::new();
|
||||
txn.set_root_pipeline(self.wrench.root_pipeline_id);
|
||||
txn.set_display_list(
|
||||
Epoch(1),
|
||||
Some(ColorF::new(1.0, 0.0, 0.0, 1.0)),
|
||||
layout_size,
|
||||
builder.finalize(),
|
||||
false,
|
||||
);
|
||||
txn.generate_frame();
|
||||
self.wrench.api.send_transaction(doc_id, txn);
|
||||
|
||||
// Ensure we get a notification from rendering the above, even though
|
||||
// there are zero visible pixels
|
||||
assert!(self.rx.recv().unwrap() == NotifierEvent::WakeUp);
|
||||
}
|
||||
|
||||
|
||||
fn test_hit_testing(&mut self) {
|
||||
println!("\thit testing test...");
|
||||
|
|
Загрузка…
Ссылка в новой задаче