mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Extract 3 more embedder options
Extracted clean-shutdown, msaa, and no-native-titlebar embedder specific options out from the global options. Partially fixes #23009
This commit is contained in:
parent
6eca38aea3
commit
74f1e2ec32
8 changed files with 34 additions and 41 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -2673,7 +2673,6 @@ dependencies = [
|
||||||
name = "libmlservo"
|
name = "libmlservo"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"getopts",
|
|
||||||
"libc",
|
"libc",
|
||||||
"libservo",
|
"libservo",
|
||||||
"log",
|
"log",
|
||||||
|
@ -4809,6 +4808,7 @@ name = "simpleservo"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"core-foundation",
|
"core-foundation",
|
||||||
|
"getopts",
|
||||||
"gl_generator 0.11.0",
|
"gl_generator 0.11.0",
|
||||||
"libc",
|
"libc",
|
||||||
"libloading",
|
"libloading",
|
||||||
|
|
|
@ -181,9 +181,6 @@ pub struct Opts {
|
||||||
/// True to exit after the page load (`-x`).
|
/// True to exit after the page load (`-x`).
|
||||||
pub exit_after_load: bool,
|
pub exit_after_load: bool,
|
||||||
|
|
||||||
/// Do not use native titlebar
|
|
||||||
pub no_native_titlebar: bool,
|
|
||||||
|
|
||||||
/// True to show webrender profiling stats on screen.
|
/// True to show webrender profiling stats on screen.
|
||||||
pub webrender_stats: bool,
|
pub webrender_stats: bool,
|
||||||
|
|
||||||
|
@ -201,9 +198,6 @@ pub struct Opts {
|
||||||
/// after each change is made.
|
/// after each change is made.
|
||||||
pub precache_shaders: bool,
|
pub precache_shaders: bool,
|
||||||
|
|
||||||
/// True if WebRender should use multisample antialiasing.
|
|
||||||
pub use_msaa: bool,
|
|
||||||
|
|
||||||
/// Directory for a default config directory
|
/// Directory for a default config directory
|
||||||
pub config_dir: Option<PathBuf>,
|
pub config_dir: Option<PathBuf>,
|
||||||
|
|
||||||
|
@ -225,9 +219,6 @@ pub struct Opts {
|
||||||
|
|
||||||
/// Print Progressive Web Metrics to console.
|
/// Print Progressive Web Metrics to console.
|
||||||
pub print_pwm: bool,
|
pub print_pwm: bool,
|
||||||
|
|
||||||
/// Only shutdown once all theads are finished.
|
|
||||||
pub clean_shutdown: bool,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_usage(app: &str, opts: &Options) {
|
fn print_usage(app: &str, opts: &Options) {
|
||||||
|
@ -317,9 +308,6 @@ pub struct DebugOptions {
|
||||||
/// Enable webrender instanced draw call batching.
|
/// Enable webrender instanced draw call batching.
|
||||||
pub webrender_disable_batch: bool,
|
pub webrender_disable_batch: bool,
|
||||||
|
|
||||||
/// Use multisample antialiasing in WebRender.
|
|
||||||
pub use_msaa: bool,
|
|
||||||
|
|
||||||
// don't skip any backtraces on panic
|
// don't skip any backtraces on panic
|
||||||
pub full_backtraces: bool,
|
pub full_backtraces: bool,
|
||||||
|
|
||||||
|
@ -362,7 +350,6 @@ impl DebugOptions {
|
||||||
"wr-stats" => self.webrender_stats = true,
|
"wr-stats" => self.webrender_stats = true,
|
||||||
"wr-record" => self.webrender_record = true,
|
"wr-record" => self.webrender_record = true,
|
||||||
"wr-no-batch" => self.webrender_disable_batch = true,
|
"wr-no-batch" => self.webrender_disable_batch = true,
|
||||||
"msaa" => self.use_msaa = true,
|
|
||||||
"full-backtraces" => self.full_backtraces = true,
|
"full-backtraces" => self.full_backtraces = true,
|
||||||
"precache-shaders" => self.precache_shaders = true,
|
"precache-shaders" => self.precache_shaders = true,
|
||||||
"signpost" => self.signpost = true,
|
"signpost" => self.signpost = true,
|
||||||
|
@ -453,7 +440,6 @@ fn print_debug_usage(app: &str) -> ! {
|
||||||
"Load web fonts synchronously to avoid non-deterministic network-driven reflows",
|
"Load web fonts synchronously to avoid non-deterministic network-driven reflows",
|
||||||
);
|
);
|
||||||
print_option("wr-stats", "Show WebRender profiler on screen.");
|
print_option("wr-stats", "Show WebRender profiler on screen.");
|
||||||
print_option("msaa", "Use multisample antialiasing in WebRender.");
|
|
||||||
print_option("full-backtraces", "Print full backtraces for all errors");
|
print_option("full-backtraces", "Print full backtraces for all errors");
|
||||||
print_option("wr-debug", "Display webrender tile borders.");
|
print_option("wr-debug", "Display webrender tile borders.");
|
||||||
print_option("wr-no-batch", "Disable webrender instanced batching.");
|
print_option("wr-no-batch", "Disable webrender instanced batching.");
|
||||||
|
@ -579,9 +565,7 @@ pub fn default_opts() -> Opts {
|
||||||
style_sharing_stats: false,
|
style_sharing_stats: false,
|
||||||
convert_mouse_to_touch: false,
|
convert_mouse_to_touch: false,
|
||||||
exit_after_load: false,
|
exit_after_load: false,
|
||||||
no_native_titlebar: false,
|
|
||||||
webrender_stats: false,
|
webrender_stats: false,
|
||||||
use_msaa: false,
|
|
||||||
config_dir: None,
|
config_dir: None,
|
||||||
full_backtraces: false,
|
full_backtraces: false,
|
||||||
is_printing_version: false,
|
is_printing_version: false,
|
||||||
|
@ -593,7 +577,6 @@ pub fn default_opts() -> Opts {
|
||||||
certificate_path: None,
|
certificate_path: None,
|
||||||
unminify_js: false,
|
unminify_js: false,
|
||||||
print_pwm: false,
|
print_pwm: false,
|
||||||
clean_shutdown: false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -745,11 +728,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
||||||
"config directory following xdg spec on linux platform",
|
"config directory following xdg spec on linux platform",
|
||||||
"",
|
"",
|
||||||
);
|
);
|
||||||
opts.optflag(
|
|
||||||
"",
|
|
||||||
"clean-shutdown",
|
|
||||||
"Do not shutdown until all threads have finished (macos only)",
|
|
||||||
);
|
|
||||||
opts.optflag("v", "version", "Display servo version information");
|
opts.optflag("v", "version", "Display servo version information");
|
||||||
opts.optflag("", "unminify-js", "Unminify Javascript");
|
opts.optflag("", "unminify-js", "Unminify Javascript");
|
||||||
opts.optopt("", "profiler-db-user", "Profiler database user", "");
|
opts.optopt("", "profiler-db-user", "Profiler database user", "");
|
||||||
|
@ -964,9 +942,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let do_not_use_native_titlebar =
|
|
||||||
opt_match.opt_present("b") || !(pref!(shell.native_titlebar.enabled));
|
|
||||||
|
|
||||||
let enable_subpixel_text_antialiasing =
|
let enable_subpixel_text_antialiasing =
|
||||||
!debug_options.disable_subpixel_aa && pref!(gfx.subpixel_text_antialiasing.enabled);
|
!debug_options.disable_subpixel_aa && pref!(gfx.subpixel_text_antialiasing.enabled);
|
||||||
|
|
||||||
|
@ -1017,9 +992,7 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
||||||
style_sharing_stats: debug_options.style_sharing_stats,
|
style_sharing_stats: debug_options.style_sharing_stats,
|
||||||
convert_mouse_to_touch: debug_options.convert_mouse_to_touch,
|
convert_mouse_to_touch: debug_options.convert_mouse_to_touch,
|
||||||
exit_after_load: opt_match.opt_present("x"),
|
exit_after_load: opt_match.opt_present("x"),
|
||||||
no_native_titlebar: do_not_use_native_titlebar,
|
|
||||||
webrender_stats: debug_options.webrender_stats,
|
webrender_stats: debug_options.webrender_stats,
|
||||||
use_msaa: debug_options.use_msaa,
|
|
||||||
config_dir: opt_match.opt_str("config-dir").map(Into::into),
|
config_dir: opt_match.opt_str("config-dir").map(Into::into),
|
||||||
full_backtraces: debug_options.full_backtraces,
|
full_backtraces: debug_options.full_backtraces,
|
||||||
is_printing_version: is_printing_version,
|
is_printing_version: is_printing_version,
|
||||||
|
@ -1031,7 +1004,6 @@ pub fn from_cmdline_args(mut opts: Options, args: &[String]) -> ArgumentParsingR
|
||||||
certificate_path: opt_match.opt_str("certificate-path"),
|
certificate_path: opt_match.opt_str("certificate-path"),
|
||||||
unminify_js: opt_match.opt_present("unminify-js"),
|
unminify_js: opt_match.opt_present("unminify-js"),
|
||||||
print_pwm: opt_match.opt_present("print-pwm"),
|
print_pwm: opt_match.opt_present("print-pwm"),
|
||||||
clean_shutdown: opt_match.opt_present("clean-shutdown"),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
set_options(opts);
|
set_options(opts);
|
||||||
|
|
|
@ -34,7 +34,7 @@ pub struct App {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub fn run(angle: bool, enable_vsync: bool) {
|
pub fn run(angle: bool, enable_vsync: bool, use_msaa: bool, no_native_titlebar: bool) {
|
||||||
let events_loop = EventsLoop::new(opts::get().headless);
|
let events_loop = EventsLoop::new(opts::get().headless);
|
||||||
|
|
||||||
// Implements window methods, used by compositor.
|
// Implements window methods, used by compositor.
|
||||||
|
@ -47,6 +47,8 @@ impl App {
|
||||||
events_loop.clone(),
|
events_loop.clone(),
|
||||||
angle,
|
angle,
|
||||||
enable_vsync,
|
enable_vsync,
|
||||||
|
use_msaa,
|
||||||
|
no_native_titlebar,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,8 @@ pub struct Window {
|
||||||
xr_rotation: Cell<Rotation3D<f32, UnknownUnit, UnknownUnit>>,
|
xr_rotation: Cell<Rotation3D<f32, UnknownUnit, UnknownUnit>>,
|
||||||
angle: bool,
|
angle: bool,
|
||||||
enable_vsync: bool,
|
enable_vsync: bool,
|
||||||
|
use_msaa: bool,
|
||||||
|
no_native_titlebar: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
@ -94,6 +96,8 @@ impl Window {
|
||||||
events_loop: Rc<RefCell<EventsLoop>>,
|
events_loop: Rc<RefCell<EventsLoop>>,
|
||||||
angle: bool,
|
angle: bool,
|
||||||
enable_vsync: bool,
|
enable_vsync: bool,
|
||||||
|
use_msaa: bool,
|
||||||
|
no_native_titlebar: bool,
|
||||||
) -> Window {
|
) -> Window {
|
||||||
let opts = opts::get();
|
let opts = opts::get();
|
||||||
|
|
||||||
|
@ -101,7 +105,7 @@ impl Window {
|
||||||
// `load_end()`. This avoids an ugly flash of unstyled content (especially important since
|
// `load_end()`. This avoids an ugly flash of unstyled content (especially important since
|
||||||
// unstyled content is white and chrome often has a transparent background). See issue
|
// unstyled content is white and chrome often has a transparent background). See issue
|
||||||
// #9996.
|
// #9996.
|
||||||
let visible = opts.output_file.is_none() && !opts.no_native_titlebar;
|
let visible = opts.output_file.is_none() && !no_native_titlebar;
|
||||||
|
|
||||||
let win_size: DeviceIntSize = (win_size.to_f32() * window_creation_scale_factor()).to_i32();
|
let win_size: DeviceIntSize = (win_size.to_f32() * window_creation_scale_factor()).to_i32();
|
||||||
let width = win_size.to_untyped().width;
|
let width = win_size.to_untyped().width;
|
||||||
|
@ -109,8 +113,8 @@ impl Window {
|
||||||
|
|
||||||
let mut window_builder = glutin::WindowBuilder::new()
|
let mut window_builder = glutin::WindowBuilder::new()
|
||||||
.with_title("Servo".to_string())
|
.with_title("Servo".to_string())
|
||||||
.with_decorations(!opts.no_native_titlebar)
|
.with_decorations(!no_native_titlebar)
|
||||||
.with_transparency(opts.no_native_titlebar)
|
.with_transparency(no_native_titlebar)
|
||||||
.with_dimensions(LogicalSize::new(width as f64, height as f64))
|
.with_dimensions(LogicalSize::new(width as f64, height as f64))
|
||||||
.with_visibility(visible)
|
.with_visibility(visible)
|
||||||
.with_multitouch();
|
.with_multitouch();
|
||||||
|
@ -121,7 +125,7 @@ impl Window {
|
||||||
.with_gl(app::gl_version(angle))
|
.with_gl(app::gl_version(angle))
|
||||||
.with_vsync(enable_vsync);
|
.with_vsync(enable_vsync);
|
||||||
|
|
||||||
if opts.use_msaa {
|
if use_msaa {
|
||||||
context_builder = context_builder.with_multisampling(MULTISAMPLES)
|
context_builder = context_builder.with_multisampling(MULTISAMPLES)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,6 +208,8 @@ impl Window {
|
||||||
xr_rotation: Cell::new(Rotation3D::identity()),
|
xr_rotation: Cell::new(Rotation3D::identity()),
|
||||||
angle,
|
angle,
|
||||||
enable_vsync,
|
enable_vsync,
|
||||||
|
use_msaa,
|
||||||
|
no_native_titlebar,
|
||||||
};
|
};
|
||||||
|
|
||||||
window.present();
|
window.present();
|
||||||
|
@ -553,6 +559,8 @@ impl webxr::glwindow::GlWindow for Window {
|
||||||
self.events_loop.clone(),
|
self.events_loop.clone(),
|
||||||
self.angle,
|
self.angle,
|
||||||
self.enable_vsync,
|
self.enable_vsync,
|
||||||
|
self.use_msaa,
|
||||||
|
self.no_native_titlebar,
|
||||||
));
|
));
|
||||||
app::register_window(window.clone());
|
app::register_window(window.clone());
|
||||||
Ok(window)
|
Ok(window)
|
||||||
|
|
|
@ -27,6 +27,7 @@ use backtrace::Backtrace;
|
||||||
use getopts::Options;
|
use getopts::Options;
|
||||||
use servo::config::opts::{self, ArgumentParsingResult};
|
use servo::config::opts::{self, ArgumentParsingResult};
|
||||||
use servo::config::servo_version;
|
use servo::config::servo_version;
|
||||||
|
use servo::servo_config::pref;
|
||||||
use std::env;
|
use std::env;
|
||||||
use std::panic;
|
use std::panic;
|
||||||
use std::process;
|
use std::process;
|
||||||
|
@ -40,7 +41,7 @@ pub mod platform {
|
||||||
pub mod macos;
|
pub mod macos;
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
#[cfg(not(target_os = "macos"))]
|
||||||
pub fn deinit() {}
|
pub fn deinit(_clean_shutdown: bool) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
#[cfg(not(any(target_os = "macos", target_os = "linux")))]
|
||||||
|
@ -83,11 +84,18 @@ pub fn main() {
|
||||||
"angle",
|
"angle",
|
||||||
"Use ANGLE to create a GL context (Windows-only)",
|
"Use ANGLE to create a GL context (Windows-only)",
|
||||||
);
|
);
|
||||||
|
opts.optflag(
|
||||||
|
"",
|
||||||
|
"clean-shutdown",
|
||||||
|
"Do not shutdown until all threads have finished (macos only)",
|
||||||
|
);
|
||||||
opts.optflag(
|
opts.optflag(
|
||||||
"",
|
"",
|
||||||
"disable-vsync",
|
"disable-vsync",
|
||||||
"Disable vsync mode in the compositor to allow profiling at more than monitor refresh rate",
|
"Disable vsync mode in the compositor to allow profiling at more than monitor refresh rate",
|
||||||
);
|
);
|
||||||
|
opts.optflag("", "msaa", "Use multisample antialiasing in WebRender.");
|
||||||
|
opts.optflag("b", "no-native-titlebar", "Do not use native titlebar");
|
||||||
|
|
||||||
let opts_matches;
|
let opts_matches;
|
||||||
let content_process_token;
|
let content_process_token;
|
||||||
|
@ -146,8 +154,12 @@ pub fn main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
let angle = opts_matches.opt_present("angle");
|
let angle = opts_matches.opt_present("angle");
|
||||||
|
let clean_shutdown = opts_matches.opt_present("clean-shutdown");
|
||||||
|
let do_not_use_native_titlebar =
|
||||||
|
opts_matches.opt_present("no-native-titlebar") || !(pref!(shell.native_titlebar.enabled));
|
||||||
let enable_vsync = !opts_matches.opt_present("disable-vsync");
|
let enable_vsync = !opts_matches.opt_present("disable-vsync");
|
||||||
App::run(angle, enable_vsync);
|
let use_msaa = opts_matches.opt_present("msaa");
|
||||||
|
App::run(angle, enable_vsync, use_msaa, do_not_use_native_titlebar);
|
||||||
|
|
||||||
platform::deinit()
|
platform::deinit(clean_shutdown)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
use servo::config::opts;
|
|
||||||
use std::ptr;
|
use std::ptr;
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
pub fn deinit() {
|
pub fn deinit(clean_shutdown: bool) {
|
||||||
// An unfortunate hack to make sure the linker's dead code stripping doesn't strip our
|
// An unfortunate hack to make sure the linker's dead code stripping doesn't strip our
|
||||||
// `Info.plist`.
|
// `Info.plist`.
|
||||||
unsafe {
|
unsafe {
|
||||||
|
@ -21,7 +20,7 @@ pub fn deinit() {
|
||||||
"{} threads are still running after shutdown (bad).",
|
"{} threads are still running after shutdown (bad).",
|
||||||
thread_count
|
thread_count
|
||||||
);
|
);
|
||||||
if opts::get().clean_shutdown {
|
if clean_shutdown {
|
||||||
println!("Waiting until all threads have shutdown");
|
println!("Waiting until all threads have shutdown");
|
||||||
loop {
|
loop {
|
||||||
let thread_count = unsafe { macos_count_running_threads() };
|
let thread_count = unsafe { macos_count_running_threads() };
|
||||||
|
|
|
@ -25,7 +25,6 @@ simpleservo = { path = "../libsimpleservo/api", features = ["no_static_freetype"
|
||||||
rust-webvr = { version = "0.16", features = ["magicleap"] }
|
rust-webvr = { version = "0.16", features = ["magicleap"] }
|
||||||
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
|
webxr-api = { git = "https://github.com/servo/webxr", features = ["ipc"] }
|
||||||
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "magicleap"] }
|
webxr = { git = "https://github.com/servo/webxr", features = ["ipc", "magicleap"] }
|
||||||
getopts = "0.2.11"
|
|
||||||
libc = "0.2"
|
libc = "0.2"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
servo-egl = "0.2"
|
servo-egl = "0.2"
|
||||||
|
|
|
@ -7,6 +7,7 @@ edition = "2018"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
getopts = "0.2.11"
|
||||||
libservo = { path = "../../../components/servo" }
|
libservo = { path = "../../../components/servo" }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
servo-media = { git = "https://github.com/servo/media" }
|
servo-media = { git = "https://github.com/servo/media" }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue