Skip to content

Commit

Permalink
Bug 1631039 - Remove WebRender's recording infrastructre. r=gw
Browse files Browse the repository at this point in the history
The code is untested, and mostly obsoleted by (multi) frame captures.
Also it gets in the way of some other changes I need to make.

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

[ghsync] From https://hg.mozilla.org/mozilla-central/rev/4ab8d5caf58fe9d7e2e0ef5b3d6ff94c4e395cff
  • Loading branch information
nical authored and github-sync committed Apr 22, 2020
1 parent d9ae0ce commit e8d2d7d
Show file tree
Hide file tree
Showing 12 changed files with 3 additions and 2,550 deletions.
3 changes: 0 additions & 3 deletions webrender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ mod internal_types;
mod picture;
mod prim_store;
mod print_tree;
mod record;
mod render_backend;
mod render_target;
mod render_task_graph;
Expand All @@ -133,8 +132,6 @@ mod shader_source {
include!(concat!(env!("OUT_DIR"), "/shaders.rs"));
}

pub use crate::record::{ApiRecordingReceiver, BinaryRecorder, WEBRENDER_RECORDING_HEADER};

mod platform {
#[cfg(target_os = "macos")]
pub use crate::platform::macos::font;
Expand Down
132 changes: 0 additions & 132 deletions webrender/src/record.rs

This file was deleted.

68 changes: 2 additions & 66 deletions webrender/src/render_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use api::{IdNamespace, MemoryReport, PipelineId, RenderNotifier, SceneMsg, Scrol
use api::{ScrollLocation, TransactionMsg, ResourceUpdate, BlobImageKey};
use api::{NotificationRequest, Checkpoint, QualitySettings};
use api::{ClipIntern, FilterDataIntern, PrimitiveKeyKind};
use api::channel::Payload;
use api::units::*;
#[cfg(any(feature = "capture", feature = "replay"))]
use api::CaptureBits;
Expand All @@ -38,8 +37,6 @@ use crate::prim_store::{PrimitiveScratchBuffer, PrimitiveInstance};
use crate::prim_store::{PrimitiveInstanceKind, PrimTemplateCommonData, PrimitiveStore};
use crate::prim_store::interned::*;
use crate::profiler::{BackendProfileCounters, ResourceProfileCounters};
use crate::record::ApiRecordingReceiver;
use crate::record::LogRecorder;
use crate::render_task_graph::RenderTaskGraphCounters;
use crate::renderer::{AsyncPropertySampler, PipelineInfo};
use crate::resource_cache::ResourceCache;
Expand All @@ -57,12 +54,13 @@ use serde::{Serialize, Deserialize};
use serde_json;
#[cfg(feature = "replay")]
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::path::PathBuf;
use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{channel, Sender, Receiver};
use std::time::{UNIX_EPOCH, SystemTime};
use std::u32;
#[cfg(feature = "capture")]
use std::path::PathBuf;
#[cfg(feature = "replay")]
use crate::frame_builder::Frame;
use time::precise_time_ns;
Expand Down Expand Up @@ -769,8 +767,6 @@ pub struct RenderBackend {
documents: FastHashMap<DocumentId, Document>,

notifier: Box<dyn RenderNotifier>,
recorder: Option<Box<dyn ApiRecordingReceiver>>,
logrecorder: Option<Box<LogRecorder>>,
tile_cache_logger: TileCacheLogger,
sampler: Option<Box<dyn AsyncPropertySampler + Send>>,
size_of_ops: Option<MallocSizeOfOps>,
Expand All @@ -795,7 +791,6 @@ impl RenderBackend {
resource_cache: ResourceCache,
notifier: Box<dyn RenderNotifier>,
frame_config: FrameBuilderConfig,
recorder: Option<Box<dyn ApiRecordingReceiver>>,
sampler: Option<Box<dyn AsyncPropertySampler + Send>>,
size_of_ops: Option<MallocSizeOfOps>,
debug_flags: DebugFlags,
Expand All @@ -814,8 +809,6 @@ impl RenderBackend {
default_compositor_kind : frame_config.compositor_kind,
documents: FastHashMap::default(),
notifier,
recorder,
logrecorder: None,
tile_cache_logger: TileCacheLogger::new(500usize),
sampler,
size_of_ops,
Expand All @@ -833,7 +826,6 @@ impl RenderBackend {
&mut self,
document_id: DocumentId,
message: SceneMsg,
frame_counter: u32,
txn: &mut Transaction,
) {
let doc = self.documents.get_mut(&document_id).expect("No document?");
Expand Down Expand Up @@ -867,14 +859,6 @@ impl RenderBackend {
} => {
profile_scope!("SetDisplayList");

if let Some(ref mut r) = self.recorder {
r.write_payload(frame_counter, &Payload::construct_data(
epoch,
pipeline_id,
&list_data,
));
}

let built_display_list =
BuiltDisplayList::from_data(list_data, list_descriptor);

Expand Down Expand Up @@ -996,14 +980,6 @@ impl RenderBackend {

status = match self.api_rx.recv() {
Ok(msg) => {
if let Some(ref mut r) = self.logrecorder {
r.write_msg(frame_counter, &msg);
}


if let Some(ref mut r) = self.recorder {
r.write_msg(frame_counter, &msg);
}
self.process_api_msg(msg, &mut profile_counters, &mut frame_counter)
}
Err(..) => { RenderBackendStatus::ShutDown(None) }
Expand Down Expand Up @@ -1301,51 +1277,12 @@ impl RenderBackend {
root_pipeline_id: doc.loaded_scene.root_pipeline_id,
};
tx.send(captured).unwrap();

// notify the active recorder
if let Some(ref mut r) = self.recorder {
let pipeline_id = doc.loaded_scene.root_pipeline_id.unwrap();
let epoch = doc.loaded_scene.pipeline_epochs[&pipeline_id];
let pipeline = &doc.loaded_scene.pipelines[&pipeline_id];
let scene_msg = SceneMsg::SetDisplayList {
list_descriptor: pipeline.display_list.descriptor().clone(),
list_data: pipeline.display_list.data().to_vec(),
epoch,
pipeline_id,
background: pipeline.background_color,
viewport_size: pipeline.viewport_size,
content_size: pipeline.content_size,
preserve_frame_state: false,
};
let txn = TransactionMsg::scene_message(scene_msg);
r.write_msg(*frame_counter, &ApiMsg::UpdateDocuments(vec![*id], vec![txn]));
r.write_payload(*frame_counter, &Payload::construct_data(
epoch,
pipeline_id,
pipeline.display_list.data(),
));
}
}

// Note: we can't pass `LoadCapture` here since it needs to arrive
// before the `PublishDocument` messages sent by `load_capture`.
return RenderBackendStatus::Continue;
}
DebugCommand::SetTransactionLogging(value) => {
match (value, self.logrecorder.as_ref()) {
(true, None) => {
let current_time = time::now_utc().to_local();
let name = format!("wr-log-{}.log",
current_time.strftime("%Y%m%d_%H%M%S").unwrap()
);
self.logrecorder = LogRecorder::new(&PathBuf::from(name));
},
(false, _) => self.logrecorder = None,
_ => (),
};

return RenderBackendStatus::Continue;
}
DebugCommand::ClearCaches(mask) => {
self.resource_cache.clear(mask);
return RenderBackendStatus::Continue;
Expand Down Expand Up @@ -1497,7 +1434,6 @@ impl RenderBackend {
self.process_scene_msg(
document_id,
scene_msg,
*frame_counter,
&mut txn,
)
}
Expand Down
5 changes: 0 additions & 5 deletions webrender/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ use crate::profiler::{BackendProfileCounters, FrameProfileCounters, TimeProfileC
use crate::profiler::{Profiler, ChangeIndicator, ProfileStyle, add_event_marker};
use crate::device::query::{GpuProfiler, GpuDebugMethod};
use rayon::{ThreadPool, ThreadPoolBuilder};
use crate::record::ApiRecordingReceiver;
use crate::render_backend::{FrameId, RenderBackend};
use crate::render_task_graph::RenderTaskGraph;
use crate::render_task::{RenderTask, RenderTaskData, RenderTaskKind};
Expand Down Expand Up @@ -2429,7 +2428,6 @@ impl Renderer {
let enclosing_size_of_op = options.enclosing_size_of_op;
let make_size_of_ops =
move || size_of_op.map(|o| MallocSizeOfOps::new(o, enclosing_size_of_op));
let recorder = options.recorder;
let thread_listener = Arc::new(options.thread_listener);
let thread_listener_for_rayon_start = thread_listener.clone();
let thread_listener_for_rayon_end = thread_listener.clone();
Expand Down Expand Up @@ -2557,7 +2555,6 @@ impl Renderer {
resource_cache,
backend_notifier,
config,
recorder,
sampler,
make_size_of_ops(),
debug_flags,
Expand Down Expand Up @@ -6752,7 +6749,6 @@ pub struct RendererOptions {
pub workers: Option<Arc<ThreadPool>>,
pub enable_multithreading: bool,
pub blob_image_handler: Option<Box<dyn BlobImageHandler>>,
pub recorder: Option<Box<dyn ApiRecordingReceiver>>,
pub thread_listener: Option<Box<dyn ThreadListener + Send + Sync>>,
pub size_of_op: Option<VoidPtrToSizeFn>,
pub enclosing_size_of_op: Option<VoidPtrToSizeFn>,
Expand Down Expand Up @@ -6824,7 +6820,6 @@ impl Default for RendererOptions {
workers: None,
enable_multithreading: true,
blob_image_handler: None,
recorder: None,
thread_listener: None,
size_of_op: None,
enclosing_size_of_op: None,
Expand Down
Loading

0 comments on commit e8d2d7d

Please sign in to comment.