Auto merge of #9781 - jdm:refactor_gle, r=glennw

Allow user to choose between GL and ES2

Rebase of #8869. Requires https://github.com/servo/rust-layers/pull/232.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9781)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-03-11 02:53:59 +05:30
commit f3a871ec3d
5 changed files with 70 additions and 36 deletions

View file

@ -20,7 +20,7 @@ dependencies = [
"glutin_app 0.0.1", "glutin_app 0.0.1",
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1", "layout 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -162,7 +162,7 @@ dependencies = [
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -182,7 +182,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"plugins 0.0.1", "plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -294,7 +294,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout_traits 0.0.1", "layout_traits 0.0.1",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
@ -688,7 +688,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -733,7 +733,7 @@ dependencies = [
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"plugins 0.0.1", "plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -783,7 +783,7 @@ dependencies = [
"compositing 0.0.1", "compositing 0.0.1",
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"net_traits 0.0.1", "net_traits 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
@ -1017,8 +1017,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "layers" name = "layers"
version = "0.2.2" version = "0.2.4"
source = "git+https://github.com/servo/rust-layers#dd28dbee88fa18cfe416403d59e9c74c7299d7ab" source = "git+https://github.com/servo/rust-layers#3cb5df49d7f069eea1f1f0550921c5833cb5bc7f"
dependencies = [ dependencies = [
"azure 0.4.3 (git+https://github.com/servo/rust-azure)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)",
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1249,7 +1249,7 @@ dependencies = [
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -186,6 +186,9 @@ pub struct Opts {
/// True if WebRender should use multisample antialiasing. /// True if WebRender should use multisample antialiasing.
pub use_msaa: bool, pub use_msaa: bool,
// Which rendering API to use.
pub render_api: RenderApi,
} }
fn print_usage(app: &str, opts: &Options) { fn print_usage(app: &str, opts: &Options) {
@ -391,6 +394,14 @@ enum UserAgent {
Gonk, Gonk,
} }
#[derive(Clone, Debug, Eq, Deserialize, PartialEq, Serialize)]
pub enum RenderApi {
GL,
ES2,
}
const DEFAULT_RENDER_API: RenderApi = RenderApi::GL;
fn default_user_agent_string(agent: UserAgent) -> String { fn default_user_agent_string(agent: UserAgent) -> String {
#[cfg(all(target_os = "linux", target_arch = "x86_64"))] #[cfg(all(target_os = "linux", target_arch = "x86_64"))]
const DESKTOP_UA_STRING: &'static str = const DESKTOP_UA_STRING: &'static str =
@ -487,6 +498,7 @@ pub fn default_opts() -> Opts {
use_webrender: false, use_webrender: false,
webrender_stats: false, webrender_stats: false,
use_msaa: false, use_msaa: false,
render_api: DEFAULT_RENDER_API,
} }
} }
@ -531,6 +543,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
"A preference to set to enable", "dom.mozbrowser.enabled"); "A preference to set to enable", "dom.mozbrowser.enabled");
opts.optflag("b", "no-native-titlebar", "Do not use native titlebar"); opts.optflag("b", "no-native-titlebar", "Do not use native titlebar");
opts.optflag("w", "webrender", "Use webrender backend"); opts.optflag("w", "webrender", "Use webrender backend");
opts.optopt("G", "graphics", "Select graphics backend (gl or es2)", "gl");
let opt_match = match opts.parse(args) { let opt_match = match opts.parse(args) {
Ok(m) => m, Ok(m) => m,
@ -675,6 +688,13 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
let use_webrender = opt_match.opt_present("w") && !opt_match.opt_present("z"); let use_webrender = opt_match.opt_present("w") && !opt_match.opt_present("z");
let render_api = match opt_match.opt_str("G") {
Some(ref ga) if ga == "gl" => RenderApi::GL,
Some(ref ga) if ga == "es2" => RenderApi::ES2,
None => DEFAULT_RENDER_API,
_ => args_fail(&format!("error: graphics option must be gl or es2:")),
};
let opts = Opts { let opts = Opts {
is_running_problem_test: is_running_problem_test, is_running_problem_test: is_running_problem_test,
url: Some(url), url: Some(url),
@ -704,6 +724,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
user_agent: user_agent, user_agent: user_agent,
multiprocess: opt_match.opt_present("M"), multiprocess: opt_match.opt_present("M"),
sandbox: opt_match.opt_present("S"), sandbox: opt_match.opt_present("S"),
render_api: render_api,
show_debug_borders: debug_options.show_compositor_borders, show_debug_borders: debug_options.show_compositor_borders,
show_debug_fragment_borders: debug_options.show_fragment_borders, show_debug_fragment_borders: debug_options.show_fragment_borders,
show_debug_parallel_paint: debug_options.show_parallel_paint, show_debug_parallel_paint: debug_options.show_parallel_paint,

22
ports/cef/Cargo.lock generated
View file

@ -15,7 +15,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1", "glutin_app 0.0.1",
"js 0.1.2 (git+https://github.com/servo/rust-mozjs)", "js 0.1.2 (git+https://github.com/servo/rust-mozjs)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
@ -147,7 +147,7 @@ dependencies = [
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -167,7 +167,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"plugins 0.0.1", "plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -264,7 +264,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout_traits 0.0.1", "layout_traits 0.0.1",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
@ -617,7 +617,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -653,7 +653,7 @@ dependencies = [
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"plugins 0.0.1", "plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -703,7 +703,7 @@ dependencies = [
"compositing 0.0.1", "compositing 0.0.1",
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"net_traits 0.0.1", "net_traits 0.0.1",
"script_traits 0.0.1", "script_traits 0.0.1",
@ -937,8 +937,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "layers" name = "layers"
version = "0.2.2" version = "0.2.4"
source = "git+https://github.com/servo/rust-layers#dd28dbee88fa18cfe416403d59e9c74c7299d7ab" source = "git+https://github.com/servo/rust-layers#3cb5df49d7f069eea1f1f0550921c5833cb5bc7f"
dependencies = [ dependencies = [
"azure 0.4.3 (git+https://github.com/servo/rust-azure)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)",
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1169,7 +1169,7 @@ dependencies = [
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1701,7 +1701,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1", "glutin_app 0.0.1",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1", "layout 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -33,7 +33,7 @@ use style_traits::cursor::Cursor;
use url::Url; use url::Url;
use util::geometry::ScreenPx; use util::geometry::ScreenPx;
#[cfg(feature = "window")] #[cfg(feature = "window")]
use util::opts; use util::opts::{self, RenderApi};
#[cfg(feature = "window")] #[cfg(feature = "window")]
static mut g_nested_event_loop_listener: Option<*mut (NestedEventLoopListener + 'static)> = None; static mut g_nested_event_loop_listener: Option<*mut (NestedEventLoopListener + 'static)> = None;
@ -157,10 +157,16 @@ impl Window {
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]
fn gl_version() -> GlRequest { fn gl_version() -> GlRequest {
if opts::get().use_webrender { if opts::get().use_webrender {
GlRequest::Specific(Api::OpenGl, (3, 2)) return GlRequest::Specific(Api::OpenGl, (3, 2));
} else { }
match opts::get().render_api {
RenderApi::GL => {
GlRequest::Specific(Api::OpenGl, (2, 1)) GlRequest::Specific(Api::OpenGl, (2, 1))
} }
RenderApi::ES2 => {
GlRequest::Specific(Api::OpenGlEs, (2, 0))
}
}
} }
#[cfg(target_os = "android")] #[cfg(target_os = "android")]
@ -672,7 +678,14 @@ impl WindowMethods for Window {
fn native_display(&self) -> NativeDisplay { fn native_display(&self) -> NativeDisplay {
use x11::xlib; use x11::xlib;
unsafe { unsafe {
match opts::get().render_api {
RenderApi::GL => {
NativeDisplay::new(self.window.platform_display() as *mut xlib::Display) NativeDisplay::new(self.window.platform_display() as *mut xlib::Display)
},
RenderApi::ES2 => {
NativeDisplay::new_egl_display()
}
}
} }
} }

20
ports/gonk/Cargo.lock generated
View file

@ -9,7 +9,7 @@ dependencies = [
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx 0.0.1", "gfx 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1", "layout 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
@ -140,7 +140,7 @@ dependencies = [
"gfx_traits 0.0.1", "gfx_traits 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)", "num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
@ -160,7 +160,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)", "offscreen_gl_context 0.1.0 (git+https://github.com/ecoal95/rust-offscreen-rendering-context)",
"plugins 0.0.1", "plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -257,7 +257,7 @@ dependencies = [
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout_traits 0.0.1", "layout_traits 0.0.1",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1", "msg 0.0.1",
@ -620,7 +620,7 @@ dependencies = [
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -656,7 +656,7 @@ dependencies = [
"euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "euclid 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"msg 0.0.1", "msg 0.0.1",
"plugins 0.0.1", "plugins 0.0.1",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -919,8 +919,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "layers" name = "layers"
version = "0.2.2" version = "0.2.4"
source = "git+https://github.com/servo/rust-layers#dd28dbee88fa18cfe416403d59e9c74c7299d7ab" source = "git+https://github.com/servo/rust-layers#3cb5df49d7f069eea1f1f0550921c5833cb5bc7f"
dependencies = [ dependencies = [
"azure 0.4.3 (git+https://github.com/servo/rust-azure)", "azure 0.4.3 (git+https://github.com/servo/rust-azure)",
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1151,7 +1151,7 @@ dependencies = [
"heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "heapsize_plugin 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"plugins 0.0.1", "plugins 0.0.1",
"rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)", "serde 0.6.15 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1682,7 +1682,7 @@ dependencies = [
"gfx 0.0.1", "gfx 0.0.1",
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)", "ipc-channel 0.2.1 (git+https://github.com/servo/ipc-channel)",
"layers 0.2.2 (git+https://github.com/servo/rust-layers)", "layers 0.2.4 (git+https://github.com/servo/rust-layers)",
"layout 0.0.1", "layout 0.0.1",
"libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",