mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Correct usage of number of painting threads.
Previously this used the number of layout threads to allocate the threadpool. This also makes the member name consistent with the rest of the structure.
This commit is contained in:
parent
923676d443
commit
7acc0619e6
3 changed files with 21 additions and 19 deletions
|
@ -424,7 +424,7 @@ impl WorkerThreadProxy {
|
||||||
let thread_count = if opts::get().gpu_painting {
|
let thread_count = if opts::get().gpu_painting {
|
||||||
1
|
1
|
||||||
} else {
|
} else {
|
||||||
opts::get().layout_threads
|
opts::get().paint_threads
|
||||||
};
|
};
|
||||||
(0..thread_count).map(|_| {
|
(0..thread_count).map(|_| {
|
||||||
let (from_worker_sender, from_worker_receiver) = channel();
|
let (from_worker_sender, from_worker_receiver) = channel();
|
||||||
|
|
|
@ -27,8 +27,8 @@ pub struct Opts {
|
||||||
|
|
||||||
/// How many threads to use for CPU painting (`-t`).
|
/// How many threads to use for CPU painting (`-t`).
|
||||||
///
|
///
|
||||||
/// FIXME(pcwalton): This is not currently used. All painting is sequential.
|
/// Note that painting is sequentialized when using GPU painting.
|
||||||
pub n_paint_threads: uint,
|
pub paint_threads: uint,
|
||||||
|
|
||||||
/// True to use GPU painting via Skia-GL, false to use CPU painting via Skia (`-g`). Note that
|
/// True to use GPU painting via Skia-GL, false to use CPU painting via Skia (`-g`). Note that
|
||||||
/// compositing is always done on the GPU.
|
/// compositing is always done on the GPU.
|
||||||
|
@ -155,7 +155,7 @@ static FORCE_CPU_PAINTING: bool = false;
|
||||||
pub fn default_opts() -> Opts {
|
pub fn default_opts() -> Opts {
|
||||||
Opts {
|
Opts {
|
||||||
urls: vec!(),
|
urls: vec!(),
|
||||||
n_paint_threads: 1,
|
paint_threads: 1,
|
||||||
gpu_painting: false,
|
gpu_painting: false,
|
||||||
tile_size: 512,
|
tile_size: 512,
|
||||||
device_pixels_per_px: None,
|
device_pixels_per_px: None,
|
||||||
|
@ -254,9 +254,9 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
||||||
ScaleFactor(dppx_str.parse().unwrap())
|
ScaleFactor(dppx_str.parse().unwrap())
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut n_paint_threads: uint = match opt_match.opt_str("t") {
|
let mut paint_threads: uint = match opt_match.opt_str("t") {
|
||||||
Some(n_paint_threads_str) => n_paint_threads_str.parse().unwrap(),
|
Some(paint_threads_str) => paint_threads_str.parse().unwrap(),
|
||||||
None => 1, // FIXME: Number of cores.
|
None => cmp::max(rt::default_sched_threads() * 3 / 4, 1),
|
||||||
};
|
};
|
||||||
|
|
||||||
// If only the flag is present, default to a 5 second period for both profilers.
|
// If only the flag is present, default to a 5 second period for both profilers.
|
||||||
|
@ -279,7 +279,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
||||||
let mut bubble_inline_sizes_separately = debug_options.contains(&"bubble-widths");
|
let mut bubble_inline_sizes_separately = debug_options.contains(&"bubble-widths");
|
||||||
let trace_layout = debug_options.contains(&"trace-layout");
|
let trace_layout = debug_options.contains(&"trace-layout");
|
||||||
if trace_layout {
|
if trace_layout {
|
||||||
n_paint_threads = 1;
|
paint_threads = 1;
|
||||||
layout_threads = 1;
|
layout_threads = 1;
|
||||||
bubble_inline_sizes_separately = true;
|
bubble_inline_sizes_separately = true;
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ pub fn from_cmdline_args(args: &[String]) -> bool {
|
||||||
|
|
||||||
let opts = Opts {
|
let opts = Opts {
|
||||||
urls: urls,
|
urls: urls,
|
||||||
n_paint_threads: n_paint_threads,
|
paint_threads: paint_threads,
|
||||||
gpu_painting: gpu_painting,
|
gpu_painting: gpu_painting,
|
||||||
tile_size: tile_size,
|
tile_size: tile_size,
|
||||||
device_pixels_per_px: device_pixels_per_px,
|
device_pixels_per_px: device_pixels_per_px,
|
||||||
|
|
|
@ -60,10 +60,20 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let rendering_threads = unsafe {
|
||||||
|
if ((*settings).rendering_threads as uint) < 1 {
|
||||||
|
1
|
||||||
|
} else if (*settings).rendering_threads as uint > MAX_RENDERING_THREADS {
|
||||||
|
MAX_RENDERING_THREADS
|
||||||
|
} else {
|
||||||
|
(*settings).rendering_threads as uint
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let urls = vec![HOME_URL.to_owned()];
|
let urls = vec![HOME_URL.to_owned()];
|
||||||
opts::set_opts(opts::Opts {
|
opts::set_opts(opts::Opts {
|
||||||
urls: urls,
|
urls: urls,
|
||||||
n_paint_threads: 1,
|
paint_threads: rendering_threads,
|
||||||
gpu_painting: false,
|
gpu_painting: false,
|
||||||
tile_size: 512,
|
tile_size: 512,
|
||||||
device_pixels_per_px: None,
|
device_pixels_per_px: None,
|
||||||
|
@ -71,15 +81,7 @@ pub extern "C" fn cef_initialize(args: *const cef_main_args_t,
|
||||||
memory_profiler_period: None,
|
memory_profiler_period: None,
|
||||||
enable_experimental: false,
|
enable_experimental: false,
|
||||||
nonincremental_layout: false,
|
nonincremental_layout: false,
|
||||||
layout_threads: unsafe {
|
layout_threads: rendering_threads,
|
||||||
if ((*settings).rendering_threads as uint) < 1 {
|
|
||||||
1
|
|
||||||
} else if (*settings).rendering_threads as uint > MAX_RENDERING_THREADS {
|
|
||||||
MAX_RENDERING_THREADS
|
|
||||||
} else {
|
|
||||||
(*settings).rendering_threads as uint
|
|
||||||
}
|
|
||||||
},
|
|
||||||
output_file: None,
|
output_file: None,
|
||||||
headless: false,
|
headless: false,
|
||||||
hard_fail: false,
|
hard_fail: false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue