Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Allow dumping the optimized display list (DL).
This DL is created at paint time, per tile. To dump,
pass -Z dump-display-list-optimized at startup.
  • Loading branch information
Adenilson committed Apr 17, 2015
1 parent 653b40d commit ad62ff5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions components/gfx/display_list/mod.rs
Expand Up @@ -34,6 +34,7 @@ use libc::uintptr_t;
use paint_task::PaintLayer;
use msg::compositor_msg::LayerId;
use net_traits::image::base::Image;
use util::opts;
use util::cursor::Cursor;
use util::linked_list::prepend_from;
use util::geometry::{self, Au, MAX_RECT, ZERO_RECT};
Expand Down Expand Up @@ -280,6 +281,11 @@ impl StackingContext {
let display_list =
DisplayListOptimizer::new(tile_bounds).optimize(&*self.display_list);

if opts::get().dump_display_list_optimized {
println!("**** optimized display list. Tile bounds: {:?}", tile_bounds);
display_list.print_items(String::from_str("*"));
}

// Sort positioned children according to z-index.
let mut positioned_children = SmallVec8::new();
for kid in display_list.children.iter() {
Expand Down
8 changes: 7 additions & 1 deletion components/util/opts.rs
Expand Up @@ -121,9 +121,12 @@ pub struct Opts {
/// Dumps the flow tree after a layout.
pub dump_flow_tree: bool,

/// Dumps the flow tree after a layout.
/// Dumps the display list after a layout.
pub dump_display_list: bool,

/// Dumps the display list after optimization (post layout, at painting time).
pub dump_display_list_optimized: bool,

/// Emits notifications when there is a relayout.
pub relayout_event: bool,

Expand Down Expand Up @@ -156,6 +159,7 @@ pub fn print_debug_usage(app: &str) {
print_option("disable-text-aa", "Disable antialiasing of rendered text.");
print_option("dump-flow-tree", "Print the flow tree after each layout.");
print_option("dump-display-list", "Print the display list after each layout.");
print_option("dump-display-list-optimized", "Print optimized display list (at paint time).");
print_option("relayout-event", "Print notifications when there is a relayout.");
print_option("profile-tasks", "Instrument each task, writing the output to a file.");
print_option("show-compositor-borders", "Paint borders along layer and tile boundaries.");
Expand Down Expand Up @@ -216,6 +220,7 @@ pub fn default_opts() -> Opts {
user_agent: None,
dump_flow_tree: false,
dump_display_list: false,
dump_display_list_optimized: false,
relayout_event: false,
validate_display_list_geometry: false,
profile_tasks: false,
Expand Down Expand Up @@ -379,6 +384,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
enable_text_antialiasing: !debug_options.contains(&"disable-text-aa"),
dump_flow_tree: debug_options.contains(&"dump-flow-tree"),
dump_display_list: debug_options.contains(&"dump-display-list"),
dump_display_list_optimized: debug_options.contains(&"dump-display-list-optimized"),
relayout_event: debug_options.contains(&"relayout-event"),
validate_display_list_geometry: debug_options.contains(&"validate-display-list-geometry"),
resources_path: opt_match.opt_str("resources-path"),
Expand Down

0 comments on commit ad62ff5

Please sign in to comment.