mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
servo: Merge #13382 - Add OSMesa headless mode, run WPT against Webrender (from glennw:headless); r=larsbergstrom
Add OSMesa headless mode, run WPT against Webrender. Source-Repo: https://github.com/servo/servo Source-Revision: c7e1a575a5225ccfb00a38fb50e052d986c0a78d
This commit is contained in:
parent
ecead6988d
commit
85b62f0bcf
@ -40,6 +40,7 @@ matrix:
|
||||
- libavformat-dev
|
||||
- libavcodec-dev
|
||||
- libavutil-dev
|
||||
- libedit-dev
|
||||
|
||||
branches:
|
||||
only:
|
||||
|
@ -7,15 +7,87 @@ use canvas_traits::{FromLayoutMsg, byte_swap};
|
||||
use euclid::size::Size2D;
|
||||
use gleam::gl;
|
||||
use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory};
|
||||
use offscreen_gl_context::{ColorAttachmentType, GLContext, GLLimits, GLContextAttributes, NativeGLContext};
|
||||
use offscreen_gl_context::{ColorAttachmentType, GLContext, GLLimits};
|
||||
use offscreen_gl_context::{GLContextAttributes, NativeGLContext, OSMesaContext};
|
||||
use std::borrow::ToOwned;
|
||||
use std::sync::mpsc::channel;
|
||||
use util::opts;
|
||||
use util::thread::spawn_named;
|
||||
use webrender_traits;
|
||||
|
||||
enum GLContextWrapper {
|
||||
Native(GLContext<NativeGLContext>),
|
||||
OSMesa(GLContext<OSMesaContext>),
|
||||
}
|
||||
|
||||
impl GLContextWrapper {
|
||||
fn new(size: Size2D<i32>,
|
||||
attributes: GLContextAttributes) -> Result<GLContextWrapper, &'static str> {
|
||||
if opts::get().should_use_osmesa() {
|
||||
let ctx = GLContext::<OSMesaContext>::new(size,
|
||||
attributes,
|
||||
ColorAttachmentType::Texture,
|
||||
None);
|
||||
ctx.map(GLContextWrapper::OSMesa)
|
||||
} else {
|
||||
let ctx = GLContext::<NativeGLContext>::new(size,
|
||||
attributes,
|
||||
ColorAttachmentType::Texture,
|
||||
None);
|
||||
ctx.map(GLContextWrapper::Native)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_limits(&self) -> GLLimits {
|
||||
match *self {
|
||||
GLContextWrapper::Native(ref ctx) => {
|
||||
ctx.borrow_limits().clone()
|
||||
}
|
||||
GLContextWrapper::OSMesa(ref ctx) => {
|
||||
ctx.borrow_limits().clone()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn resize(&mut self, size: Size2D<i32>) -> Result<Size2D<i32>, &'static str> {
|
||||
match *self {
|
||||
GLContextWrapper::Native(ref mut ctx) => {
|
||||
try!(ctx.resize(size));
|
||||
Ok(ctx.borrow_draw_buffer().unwrap().size())
|
||||
}
|
||||
GLContextWrapper::OSMesa(ref mut ctx) => {
|
||||
try!(ctx.resize(size));
|
||||
Ok(ctx.borrow_draw_buffer().unwrap().size())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn make_current(&self) {
|
||||
match *self {
|
||||
GLContextWrapper::Native(ref ctx) => {
|
||||
ctx.make_current().unwrap();
|
||||
}
|
||||
GLContextWrapper::OSMesa(ref ctx) => {
|
||||
ctx.make_current().unwrap();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn apply_command(&self, cmd: webrender_traits::WebGLCommand) {
|
||||
match *self {
|
||||
GLContextWrapper::Native(ref ctx) => {
|
||||
cmd.apply(ctx);
|
||||
}
|
||||
GLContextWrapper::OSMesa(ref ctx) => {
|
||||
cmd.apply(ctx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
enum WebGLPaintTaskData {
|
||||
WebRender(webrender_traits::RenderApi, webrender_traits::WebGLContextId),
|
||||
Readback(GLContext<NativeGLContext>, (Option<(webrender_traits::RenderApi, webrender_traits::ImageKey)>)),
|
||||
Readback(GLContextWrapper, (Option<(webrender_traits::RenderApi, webrender_traits::ImageKey)>)),
|
||||
}
|
||||
|
||||
pub struct WebGLPaintThread {
|
||||
@ -27,8 +99,8 @@ fn create_readback_painter(size: Size2D<i32>,
|
||||
attrs: GLContextAttributes,
|
||||
webrender_api: Option<webrender_traits::RenderApi>)
|
||||
-> Result<(WebGLPaintThread, GLLimits), String> {
|
||||
let context = try!(GLContext::<NativeGLContext>::new(size, attrs, ColorAttachmentType::Texture, None));
|
||||
let limits = context.borrow_limits().clone();
|
||||
let context = try!(GLContextWrapper::new(size, attrs));
|
||||
let limits = context.get_limits();
|
||||
let webrender_api_and_image_key = webrender_api.map(|wr| {
|
||||
let key = wr.alloc_image();
|
||||
(wr, key)
|
||||
@ -73,7 +145,7 @@ impl WebGLPaintThread {
|
||||
api.send_webgl_command(id, message);
|
||||
}
|
||||
WebGLPaintTaskData::Readback(ref ctx, _) => {
|
||||
message.apply(ctx);
|
||||
ctx.apply_command(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -174,8 +246,7 @@ impl WebGLPaintThread {
|
||||
WebGLPaintTaskData::Readback(ref mut context, _) => {
|
||||
if size.width > self.size.width ||
|
||||
size.height > self.size.height {
|
||||
try!(context.resize(size));
|
||||
self.size = context.borrow_draw_buffer().unwrap().size();
|
||||
self.size = try!(context.resize(size));
|
||||
} else {
|
||||
self.size = size;
|
||||
unsafe { gl::Scissor(0, 0, size.width, size.height); }
|
||||
@ -191,7 +262,7 @@ impl WebGLPaintThread {
|
||||
|
||||
fn init(&mut self) {
|
||||
if let WebGLPaintTaskData::Readback(ref context, _) = self.data {
|
||||
context.make_current().unwrap();
|
||||
context.make_current();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,22 +85,14 @@ partial interface Element {
|
||||
DOMRectList getClientRects();
|
||||
DOMRect getBoundingClientRect();
|
||||
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scroll(optional ScrollToOptions options);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scroll(unrestricted double x, unrestricted double y);
|
||||
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollTo(optional ScrollToOptions options);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollTo(unrestricted double x, unrestricted double y);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollBy(optional ScrollToOptions options);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollBy(unrestricted double x, unrestricted double y);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
attribute unrestricted double scrollTop;
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
attribute unrestricted double scrollLeft;
|
||||
readonly attribute long scrollWidth;
|
||||
readonly attribute long scrollHeight;
|
||||
|
@ -138,17 +138,11 @@ partial interface Window {
|
||||
readonly attribute long pageXOffset;
|
||||
readonly attribute long scrollY;
|
||||
readonly attribute long pageYOffset;
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scroll(optional ScrollToOptions options);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scroll(unrestricted double x, unrestricted double y);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollTo(optional ScrollToOptions options);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollTo(unrestricted double x, unrestricted double y);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollBy(optional ScrollToOptions options);
|
||||
[Func="::script_can_initiate_scroll"]
|
||||
void scrollBy(unrestricted double x, unrestricted double y);
|
||||
|
||||
// client
|
||||
|
@ -114,10 +114,8 @@ mod webdriver_handlers;
|
||||
|
||||
use dom::bindings::codegen::RegisterBindings;
|
||||
use dom::bindings::proxyhandler;
|
||||
use js::jsapi::{Handle, JSContext, JSObject};
|
||||
use script_traits::SWManagerSenders;
|
||||
use serviceworker_manager::ServiceWorkerManager;
|
||||
use util::opts;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
#[allow(unsafe_code)]
|
||||
@ -175,13 +173,3 @@ pub fn init(sw_senders: SWManagerSenders) {
|
||||
|
||||
perform_platform_specific_initialization();
|
||||
}
|
||||
|
||||
/// FIXME(pcwalton): Currently WebRender cannot handle DOM-initiated scrolls. Remove this when it
|
||||
/// can. See PR #11680 for details.
|
||||
///
|
||||
/// This function is only marked `unsafe` because the `[Func=foo]` WebIDL attribute requires it. It
|
||||
/// shouldn't actually do anything unsafe.
|
||||
#[allow(unsafe_code)]
|
||||
pub unsafe fn script_can_initiate_scroll(_: *mut JSContext, _: Handle<*mut JSObject>) -> bool {
|
||||
!opts::get().use_webrender
|
||||
}
|
||||
|
44
servo/components/servo/Cargo.lock
generated
44
servo/components/servo/Cargo.lock
generated
@ -235,7 +235,7 @@ dependencies = [
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.5.1 (git+https://github.com/servo/webrender)",
|
||||
@ -369,7 +369,7 @@ dependencies = [
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -902,6 +902,8 @@ dependencies = [
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"osmesa-src 12.0.1 (git+https://github.com/servo/osmesa-src)",
|
||||
"osmesa-sys 0.1.2 (git+https://github.com/daggerbot/osmesa-rs)",
|
||||
"script_traits 0.0.1",
|
||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-glutin 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1617,7 +1619,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "offscreen_gl_context"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1626,6 +1628,7 @@ dependencies = [
|
||||
"gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x11 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1704,9 +1707,22 @@ dependencies = [
|
||||
"unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osmesa-src"
|
||||
version = "12.0.1"
|
||||
source = "git+https://github.com/servo/osmesa-src#aaccb7b7acdbcd54708db6530cea4177642cf64c"
|
||||
|
||||
[[package]]
|
||||
name = "osmesa-sys"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/daggerbot/osmesa-rs#7ef7ebc612302794e7ed3bd068c93b70950218a1"
|
||||
dependencies = [
|
||||
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osmesa-sys"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1971,7 +1987,7 @@ dependencies = [
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf_macros 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2055,7 +2071,7 @@ dependencies = [
|
||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2180,7 +2196,7 @@ dependencies = [
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"osmesa-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2645,7 +2661,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/servo/webrender#58b9e983a5e74ac1670fcf67f9c2ba68740ab2cc"
|
||||
source = "git+https://github.com/servo/webrender#cf945d15c71c757c6694b40a38fd7cfef1a2f827"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2661,7 +2677,7 @@ dependencies = [
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.5.1 (git+https://github.com/servo/webrender)",
|
||||
@ -2670,7 +2686,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/servo/webrender#58b9e983a5e74ac1670fcf67f9c2ba68740ab2cc"
|
||||
source = "git+https://github.com/servo/webrender#cf945d15c71c757c6694b40a38fd7cfef1a2f827"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2679,7 +2695,7 @@ dependencies = [
|
||||
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -2902,7 +2918,7 @@ dependencies = [
|
||||
"checksum num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3"
|
||||
"checksum objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9311aa5acd7bee14476afa0f0557f564e9d0d61218a8b833d9b1f871fa5fba"
|
||||
"checksum odds 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "f3701cfdec1676e319ad37ff96c31de39df8c92006032976153366f52693bf40"
|
||||
"checksum offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0860b03349dd951ade7f4fdb1f6724a76a3750b094a760d2aeee1af1d4706400"
|
||||
"checksum offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ffcda42bebbbbee2b403bc46d8ea85e0dcf25b5242592bde6eae7788d67cd655"
|
||||
"checksum ogg 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "426d8dc59cdd206be1925461087350385c0a02f291d87625829c6d08e72b457b"
|
||||
"checksum ogg_metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e755cc735fa6faa709cb23048433d9201d6caa85fa96215386ccdd5e9b40ad01"
|
||||
"checksum open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c228597177bc4a6876e278f7c7948ac033bfcb4d163ccdd5a009557c8fe5fa1e"
|
||||
@ -2911,7 +2927,9 @@ dependencies = [
|
||||
"checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa"
|
||||
"checksum openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed86cce894f6b0ed4572e21eb34026f1dc8869cb9ee3869029131bc8c3feb2d"
|
||||
"checksum ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cc511538298611a79d5a4ddfbb75315b866d942ed26a00bdc3590795c68b7279"
|
||||
"checksum osmesa-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b0040392971435cdab6bb52f0d4dc2fbb959c90b4263bec33af6ef092f8f828d"
|
||||
"checksum osmesa-src 12.0.1 (git+https://github.com/servo/osmesa-src)" = "<none>"
|
||||
"checksum osmesa-sys 0.1.2 (git+https://github.com/daggerbot/osmesa-rs)" = "<none>"
|
||||
"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"
|
||||
"checksum phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "52c875926de24c01b5b69153eaa258b57920a39b44bbce8ef1f2052a6c5a6a1a"
|
||||
"checksum phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0a8912c2cc0ea2e8ae70388ec0af9a445e7ab37b3c9cc61f059c2b34db8ed50b"
|
||||
"checksum phf_generator 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "04b5ea825e28cb6efd89d9133b129b2003b45a221aeda025509b125b00ecb7c4"
|
||||
|
@ -147,6 +147,12 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
|
||||
}
|
||||
};
|
||||
|
||||
let renderer_kind = if opts::get().should_use_osmesa() {
|
||||
webrender_traits::RendererKind::OSMesa
|
||||
} else {
|
||||
webrender_traits::RendererKind::Native
|
||||
};
|
||||
|
||||
let (webrender, webrender_sender) =
|
||||
webrender::Renderer::new(webrender::RendererOptions {
|
||||
device_pixel_ratio: device_pixel_ratio,
|
||||
@ -158,6 +164,7 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
|
||||
enable_recording: false,
|
||||
precache_shaders: opts.precache_shaders,
|
||||
enable_scrollbars: opts.output_file.is_none(),
|
||||
renderer_kind: renderer_kind,
|
||||
});
|
||||
(Some(webrender), Some(webrender_sender))
|
||||
} else {
|
||||
|
@ -791,8 +791,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
|
||||
!PREFS.get("shell.native-titlebar.enabled").as_boolean().unwrap();
|
||||
|
||||
let use_webrender =
|
||||
(PREFS.get("gfx.webrender.enabled").as_boolean().unwrap() || opt_match.opt_present("w")) &&
|
||||
!opt_match.opt_present("z");
|
||||
PREFS.get("gfx.webrender.enabled").as_boolean().unwrap() || opt_match.opt_present("w");
|
||||
|
||||
let render_api = match opt_match.opt_str("G") {
|
||||
Some(ref ga) if ga == "gl" => RenderApi::GL,
|
||||
@ -944,3 +943,9 @@ pub fn parse_url_or_filename(cwd: &Path, input: &str) -> Result<Url, ()> {
|
||||
Err(_) => Err(()),
|
||||
}
|
||||
}
|
||||
|
||||
impl Opts {
|
||||
pub fn should_use_osmesa(&self) -> bool {
|
||||
self.headless
|
||||
}
|
||||
}
|
||||
|
44
servo/ports/cef/Cargo.lock
generated
44
servo/ports/cef/Cargo.lock
generated
@ -208,7 +208,7 @@ dependencies = [
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.5.1 (git+https://github.com/servo/webrender)",
|
||||
@ -326,7 +326,7 @@ dependencies = [
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -809,6 +809,8 @@ dependencies = [
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"osmesa-src 12.0.1 (git+https://github.com/servo/osmesa-src)",
|
||||
"osmesa-sys 0.1.2 (git+https://github.com/daggerbot/osmesa-rs)",
|
||||
"script_traits 0.0.1",
|
||||
"servo-egl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo-glutin 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1488,7 +1490,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "offscreen_gl_context"
|
||||
version = "0.4.2"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1497,6 +1499,7 @@ dependencies = [
|
||||
"gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"x11 2.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -1575,9 +1578,22 @@ dependencies = [
|
||||
"unreachable 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osmesa-src"
|
||||
version = "12.0.1"
|
||||
source = "git+https://github.com/servo/osmesa-src#aaccb7b7acdbcd54708db6530cea4177642cf64c"
|
||||
|
||||
[[package]]
|
||||
name = "osmesa-sys"
|
||||
version = "0.1.1"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/daggerbot/osmesa-rs#7ef7ebc612302794e7ed3bd068c93b70950218a1"
|
||||
dependencies = [
|
||||
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "osmesa-sys"
|
||||
version = "0.1.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1822,7 +1838,7 @@ dependencies = [
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"phf_macros 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1896,7 +1912,7 @@ dependencies = [
|
||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"msg 0.0.1",
|
||||
"net_traits 0.0.1",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"profile_traits 0.0.1",
|
||||
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2063,7 +2079,7 @@ dependencies = [
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"osmesa-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"shared_library 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"user32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2505,7 +2521,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/servo/webrender#58b9e983a5e74ac1670fcf67f9c2ba68740ab2cc"
|
||||
source = "git+https://github.com/servo/webrender#cf945d15c71c757c6694b40a38fd7cfef1a2f827"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2521,7 +2537,7 @@ dependencies = [
|
||||
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.5.1 (git+https://github.com/servo/webrender)",
|
||||
@ -2530,7 +2546,7 @@ dependencies = [
|
||||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.5.1"
|
||||
source = "git+https://github.com/servo/webrender#58b9e983a5e74ac1670fcf67f9c2ba68740ab2cc"
|
||||
source = "git+https://github.com/servo/webrender#cf945d15c71c757c6694b40a38fd7cfef1a2f827"
|
||||
dependencies = [
|
||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2539,7 +2555,7 @@ dependencies = [
|
||||
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_macros 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
@ -2756,7 +2772,7 @@ dependencies = [
|
||||
"checksum num_cpus 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)" = "cee7e88156f3f9e19bdd598f8d6c9db7bf4078f99f8381f43a55b09648d1a6e3"
|
||||
"checksum objc 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7c9311aa5acd7bee14476afa0f0557f564e9d0d61218a8b833d9b1f871fa5fba"
|
||||
"checksum odds 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)" = "f3701cfdec1676e319ad37ff96c31de39df8c92006032976153366f52693bf40"
|
||||
"checksum offscreen_gl_context 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "0860b03349dd951ade7f4fdb1f6724a76a3750b094a760d2aeee1af1d4706400"
|
||||
"checksum offscreen_gl_context 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ffcda42bebbbbee2b403bc46d8ea85e0dcf25b5242592bde6eae7788d67cd655"
|
||||
"checksum ogg 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "426d8dc59cdd206be1925461087350385c0a02f291d87625829c6d08e72b457b"
|
||||
"checksum ogg_metadata 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e755cc735fa6faa709cb23048433d9201d6caa85fa96215386ccdd5e9b40ad01"
|
||||
"checksum open 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c228597177bc4a6876e278f7c7948ac033bfcb4d163ccdd5a009557c8fe5fa1e"
|
||||
@ -2765,7 +2781,9 @@ dependencies = [
|
||||
"checksum openssl-sys-extras 0.7.14 (registry+https://github.com/rust-lang/crates.io-index)" = "11c5e1dba7d3d03d80f045bf0d60111dc69213b67651e7c889527a3badabb9fa"
|
||||
"checksum openssl-verify 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ed86cce894f6b0ed4572e21eb34026f1dc8869cb9ee3869029131bc8c3feb2d"
|
||||
"checksum ordered-float 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cc511538298611a79d5a4ddfbb75315b866d942ed26a00bdc3590795c68b7279"
|
||||
"checksum osmesa-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b0040392971435cdab6bb52f0d4dc2fbb959c90b4263bec33af6ef092f8f828d"
|
||||
"checksum osmesa-src 12.0.1 (git+https://github.com/servo/osmesa-src)" = "<none>"
|
||||
"checksum osmesa-sys 0.1.2 (git+https://github.com/daggerbot/osmesa-rs)" = "<none>"
|
||||
"checksum osmesa-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "88cfece6e95d2e717e0872a7f53a8684712ad13822a7979bc760b9c77ec0013b"
|
||||
"checksum phf 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "52c875926de24c01b5b69153eaa258b57920a39b44bbce8ef1f2052a6c5a6a1a"
|
||||
"checksum phf_codegen 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "0a8912c2cc0ea2e8ae70388ec0af9a445e7ab37b3c9cc61f059c2b34db8ed50b"
|
||||
"checksum phf_generator 0.7.16 (registry+https://github.com/rust-lang/crates.io-index)" = "04b5ea825e28cb6efd89d9133b129b2003b45a221aeda025509b125b00ecb7c4"
|
||||
|
@ -23,6 +23,9 @@ style_traits = {path = "../../components/style_traits"}
|
||||
url = {version = "1.2", features = ["heap_size"]}
|
||||
util = {path = "../../components/util"}
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "macos"))'.dependencies]
|
||||
osmesa-sys = {git = "https://github.com/daggerbot/osmesa-rs"}
|
||||
|
||||
[target.'cfg(target_os = "linux")'.dependencies]
|
||||
x11 = "2.0.0"
|
||||
|
||||
@ -33,3 +36,9 @@ servo-egl = "0.2"
|
||||
winapi = "0.2"
|
||||
user32-sys = "0.2"
|
||||
gdi32-sys = "0.2"
|
||||
|
||||
[target.'cfg(target_os = "macos")'.dependencies]
|
||||
osmesa-src = {git = "https://github.com/servo/osmesa-src"}
|
||||
|
||||
[target.x86_64-unknown-linux-gnu.dependencies]
|
||||
osmesa-src = {git = "https://github.com/servo/osmesa-src"}
|
||||
|
@ -17,6 +17,7 @@ extern crate layers;
|
||||
#[macro_use] extern crate log;
|
||||
extern crate msg;
|
||||
extern crate net_traits;
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))] extern crate osmesa_sys;
|
||||
extern crate script_traits;
|
||||
extern crate style_traits;
|
||||
extern crate url;
|
||||
|
@ -24,10 +24,17 @@ use layers::platform::surface::NativeDisplay;
|
||||
use msg::constellation_msg::{self, Key};
|
||||
use msg::constellation_msg::{ALT, CONTROL, KeyState, NONE, SHIFT, SUPER};
|
||||
use net_traits::net_error_list::NetError;
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
use osmesa_sys;
|
||||
use script_traits::{TouchEventType, TouchpadPressurePhase};
|
||||
use std::cell::{Cell, RefCell};
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
use std::ffi::CString;
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
use std::mem;
|
||||
#[cfg(not(target_os = "android"))]
|
||||
use std::os::raw::c_void;
|
||||
use std::ptr;
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
use style_traits::cursor::Cursor;
|
||||
@ -91,9 +98,88 @@ fn builder_with_platform_options(builder: glutin::WindowBuilder) -> glutin::Wind
|
||||
builder
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
struct HeadlessContext {
|
||||
width: u32,
|
||||
height: u32,
|
||||
_context: osmesa_sys::OSMesaContext,
|
||||
_buffer: Vec<u32>,
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
struct HeadlessContext {
|
||||
width: u32,
|
||||
height: u32,
|
||||
}
|
||||
|
||||
impl HeadlessContext {
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
fn new(width: u32, height: u32) -> HeadlessContext {
|
||||
let mut attribs = Vec::new();
|
||||
|
||||
attribs.push(osmesa_sys::OSMESA_PROFILE);
|
||||
attribs.push(osmesa_sys::OSMESA_CORE_PROFILE);
|
||||
attribs.push(osmesa_sys::OSMESA_CONTEXT_MAJOR_VERSION);
|
||||
attribs.push(3);
|
||||
attribs.push(osmesa_sys::OSMESA_CONTEXT_MINOR_VERSION);
|
||||
attribs.push(3);
|
||||
attribs.push(0);
|
||||
|
||||
let context = unsafe {
|
||||
osmesa_sys::OSMesaCreateContextAttribs(attribs.as_ptr(), ptr::null_mut())
|
||||
};
|
||||
|
||||
assert!(!context.is_null());
|
||||
|
||||
let mut buffer = vec![0; (width * height) as usize];
|
||||
|
||||
unsafe {
|
||||
let ret = osmesa_sys::OSMesaMakeCurrent(context,
|
||||
buffer.as_mut_ptr() as *mut _,
|
||||
gl::UNSIGNED_BYTE,
|
||||
width as i32,
|
||||
height as i32);
|
||||
assert!(ret != 0);
|
||||
};
|
||||
|
||||
HeadlessContext {
|
||||
width: width,
|
||||
height: height,
|
||||
_context: context,
|
||||
_buffer: buffer,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
fn new(width: u32, height: u32) -> HeadlessContext {
|
||||
HeadlessContext {
|
||||
width: width,
|
||||
height: height,
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
fn get_proc_address(s: &str) -> *const c_void {
|
||||
let c_str = CString::new(s).expect("Unable to create CString");
|
||||
unsafe {
|
||||
mem::transmute(osmesa_sys::OSMesaGetProcAddress(c_str.as_ptr()))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
fn get_proc_address(_: &str) -> *const c_void {
|
||||
ptr::null() as *const _
|
||||
}
|
||||
}
|
||||
|
||||
enum WindowKind {
|
||||
Window(glutin::Window),
|
||||
Headless(HeadlessContext),
|
||||
}
|
||||
|
||||
/// The type of a window.
|
||||
pub struct Window {
|
||||
window: glutin::Window,
|
||||
kind: WindowKind,
|
||||
|
||||
mouse_down_button: Cell<Option<glutin::MouseButton>>,
|
||||
mouse_down_point: Cell<Point2D<i32>>,
|
||||
@ -139,43 +225,55 @@ impl Window {
|
||||
// #9996.
|
||||
let visible = is_foreground && !opts::get().no_native_titlebar;
|
||||
|
||||
let window_kind = if opts::get().headless {
|
||||
WindowKind::Headless(HeadlessContext::new(width, height))
|
||||
} else {
|
||||
let mut builder =
|
||||
glutin::WindowBuilder::new().with_title("Servo".to_string())
|
||||
.with_decorations(!opts::get().no_native_titlebar)
|
||||
.with_transparency(opts::get().no_native_titlebar)
|
||||
.with_dimensions(width, height)
|
||||
.with_gl(Window::gl_version())
|
||||
.with_visibility(visible)
|
||||
.with_parent(parent)
|
||||
.with_multitouch();
|
||||
|
||||
let mut builder =
|
||||
glutin::WindowBuilder::new().with_title("Servo".to_string())
|
||||
.with_decorations(!opts::get().no_native_titlebar)
|
||||
.with_transparency(opts::get().no_native_titlebar)
|
||||
.with_dimensions(width, height)
|
||||
.with_gl(Window::gl_version())
|
||||
.with_visibility(visible)
|
||||
.with_parent(parent)
|
||||
.with_multitouch();
|
||||
if let Ok(mut icon_path) = resource_files::resources_dir_path() {
|
||||
icon_path.push("servo.png");
|
||||
builder = builder.with_icon(icon_path);
|
||||
}
|
||||
|
||||
if opts::get().enable_vsync {
|
||||
builder = builder.with_vsync();
|
||||
}
|
||||
|
||||
if let Ok(mut icon_path) = resource_files::resources_dir_path() {
|
||||
icon_path.push("servo.png");
|
||||
builder = builder.with_icon(icon_path);
|
||||
if opts::get().use_msaa {
|
||||
builder = builder.with_multisampling(MULTISAMPLES)
|
||||
}
|
||||
|
||||
builder = builder_with_platform_options(builder);
|
||||
|
||||
let mut glutin_window = builder.build().expect("Failed to create window.");
|
||||
|
||||
unsafe { glutin_window.make_current().expect("Failed to make context current!") }
|
||||
|
||||
glutin_window.set_window_resize_callback(Some(Window::nested_window_resize as fn(u32, u32)));
|
||||
|
||||
WindowKind::Window(glutin_window)
|
||||
};
|
||||
|
||||
Window::load_gl_functions(&window_kind);
|
||||
|
||||
if opts::get().headless {
|
||||
// Print some information about the headless renderer that
|
||||
// can be useful in diagnosing CI failures on build machines.
|
||||
println!("{}", gl::get_string(gl::VENDOR));
|
||||
println!("{}", gl::get_string(gl::RENDERER));
|
||||
println!("{}", gl::get_string(gl::VERSION));
|
||||
}
|
||||
|
||||
if opts::get().enable_vsync {
|
||||
builder = builder.with_vsync();
|
||||
}
|
||||
|
||||
if opts::get().use_msaa {
|
||||
builder = builder.with_multisampling(MULTISAMPLES)
|
||||
}
|
||||
|
||||
builder = builder_with_platform_options(builder);
|
||||
|
||||
let mut glutin_window = builder.build().expect("Failed to create window.");
|
||||
|
||||
unsafe { glutin_window.make_current().expect("Failed to make context current!") }
|
||||
|
||||
glutin_window.set_window_resize_callback(Some(Window::nested_window_resize as fn(u32, u32)));
|
||||
|
||||
Window::load_gl_functions(&glutin_window);
|
||||
|
||||
let window = Window {
|
||||
window: glutin_window,
|
||||
kind: window_kind,
|
||||
event_queue: RefCell::new(vec!()),
|
||||
mouse_down_button: Cell::new(None),
|
||||
mouse_down_point: Cell::new(Point2D::new(0, 0)),
|
||||
@ -197,7 +295,14 @@ impl Window {
|
||||
}
|
||||
|
||||
pub fn platform_window(&self) -> glutin::WindowID {
|
||||
unsafe { glutin::WindowID::new(self.window.platform_window()) }
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
unsafe { glutin::WindowID::new(window.platform_window()) }
|
||||
}
|
||||
WindowKind::Headless(..) => {
|
||||
unreachable!();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn nested_window_resize(width: u32, height: u32) {
|
||||
@ -233,12 +338,21 @@ impl Window {
|
||||
}
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn load_gl_functions(window: &glutin::Window) {
|
||||
gl::load_with(|s| window.get_proc_address(s) as *const c_void);
|
||||
fn load_gl_functions(window_kind: &WindowKind) {
|
||||
match window_kind {
|
||||
&WindowKind::Window(ref window) => {
|
||||
gl::load_with(|s| window.get_proc_address(s) as *const c_void);
|
||||
}
|
||||
&WindowKind::Headless(..) => {
|
||||
gl::load_with(|s| {
|
||||
HeadlessContext::get_proc_address(s)
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "android")]
|
||||
fn load_gl_functions(_: &glutin::Window) {
|
||||
fn load_gl_functions(_: &WindowKind) {
|
||||
}
|
||||
|
||||
fn handle_window_event(&self, event: glutin::Event) -> bool {
|
||||
@ -417,23 +531,30 @@ impl Window {
|
||||
|
||||
#[cfg(any(target_os = "macos", target_os = "windows"))]
|
||||
fn handle_next_event(&self) -> bool {
|
||||
let event = match self.window.wait_events().next() {
|
||||
None => {
|
||||
warn!("Window event stream closed.");
|
||||
return false;
|
||||
},
|
||||
Some(event) => event,
|
||||
};
|
||||
let mut close = self.handle_window_event(event);
|
||||
if !close {
|
||||
while let Some(event) = self.window.poll_events().next() {
|
||||
if self.handle_window_event(event) {
|
||||
close = true;
|
||||
break
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
let event = match window.wait_events().next() {
|
||||
None => {
|
||||
warn!("Window event stream closed.");
|
||||
return false;
|
||||
},
|
||||
Some(event) => event,
|
||||
};
|
||||
let mut close = self.handle_window_event(event);
|
||||
if !close {
|
||||
while let Some(event) = window.poll_events().next() {
|
||||
if self.handle_window_event(event) {
|
||||
close = true;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
close
|
||||
}
|
||||
WindowKind::Headless(..) => {
|
||||
false
|
||||
}
|
||||
}
|
||||
close
|
||||
}
|
||||
|
||||
#[cfg(any(target_os = "linux", target_os = "android"))]
|
||||
@ -445,23 +566,30 @@ impl Window {
|
||||
// because it doesn't call X11 functions from another thread, so doesn't
|
||||
// hit the same issues explained below.
|
||||
if opts::get().use_webrender {
|
||||
let event = match self.window.wait_events().next() {
|
||||
None => {
|
||||
warn!("Window event stream closed.");
|
||||
return false;
|
||||
},
|
||||
Some(event) => event,
|
||||
};
|
||||
let mut close = self.handle_window_event(event);
|
||||
if !close {
|
||||
while let Some(event) = self.window.poll_events().next() {
|
||||
if self.handle_window_event(event) {
|
||||
close = true;
|
||||
break
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
let event = match window.wait_events().next() {
|
||||
None => {
|
||||
warn!("Window event stream closed.");
|
||||
return false;
|
||||
},
|
||||
Some(event) => event,
|
||||
};
|
||||
let mut close = self.handle_window_event(event);
|
||||
if !close {
|
||||
while let Some(event) = window.poll_events().next() {
|
||||
if self.handle_window_event(event) {
|
||||
close = true;
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
close
|
||||
}
|
||||
WindowKind::Headless(..) => {
|
||||
false
|
||||
}
|
||||
}
|
||||
close
|
||||
} else {
|
||||
// TODO(gw): This is an awful hack to work around the
|
||||
// broken way we currently call X11 from multiple threads.
|
||||
@ -480,14 +608,21 @@ impl Window {
|
||||
//
|
||||
// See https://github.com/servo/servo/issues/5780
|
||||
//
|
||||
let first_event = self.window.poll_events().next();
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
let first_event = window.poll_events().next();
|
||||
|
||||
match first_event {
|
||||
Some(event) => {
|
||||
self.handle_window_event(event)
|
||||
match first_event {
|
||||
Some(event) => {
|
||||
self.handle_window_event(event)
|
||||
}
|
||||
None => {
|
||||
thread::sleep(Duration::from_millis(16));
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
thread::sleep(Duration::from_millis(16));
|
||||
WindowKind::Headless(..) => {
|
||||
false
|
||||
}
|
||||
}
|
||||
@ -504,8 +639,13 @@ impl Window {
|
||||
// polling so that we don't block on a GUI event
|
||||
// such as mouse click.
|
||||
if opts::get().output_file.is_some() || opts::get().exit_after_load || opts::get().headless {
|
||||
while let Some(event) = self.window.poll_events().next() {
|
||||
close_event = self.handle_window_event(event) || close_event;
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
while let Some(event) = window.poll_events().next() {
|
||||
close_event = self.handle_window_event(event) || close_event;
|
||||
}
|
||||
}
|
||||
WindowKind::Headless(..) => {}
|
||||
}
|
||||
} else {
|
||||
close_event = self.handle_next_event();
|
||||
@ -671,44 +811,89 @@ fn create_window_proxy(_: &Window) -> Option<glutin::WindowProxy> {
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
fn create_window_proxy(window: &Window) -> Option<glutin::WindowProxy> {
|
||||
Some(window.window.create_window_proxy())
|
||||
match window.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
Some(window.create_window_proxy())
|
||||
}
|
||||
WindowKind::Headless(..) => {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl WindowMethods for Window {
|
||||
fn framebuffer_size(&self) -> TypedSize2D<u32, DevicePixel> {
|
||||
let scale_factor = self.window.hidpi_factor() as u32;
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (width, height) = self.window.get_inner_size().expect("Failed to get window inner size.");
|
||||
TypedSize2D::new(width * scale_factor, height * scale_factor)
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
let scale_factor = window.hidpi_factor() as u32;
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (width, height) = window.get_inner_size().expect("Failed to get window inner size.");
|
||||
TypedSize2D::new(width * scale_factor, height * scale_factor)
|
||||
}
|
||||
WindowKind::Headless(ref context) => {
|
||||
TypedSize2D::new(context.width, context.height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn size(&self) -> TypedSize2D<f32, ScreenPx> {
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (width, height) = self.window.get_inner_size().expect("Failed to get window inner size.");
|
||||
TypedSize2D::new(width as f32, height as f32)
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (width, height) = window.get_inner_size().expect("Failed to get window inner size.");
|
||||
TypedSize2D::new(width as f32, height as f32)
|
||||
}
|
||||
WindowKind::Headless(ref context) => {
|
||||
TypedSize2D::new(context.width as f32, context.height as f32)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn client_window(&self) -> (Size2D<u32>, Point2D<i32>) {
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (width, height) = self.window.get_outer_size().expect("Failed to get window outer size.");
|
||||
let size = Size2D::new(width, height);
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (x, y) = self.window.get_position().expect("Failed to get window position.");
|
||||
let origin = Point2D::new(x as i32, y as i32);
|
||||
(size, origin)
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (width, height) = window.get_outer_size().expect("Failed to get window outer size.");
|
||||
let size = Size2D::new(width, height);
|
||||
// TODO(ajeffrey): can this fail?
|
||||
let (x, y) = window.get_position().expect("Failed to get window position.");
|
||||
let origin = Point2D::new(x as i32, y as i32);
|
||||
(size, origin)
|
||||
}
|
||||
WindowKind::Headless(ref context) => {
|
||||
let size = TypedSize2D::new(context.width, context.height);
|
||||
(size, Point2D::zero())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
fn set_inner_size(&self, size: Size2D<u32>) {
|
||||
self.window.set_inner_size(size.width as u32, size.height as u32)
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
window.set_inner_size(size.width as u32, size.height as u32)
|
||||
}
|
||||
WindowKind::Headless(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn set_position(&self, point: Point2D<i32>) {
|
||||
self.window.set_position(point.x, point.y)
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
window.set_position(point.x, point.y)
|
||||
}
|
||||
WindowKind::Headless(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn present(&self) {
|
||||
if let Err(err) = self.window.swap_buffers() {
|
||||
warn!("Failed to swap window buffers ({}).", err);
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
if let Err(err) = window.swap_buffers() {
|
||||
warn!("Failed to swap window buffers ({}).", err);
|
||||
}
|
||||
}
|
||||
WindowKind::Headless(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
@ -727,7 +912,14 @@ impl WindowMethods for Window {
|
||||
|
||||
#[cfg(not(target_os = "windows"))]
|
||||
fn scale_factor(&self) -> ScaleFactor<f32, ScreenPx, DevicePixel> {
|
||||
ScaleFactor::new(self.window.hidpi_factor())
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
ScaleFactor::new(window.hidpi_factor())
|
||||
}
|
||||
WindowKind::Headless(..) => {
|
||||
ScaleFactor::new(1.0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
@ -738,18 +930,23 @@ impl WindowMethods for Window {
|
||||
}
|
||||
|
||||
fn set_page_title(&self, title: Option<String>) {
|
||||
let fallback_title: String = if let Some(ref current_url) = *self.current_url.borrow() {
|
||||
current_url.to_string()
|
||||
} else {
|
||||
String::from("Untitled")
|
||||
};
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
let fallback_title: String = if let Some(ref current_url) = *self.current_url.borrow() {
|
||||
current_url.to_string()
|
||||
} else {
|
||||
String::from("Untitled")
|
||||
};
|
||||
|
||||
let title = match title {
|
||||
Some(ref title) if title.len() > 0 => &**title,
|
||||
_ => &fallback_title,
|
||||
};
|
||||
let title = format!("{} - Servo", title);
|
||||
self.window.set_title(&title);
|
||||
let title = match title {
|
||||
Some(ref title) if title.len() > 0 => &**title,
|
||||
_ => &fallback_title,
|
||||
};
|
||||
let title = format!("{} - Servo", title);
|
||||
window.set_title(&title);
|
||||
}
|
||||
WindowKind::Headless(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn set_page_url(&self, url: Url) {
|
||||
@ -764,7 +961,12 @@ impl WindowMethods for Window {
|
||||
|
||||
fn load_end(&self, _: bool, _: bool, root: bool) {
|
||||
if root && opts::get().no_native_titlebar {
|
||||
self.window.show()
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
window.show();
|
||||
}
|
||||
WindowKind::Headless(..) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -776,46 +978,51 @@ impl WindowMethods for Window {
|
||||
|
||||
/// Has no effect on Android.
|
||||
fn set_cursor(&self, c: Cursor) {
|
||||
use glutin::MouseCursor;
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
use glutin::MouseCursor;
|
||||
|
||||
let glutin_cursor = match c {
|
||||
Cursor::None => MouseCursor::NoneCursor,
|
||||
Cursor::Default => MouseCursor::Default,
|
||||
Cursor::Pointer => MouseCursor::Hand,
|
||||
Cursor::ContextMenu => MouseCursor::ContextMenu,
|
||||
Cursor::Help => MouseCursor::Help,
|
||||
Cursor::Progress => MouseCursor::Progress,
|
||||
Cursor::Wait => MouseCursor::Wait,
|
||||
Cursor::Cell => MouseCursor::Cell,
|
||||
Cursor::Crosshair => MouseCursor::Crosshair,
|
||||
Cursor::Text => MouseCursor::Text,
|
||||
Cursor::VerticalText => MouseCursor::VerticalText,
|
||||
Cursor::Alias => MouseCursor::Alias,
|
||||
Cursor::Copy => MouseCursor::Copy,
|
||||
Cursor::Move => MouseCursor::Move,
|
||||
Cursor::NoDrop => MouseCursor::NoDrop,
|
||||
Cursor::NotAllowed => MouseCursor::NotAllowed,
|
||||
Cursor::Grab => MouseCursor::Grab,
|
||||
Cursor::Grabbing => MouseCursor::Grabbing,
|
||||
Cursor::EResize => MouseCursor::EResize,
|
||||
Cursor::NResize => MouseCursor::NResize,
|
||||
Cursor::NeResize => MouseCursor::NeResize,
|
||||
Cursor::NwResize => MouseCursor::NwResize,
|
||||
Cursor::SResize => MouseCursor::SResize,
|
||||
Cursor::SeResize => MouseCursor::SeResize,
|
||||
Cursor::SwResize => MouseCursor::SwResize,
|
||||
Cursor::WResize => MouseCursor::WResize,
|
||||
Cursor::EwResize => MouseCursor::EwResize,
|
||||
Cursor::NsResize => MouseCursor::NsResize,
|
||||
Cursor::NeswResize => MouseCursor::NeswResize,
|
||||
Cursor::NwseResize => MouseCursor::NwseResize,
|
||||
Cursor::ColResize => MouseCursor::ColResize,
|
||||
Cursor::RowResize => MouseCursor::RowResize,
|
||||
Cursor::AllScroll => MouseCursor::AllScroll,
|
||||
Cursor::ZoomIn => MouseCursor::ZoomIn,
|
||||
Cursor::ZoomOut => MouseCursor::ZoomOut,
|
||||
};
|
||||
self.window.set_cursor(glutin_cursor);
|
||||
let glutin_cursor = match c {
|
||||
Cursor::None => MouseCursor::NoneCursor,
|
||||
Cursor::Default => MouseCursor::Default,
|
||||
Cursor::Pointer => MouseCursor::Hand,
|
||||
Cursor::ContextMenu => MouseCursor::ContextMenu,
|
||||
Cursor::Help => MouseCursor::Help,
|
||||
Cursor::Progress => MouseCursor::Progress,
|
||||
Cursor::Wait => MouseCursor::Wait,
|
||||
Cursor::Cell => MouseCursor::Cell,
|
||||
Cursor::Crosshair => MouseCursor::Crosshair,
|
||||
Cursor::Text => MouseCursor::Text,
|
||||
Cursor::VerticalText => MouseCursor::VerticalText,
|
||||
Cursor::Alias => MouseCursor::Alias,
|
||||
Cursor::Copy => MouseCursor::Copy,
|
||||
Cursor::Move => MouseCursor::Move,
|
||||
Cursor::NoDrop => MouseCursor::NoDrop,
|
||||
Cursor::NotAllowed => MouseCursor::NotAllowed,
|
||||
Cursor::Grab => MouseCursor::Grab,
|
||||
Cursor::Grabbing => MouseCursor::Grabbing,
|
||||
Cursor::EResize => MouseCursor::EResize,
|
||||
Cursor::NResize => MouseCursor::NResize,
|
||||
Cursor::NeResize => MouseCursor::NeResize,
|
||||
Cursor::NwResize => MouseCursor::NwResize,
|
||||
Cursor::SResize => MouseCursor::SResize,
|
||||
Cursor::SeResize => MouseCursor::SeResize,
|
||||
Cursor::SwResize => MouseCursor::SwResize,
|
||||
Cursor::WResize => MouseCursor::WResize,
|
||||
Cursor::EwResize => MouseCursor::EwResize,
|
||||
Cursor::NsResize => MouseCursor::NsResize,
|
||||
Cursor::NeswResize => MouseCursor::NeswResize,
|
||||
Cursor::NwseResize => MouseCursor::NwseResize,
|
||||
Cursor::ColResize => MouseCursor::ColResize,
|
||||
Cursor::RowResize => MouseCursor::RowResize,
|
||||
Cursor::AllScroll => MouseCursor::AllScroll,
|
||||
Cursor::ZoomIn => MouseCursor::ZoomIn,
|
||||
Cursor::ZoomOut => MouseCursor::ZoomOut,
|
||||
};
|
||||
window.set_cursor(glutin_cursor);
|
||||
}
|
||||
WindowKind::Headless(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
fn set_favicon(&self, _: Url) {
|
||||
@ -831,7 +1038,14 @@ impl WindowMethods for Window {
|
||||
unsafe {
|
||||
match opts::get().render_api {
|
||||
RenderApi::GL => {
|
||||
NativeDisplay::new(self.window.platform_display() as *mut xlib::Display)
|
||||
match self.kind {
|
||||
WindowKind::Window(ref window) => {
|
||||
NativeDisplay::new(window.platform_display() as *mut xlib::Display)
|
||||
}
|
||||
WindowKind::Headless(..) => {
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
},
|
||||
RenderApi::ES2 => {
|
||||
NativeDisplay::new_egl_display()
|
||||
|
@ -7,6 +7,7 @@
|
||||
# option. This file may not be copied, modified, or distributed
|
||||
# except according to those terms.
|
||||
|
||||
from glob import glob
|
||||
import gzip
|
||||
import itertools
|
||||
import locale
|
||||
@ -47,6 +48,17 @@ def setlocale(name):
|
||||
locale.setlocale(locale.LC_ALL, saved_locale)
|
||||
|
||||
|
||||
def find_dep_path_newest(package, bin_path):
|
||||
deps_path = path.join(path.split(bin_path)[0], "build")
|
||||
with cd(deps_path):
|
||||
candidates = glob(package + '-*')
|
||||
candidates = (path.join(deps_path, c) for c in candidates)
|
||||
candidate_times = sorted(((path.getmtime(c), c) for c in candidates), reverse=True)
|
||||
if len(candidate_times) > 0:
|
||||
return candidate_times[0][1]
|
||||
return None
|
||||
|
||||
|
||||
def archive_deterministically(dir_to_archive, dest_archive, prepend_path=None):
|
||||
"""Create a .tar.gz archive in a deterministic (reproducible) manner.
|
||||
|
||||
|
@ -9,7 +9,6 @@
|
||||
|
||||
from __future__ import print_function, unicode_literals
|
||||
|
||||
from glob import glob
|
||||
import os
|
||||
import os.path as path
|
||||
import subprocess
|
||||
@ -23,7 +22,7 @@ from mach.decorators import (
|
||||
Command,
|
||||
)
|
||||
|
||||
from servo.command_base import CommandBase, cd, call, check_call, is_windows, is_macosx
|
||||
from servo.command_base import CommandBase, call, check_call, find_dep_path_newest, is_windows, is_macosx
|
||||
|
||||
|
||||
def read_file(filename, if_exists=False):
|
||||
@ -33,18 +32,6 @@ def read_file(filename, if_exists=False):
|
||||
return f.read()
|
||||
|
||||
|
||||
def find_dep_path_newest(package, bin_path):
|
||||
deps_path = path.join(path.split(bin_path)[0], "build")
|
||||
with cd(deps_path):
|
||||
print(os.getcwd())
|
||||
candidates = glob(package + '-*')
|
||||
candidates = (path.join(deps_path, c) for c in candidates)
|
||||
candidate_times = sorted(((path.getmtime(c), c) for c in candidates), reverse=True)
|
||||
if len(candidate_times) > 0:
|
||||
return candidate_times[0][1]
|
||||
return None
|
||||
|
||||
|
||||
@CommandProvider
|
||||
class PostBuildCommands(CommandBase):
|
||||
@Command('run',
|
||||
|
@ -25,7 +25,7 @@ from mach.decorators import (
|
||||
Command,
|
||||
)
|
||||
|
||||
from servo.command_base import CommandBase, call, cd, check_call, host_triple
|
||||
from servo.command_base import BuildNotFound, CommandBase, call, cd, check_call, find_dep_path_newest, host_triple
|
||||
from wptrunner import wptcommandline
|
||||
from update import updatecommandline
|
||||
from servo_tidy import tidy
|
||||
@ -413,6 +413,32 @@ class MachCommands(CommandBase):
|
||||
|
||||
# Helper for test_css and test_wpt:
|
||||
def wptrunner(self, run_file, **kwargs):
|
||||
# On Linux and mac, find the OSMesa software rendering library and
|
||||
# add it to the dynamic linker search path.
|
||||
if sys.platform.startswith('linux'):
|
||||
try:
|
||||
args = [self.get_binary_path(True, False)]
|
||||
osmesa_path = path.join(find_dep_path_newest('osmesa-src', args[0]), "out", "lib", "gallium")
|
||||
os.environ["LD_LIBRARY_PATH"] = osmesa_path
|
||||
os.environ["GALLIUM_DRIVER"] = "softpipe"
|
||||
except BuildNotFound:
|
||||
# This can occur when cross compiling (e.g. arm64), in which case
|
||||
# we won't run the tests anyway so can safely ignore this step.
|
||||
pass
|
||||
if sys.platform.startswith('darwin'):
|
||||
try:
|
||||
args = [self.get_binary_path(True, False)]
|
||||
osmesa_path = path.join(find_dep_path_newest('osmesa-src', args[0]),
|
||||
"out", "src", "gallium", "targets", "osmesa", ".libs")
|
||||
glapi_path = path.join(find_dep_path_newest('osmesa-src', args[0]),
|
||||
"out", "src", "mapi", "shared-glapi", ".libs")
|
||||
os.environ["DYLD_LIBRARY_PATH"] = osmesa_path + ":" + glapi_path
|
||||
os.environ["GALLIUM_DRIVER"] = "softpipe"
|
||||
except BuildNotFound:
|
||||
# This can occur when cross compiling (e.g. arm64), in which case
|
||||
# we won't run the tests anyway so can safely ignore this step.
|
||||
pass
|
||||
|
||||
os.environ["RUST_BACKTRACE"] = "1"
|
||||
kwargs["debug"] = not kwargs["release"]
|
||||
if kwargs.pop("chaos"):
|
||||
|
Loading…
Reference in New Issue
Block a user