aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2019-05-10 00:04:20 -0400
committerGitHub <noreply@github.com>2019-05-10 00:04:20 -0400
commitb1b47d8046ada8f6c7dc2da65ab68018b0676b0e (patch)
treefe9d4bf68f0bd176a0aae66c9c0f907656de3660
parent58ebaccf95a09f4ad36b3ed5afb44f5f79b7f4d2 (diff)
parenta690d6ffa78af861c7dbaa7daad4448c8fa9d3e6 (diff)
downloadservo-b1b47d8046ada8f6c7dc2da65ab68018b0676b0e.tar.gz
servo-b1b47d8046ada8f6c7dc2da65ab68018b0676b0e.zip
Auto merge of #22856 - jdm:angle, r=paulrouget
Add optional ANGLE support to glutin port Supporting ANGLE in Servo has two important benefits: * we can actually run Servo instances on our Windows CI machines, which gives us more confidence that we're not breaking it * we can continue to use OpenGL on devices like the Hololens, rather than creating platform-specific graphical backends <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/22856) <!-- Reviewable:end -->
-rw-r--r--Cargo.lock8
-rw-r--r--components/config/opts.rs11
-rw-r--r--components/script/Cargo.toml2
-rw-r--r--ports/glutin/Cargo.toml1
-rw-r--r--ports/glutin/app.rs15
-rw-r--r--ports/glutin/headed_window.rs9
-rw-r--r--python/servo/build_commands.py27
-rw-r--r--python/servo/testing_commands.py10
-rw-r--r--tests/html/close-on-load.html5
9 files changed, 63 insertions, 25 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ba3b1ce273a..91d5ae31e4f 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2793,10 +2793,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "mozangle"
-version = "0.1.7"
+version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.35 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gl_generator 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -3591,7 +3592,7 @@ dependencies = [
"mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)",
"mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)",
"mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mozangle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"mozjs 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
"net_traits 0.0.1",
@@ -3812,6 +3813,7 @@ dependencies = [
"libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
"libservo 0.0.1",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "mozangle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"osmesa-src 0.1.0 (git+https://github.com/servo/osmesa-src)",
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"rust-webvr 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -5590,7 +5592,7 @@ dependencies = [
"checksum mio-uds 0.6.7 (registry+https://github.com/rust-lang/crates.io-index)" = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
"checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919"
"checksum mitochondria 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9de3eca27871df31c33b807f834b94ef7d000956f57aa25c5aed9c5f0aae8f6f"
-"checksum mozangle 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "45a8a18a41cfab0fde25cc2f43ea89064d211a0fbb33225b8ff93ab20406e0e7"
+"checksum mozangle 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c9ba1ce5212fd56a71cfbc463aedd4ece76090d98b96d5122f84dedffa0cc508"
"checksum mozjs 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "622108d35f4fdd68b3aa39bfe9bedaee5fa9efd19711d046e1d56ff607c0a36f"
"checksum mozjs_sys 0.61.13 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d35502544cf3e70b305e028c6ca9e4c3d5a48264af220f8341598f54d189ba"
"checksum msdos_time 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "aad9dfe950c057b1bfe9c1f2aa51583a8468ef2a5baba2ebbe06d775efeb7729"
diff --git a/components/config/opts.rs b/components/config/opts.rs
index 8a8a58aeb03..f5ff22070e5 100644
--- a/components/config/opts.rs
+++ b/components/config/opts.rs
@@ -76,6 +76,10 @@ pub struct Opts {
pub load_webfonts_synchronously: bool,
pub headless: bool,
+
+ /// Use ANGLE to create the GL context (Windows-only).
+ pub angle: bool,
+
pub hard_fail: bool,
/// True if we should bubble intrinsic widths sequentially (`-b`). If this is true, then
@@ -558,6 +562,7 @@ pub fn default_opts() -> Opts {
gc_profile: false,
load_webfonts_synchronously: false,
headless: false,
+ angle: false,
hard_fail: true,
bubble_inline_sizes_separately: false,
show_debug_fragment_borders: false,
@@ -667,6 +672,11 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
);
opts.optflag("z", "headless", "Headless mode");
opts.optflag(
+ "",
+ "angle",
+ "Use ANGLE to create a GL context (Windows-only)",
+ );
+ opts.optflag(
"f",
"hard-fail",
"Exit on thread failure instead of displaying about:failure",
@@ -998,6 +1008,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
gc_profile: debug_options.gc_profile,
load_webfonts_synchronously: debug_options.load_webfonts_synchronously,
headless: opt_match.opt_present("z"),
+ angle: opt_match.opt_present("angle"),
hard_fail: opt_match.opt_present("f") && !opt_match.opt_present("F"),
bubble_inline_sizes_separately: bubble_inline_sizes_separately,
profile_script_events: debug_options.profile_script_events,
diff --git a/components/script/Cargo.toml b/components/script/Cargo.toml
index ba760816374..85e504027f2 100644
--- a/components/script/Cargo.toml
+++ b/components/script/Cargo.toml
@@ -115,4 +115,4 @@ webrender_api = {git = "https://github.com/servo/webrender", features = ["ipc"]}
webvr_traits = {path = "../webvr_traits"}
[target.'cfg(not(target_os = "ios"))'.dependencies]
-mozangle = "0.1"
+mozangle = "0.2"
diff --git a/ports/glutin/Cargo.toml b/ports/glutin/Cargo.toml
index 3ef0c32fe0c..9135e87b623 100644
--- a/ports/glutin/Cargo.toml
+++ b/ports/glutin/Cargo.toml
@@ -66,6 +66,7 @@ sig = "1.0"
x11 = "2.0.0"
[target.'cfg(target_os = "windows")'.dependencies]
+mozangle = { version = "0.2", features = ["egl"] }
winapi = { version = "0.3", features = ["wingdi", "winuser"] }
[target.'cfg(any(target_os = "macos", all(target_arch = "x86_64", target_os = "linux")))'.dependencies]
diff --git a/ports/glutin/app.rs b/ports/glutin/app.rs
index 59d37fcd246..ac219003988 100644
--- a/ports/glutin/app.rs
+++ b/ports/glutin/app.rs
@@ -184,12 +184,13 @@ fn get_default_url() -> ServoUrl {
cmdline_url.or(pref_url).or(blank_url).unwrap()
}
-#[cfg(not(any(target_arch = "arm", target_arch = "aarch64")))]
pub fn gl_version() -> glutin::GlRequest {
- glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 2))
-}
-
-#[cfg(any(target_arch = "arm", target_arch = "aarch64"))]
-pub fn gl_version() -> glutin::GlRequest {
- glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (3, 0))
+ if opts::get().angle {
+ glutin::GlRequest::Specific(glutin::Api::OpenGlEs, (3, 0))
+ } else {
+ glutin::GlRequest::GlThenGles {
+ opengl_version: (3, 2),
+ opengles_version: (3, 0),
+ }
+ }
}
diff --git a/ports/glutin/headed_window.rs b/ports/glutin/headed_window.rs
index 754cccf175b..f1825f50f9e 100644
--- a/ports/glutin/headed_window.rs
+++ b/ports/glutin/headed_window.rs
@@ -14,7 +14,7 @@ use glutin::dpi::{LogicalPosition, LogicalSize, PhysicalSize};
use glutin::os::macos::{ActivationPolicy, WindowBuilderExt};
#[cfg(any(target_os = "linux", target_os = "windows"))]
use glutin::Icon;
-use glutin::{ContextBuilder, GlContext, GlWindow};
+use glutin::{Api, ContextBuilder, GlContext, GlWindow};
use glutin::{ElementState, KeyboardInput, MouseButton, MouseScrollDelta, TouchPhase};
#[cfg(any(target_os = "linux", target_os = "windows"))]
use image;
@@ -145,13 +145,14 @@ impl Window {
glutin_window.show();
- let gl = match gl::GlType::default() {
- gl::GlType::Gl => unsafe {
+ let gl = match glutin_window.context().get_api() {
+ Api::OpenGl => unsafe {
gl::GlFns::load_with(|s| glutin_window.get_proc_address(s) as *const _)
},
- gl::GlType::Gles => unsafe {
+ Api::OpenGlEs => unsafe {
gl::GlesFns::load_with(|s| glutin_window.get_proc_address(s) as *const _)
},
+ Api::WebGl => unreachable!("webgl is unsupported"),
};
gl.clear_color(0.6, 0.6, 0.6, 1.0);
diff --git a/python/servo/build_commands.py b/python/servo/build_commands.py
index 674c06245fb..abe4e1003f9 100644
--- a/python/servo/build_commands.py
+++ b/python/servo/build_commands.py
@@ -625,16 +625,23 @@ class MachCommands(CommandBase):
servo_exe_dir)
# Search for the generated nspr4.dll
build_path = path.join(servo_exe_dir, "build")
- nspr4 = "nspr4.dll"
- nspr4_path = None
- for root, dirs, files in os.walk(build_path):
- if nspr4 in files:
- nspr4_path = path.join(root, nspr4)
- break
- if nspr4_path is None:
- print("WARNING: could not find nspr4.dll")
- else:
- shutil.copy(nspr4_path, servo_exe_dir)
+
+ def package_generated_shared_libraries(libs, build_path, servo_exe_dir):
+ for root, dirs, files in os.walk(build_path):
+ remaining_libs = list(libs)
+ for lib in libs:
+ if lib in files:
+ shutil.copy(path.join(root, lib), servo_exe_dir)
+ remaining_libs.remove(lib)
+ continue
+ libs = remaining_libs
+ if not libs:
+ return
+ for lib in libs:
+ print("WARNING: could not find " + lib)
+
+ package_generated_shared_libraries(["nspr4.dll", "libEGL.dll"], build_path, servo_exe_dir)
+
# copy needed gstreamer DLLs in to servo.exe dir
gst_x64 = "X86_64" if msvc_x64 == "64" else "X86"
gst_root = ""
diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py
index f4b324d4c62..8696f02f8dc 100644
--- a/python/servo/testing_commands.py
+++ b/python/servo/testing_commands.py
@@ -971,3 +971,13 @@ testing/web-platform/mozilla/tests for Servo-only tests""" % reference_path)
run_globals = {"__file__": run_file}
execfile(run_file, run_globals)
return run_globals["update_conformance"](version, dest_folder, None, patches_dir)
+
+ @Command('smoketest',
+ description='Load a simple page in Servo and ensure that it closes properly',
+ category='testing')
+ @CommandArgument('params', nargs='...',
+ help="Command-line arguments to be passed through to Servo")
+ def smoketest(self, params):
+ params = params + ['tests/html/close-on-load.html']
+ return self.context.commands.dispatch(
+ 'run', self.context, params=params)
diff --git a/tests/html/close-on-load.html b/tests/html/close-on-load.html
new file mode 100644
index 00000000000..20b6f658e0d
--- /dev/null
+++ b/tests/html/close-on-load.html
@@ -0,0 +1,5 @@
+<script>
+ window.onload = function() {
+ window.close();
+ }
+</script>