Skip to content
Permalink
Browse files

Auto merge of #25853 - asajeffrey:surfmanup, r=<try>

WIP Replace glutin by winit + surfman 0.2

<!-- Please describe your changes on the following line: -->

This PR updates surfman to 0.2, and replaces glutin with winit+surfman.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because this should all be invisible

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
  • Loading branch information
bors-servo committed Mar 24, 2020
2 parents 6ca767d + 31b8714 commit e465b27417c3953302bba1bb32825d09673c2e29
Showing with 2,247 additions and 1,478 deletions.
  1. +19 −61 Cargo.lock
  2. +17 −0 Cargo.toml
  3. +1 −1 components/canvas/Cargo.toml
  4. +17 −29 components/canvas/webgl_mode/inprocess.rs
  5. +300 −142 components/canvas/webgl_thread.rs
  6. +1 −1 components/canvas_traits/webgl.rs
  7. +1 −0 components/compositing/Cargo.toml
  8. +64 −7 components/compositing/compositor.rs
  9. +4 −0 components/compositing/compositor_thread.rs
  10. +8 −13 components/compositing/windowing.rs
  11. +5 −1 components/config/prefs.rs
  12. +20 −2 components/script/dom/webgl_extensions/extensions.rs
  13. +1 −1 components/script/dom/webglrenderbuffer.rs
  14. +43 −2 components/script/dom/webglshader.rs
  15. +1 −1 components/servo/Cargo.toml
  16. +47 −54 components/servo/lib.rs
  17. +3 −0 components/webrender_traits/Cargo.toml
  18. +187 −0 components/webrender_traits/lib.rs
  19. +10 −8 etc/taskcluster/decision_task.py
  20. +2 −5 ports/glutin/Cargo.toml
  21. +29 −33 ports/glutin/app.rs
  22. +0 −172 ports/glutin/context.rs
  23. +7 −67 ports/glutin/embedder.rs
  24. +17 −23 ports/glutin/events_loop.rs
  25. +244 −277 ports/glutin/headed_window.rs
  26. +61 −141 ports/glutin/headless_window.rs
  27. +3 −3 ports/glutin/keyutils.rs
  28. +1 −11 ports/glutin/main2.rs
  29. +6 −4 ports/glutin/window_trait.rs
  30. +76 −205 ports/gstplugin/servowebsrc.rs
  31. +1 −0 ports/libsimpleservo/api/Cargo.toml
  32. +34 −22 ports/libsimpleservo/api/src/lib.rs
  33. +1 −0 ports/libsimpleservo/capi/Cargo.toml
  34. +11 −12 ports/libsimpleservo/capi/src/lib.rs
  35. +2 −0 python/servo/command_base.py
  36. +0 −1 python/servo/testing_commands.py
  37. +1 −0 resources/prefs.json
  38. +0 −4 servo-tidy.toml
  39. +1 −1 support/hololens/ServoApp/DefaultUrl.h
  40. +2 −2 support/hololens/ServoApp/ServoApp.vcxproj
  41. +0 −48 support/hololens/ServoApp/ServoControl/OpenGLES.cpp
  42. +3 −8 support/hololens/ServoApp/ServoControl/OpenGLES.h
  43. +6 −7 support/hololens/ServoApp/ServoControl/Servo.cpp
  44. +3 −3 support/hololens/ServoApp/ServoControl/Servo.h
  45. +18 −31 support/hololens/ServoApp/ServoControl/ServoControl.cpp
  46. +7 −5 support/hololens/ServoApp/ServoControl/ServoControl.h
  47. +1 −1 support/hololens/ServoApp/packages.config
  48. +4 −0 tests/wpt/metadata/css/css-images/gradients-with-border.html.ini
  49. +0 −2 tests/wpt/mozilla/meta-layout-2020/css/text_node_opacity.html.ini
  50. +0 −2 tests/wpt/mozilla/meta/css/text_node_opacity.html.ini
  51. +1 −1 tests/wpt/webgl/meta/MANIFEST.json
  52. +6 −0 tests/wpt/webgl/meta/conformance/attribs/gl-disabled-vertex-attrib.html.ini
  53. +4 −0 tests/wpt/webgl/meta/conformance/attribs/gl-vertex-attrib-unconsumed-out-of-bounds.html.ini
  54. +42 −0 tests/wpt/webgl/meta/conformance/attribs/gl-vertex-attrib-zero-issues.html.ini
  55. +4 −1 tests/wpt/webgl/meta/conformance/extensions/angle-instanced-arrays-out-of-bounds.html.ini
  56. +45 −14 tests/wpt/webgl/meta/conformance/glsl/misc/shader-varying-packing-restrictions.html.ini
  57. +12 −0 tests/wpt/webgl/meta/conformance/glsl/misc/shaders-with-invariance.html.ini
  58. +10 −0 tests/wpt/webgl/meta/conformance/programs/gl-bind-attrib-location-long-names-test.html.ini
  59. +10 −0 tests/wpt/webgl/meta/conformance/programs/gl-bind-attrib-location-test.html.ini
  60. +60 −1 tests/wpt/webgl/meta/conformance/reading/read-pixels-test.html.ini
  61. +3 −0 tests/wpt/webgl/meta/conformance/renderbuffers/feedback-loop.html.ini
  62. +8 −0 tests/wpt/webgl/meta/conformance/rendering/line-rendering-quality.html.ini
  63. +6 −0 tests/wpt/webgl/meta/conformance/rendering/point-no-attributes.html.ini
  64. +0 −2 tests/wpt/webgl/meta/conformance/rendering/rendering-stencil-large-viewport.html.ini
  65. +18 −0 tests/wpt/webgl/meta/conformance/textures/misc/copy-tex-image-2d-formats.html.ini
  66. +2 −0 tests/wpt/webgl/meta/conformance/textures/misc/copy-tex-image-and-sub-image-2d.html.ini
  67. +4 −2 tests/wpt/webgl/meta/conformance/uniforms/out-of-bounds-uniform-array-access.html.ini
  68. +100 −0 tests/wpt/webgl/meta/conformance2/buffers/bound-buffer-size-change-test.html.ini
  69. +6 −0 tests/wpt/webgl/meta/conformance2/glsl3/vector-dynamic-indexing-swizzled-lvalue.html.ini
  70. +58 −0 tests/wpt/webgl/meta/conformance2/reading/read-pixels-pack-parameters.html.ini
  71. +2 −0 tests/wpt/webgl/meta/conformance2/renderbuffers/framebuffer-object-attachment.html.ini
  72. +4 −0 tests/wpt/webgl/meta/conformance2/renderbuffers/framebuffer-test.html.ini
  73. +4 −1 tests/wpt/webgl/meta/conformance2/renderbuffers/invalidate-framebuffer.html.ini
  74. +7 −7 tests/wpt/webgl/meta/conformance2/rendering/blitframebuffer-filter-outofbounds.html.ini
  75. +16 −3 tests/wpt/webgl/meta/conformance2/rendering/blitframebuffer-multisampled-readbuffer.html.ini
  76. +3 −3 tests/wpt/webgl/meta/conformance2/rendering/blitframebuffer-outside-readbuffer.html.ini
  77. +6 −6 tests/wpt/webgl/meta/conformance2/rendering/blitframebuffer-scissor-enabled.html.ini
  78. +28 −2 tests/wpt/webgl/meta/conformance2/rendering/clear-func-buffer-type-match.html.ini
  79. +3 −3 tests/wpt/webgl/meta/conformance2/rendering/framebuffer-unsupported.html.ini
  80. +25 −2 tests/wpt/webgl/meta/conformance2/rendering/fs-color-type-mismatch-color-buffer-type.html.ini
  81. +4 −0 tests/wpt/webgl/meta/conformance2/rendering/line-rendering-quality.html.ini
  82. +21 −6 tests/wpt/webgl/meta/conformance2/rendering/rgb-format-support.html.ini
  83. +9 −2 tests/wpt/webgl/meta/conformance2/rendering/uniform-block-buffer-size.html.ini
  84. +2 −3 tests/wpt/webgl/meta/conformance2/state/gl-object-get-calls.html.ini
  85. +359 −1 tests/wpt/webgl/meta/conformance2/transform_feedback/too-small-buffers.html.ini
  86. +10 −5 tests/wpt/webgl/tests/conformance/glsl/misc/shader-varying-packing-restrictions.html
  87. +1 −0 tests/wpt/webgl/tools/import-conformance-tests.py
  88. +54 −0 tests/wpt/webgl/tools/shader-varying-packing-restrictions.patch

Some generated files are not rendered by default. Learn more.

@@ -32,3 +32,20 @@ mio = { git = "https://github.com/servo/mio.git", branch = "servo" }
winapi = { git = "https://github.com/servo/winapi-rs", branch = "patch-1" }
spirv_cross = { git = "https://github.com/servo/spirv_cross", branch = "wgpu-servo" }
backtrace = { git = "https://github.com/MeFisto94/backtrace-rs", branch = "fix-strtab-freeing-crash" }
surfman-chains = { git = "https://github.com/asajeffrey/surfman-chains", branch = "multi" }
# surfman-chains = { path = "../surfman-chains/surfman-chains" }
surfman = { git = "https://github.com/asajeffrey/surfman", branch = "servo-surfmanup" }
# surfman = { path = "../surfman/surfman" }

[patch."https://github.com/pcwalton/surfman"]
surfman = { git = "https://github.com/asajeffrey/surfman", branch = "servo-surfmanup" }
# surfman = { path = "../surfman/surfman" }

[patch."https://github.com/asajeffrey/surfman-chains"]
# surfman-chains = { path = "../surfman-chains/surfman-chains" }

[patch."https://github.com/servo/webxr"]
webxr-api = {git = "https://github.com/asajeffrey/webxr", branch = "surfmanup"}
webxr = {git = "https://github.com/asajeffrey/webxr", branch = "surfmanup"}
# webxr-api = {path="../webxr/webxr-api"}
# webxr = {path="../webxr/webxr"}
@@ -41,6 +41,6 @@ webrender_api = {git = "https://github.com/servo/webrender"}
webrender_traits = {path = "../webrender_traits"}
webxr-api = {git = "https://github.com/servo/webxr", features = ["ipc"]}
# NOTE: the sm-angle feature only enables angle on windows, not other platforms!
surfman = { version = "0.1", features = ["sm-angle", "sm-osmesa"] }
surfman = { version = "0.2", features = ["sm-angle","sm-angle-default"] }
surfman-chains = "0.3"
surfman-chains-api = "0.2"
@@ -15,19 +15,19 @@ use std::collections::HashMap;
use std::default::Default;
use std::rc::Rc;
use std::sync::{Arc, Mutex};
use surfman::platform::generic::universal::context::Context;
use surfman::platform::generic::universal::device::Device;
use surfman::platform::generic::universal::surface::SurfaceTexture;
use surfman::Device;
use surfman::SurfaceInfo;
use surfman::SurfaceTexture;
use surfman_chains::SwapChains;
use surfman_chains_api::SwapChainAPI;
use surfman_chains_api::SwapChainsAPI;
use webrender_traits::WebrenderSurfman;
use webrender_traits::{WebrenderExternalImageApi, WebrenderExternalImageRegistry};
use webxr_api::SwapChainId as WebXRSwapChainId;

pub struct WebGLComm {
pub webgl_threads: WebGLThreads,
pub webxr_swap_chains: SwapChains<WebXRSwapChainId>,
pub webxr_swap_chains: SwapChains<WebXRSwapChainId, Device>,
pub webxr_surface_providers: SurfaceProviders,
pub image_handler: Box<dyn WebrenderExternalImageApi>,
pub output_handler: Option<Box<dyn webrender_api::OutputImageHandler>>,
@@ -37,8 +37,7 @@ pub struct WebGLComm {
impl WebGLComm {
/// Creates a new `WebGLComm` object.
pub fn new(
device: Device,
context: Context,
surfman: WebrenderSurfman,
webrender_gl: Rc<dyn gleam::gl::Gl>,
webrender_api_sender: webrender_api::RenderApiSender,
webvr_compositor: Option<Box<dyn WebVRRenderHandler>>,
@@ -62,8 +61,8 @@ impl WebGLComm {
webrender_swap_chains: webrender_swap_chains.clone(),
webxr_swap_chains: webxr_swap_chains.clone(),
webxr_surface_providers: webxr_surface_providers.clone(),
connection: device.connection(),
adapter: device.adapter(),
connection: surfman.connection(),
adapter: surfman.adapter(),
api_type,
runnable_receiver,
};
@@ -74,7 +73,7 @@ impl WebGLComm {
None
};

let external = WebGLExternalImages::new(device, context, webrender_swap_chains);
let external = WebGLExternalImages::new(surfman, webrender_swap_chains);

WebGLThread::run_on_own_thread(init);

@@ -91,23 +90,15 @@ impl WebGLComm {

/// Bridge between the webrender::ExternalImage callbacks and the WebGLThreads.
struct WebGLExternalImages {
device: Device,
context: Context,
swap_chains: SwapChains<WebGLContextId>,
surfman: WebrenderSurfman,
swap_chains: SwapChains<WebGLContextId, Device>,
locked_front_buffers: FnvHashMap<WebGLContextId, SurfaceTexture>,
}

impl Drop for WebGLExternalImages {
fn drop(&mut self) {
let _ = self.device.destroy_context(&mut self.context);
}
}

impl WebGLExternalImages {
fn new(device: Device, context: Context, swap_chains: SwapChains<WebGLContextId>) -> Self {
fn new(surfman: WebrenderSurfman, swap_chains: SwapChains<WebGLContextId, Device>) -> Self {
Self {
device,
context,
surfman,
swap_chains,
locked_front_buffers: FnvHashMap::default(),
}
@@ -121,13 +112,10 @@ impl WebGLExternalImages {
id: front_buffer_id,
size,
..
} = self.device.surface_info(&front_buffer);
} = self.surfman.surface_info(&front_buffer);
debug!("... getting texture for surface {:?}", front_buffer_id);
let front_buffer_texture = self
.device
.create_surface_texture(&mut self.context, front_buffer)
.unwrap();
let gl_texture = front_buffer_texture.gl_texture();
let front_buffer_texture = self.surfman.create_surface_texture(front_buffer).unwrap();
let gl_texture = self.surfman.surface_texture_object(&front_buffer_texture);

self.locked_front_buffers.insert(id, front_buffer_texture);

@@ -137,8 +125,8 @@ impl WebGLExternalImages {
fn unlock_swap_chain(&mut self, id: WebGLContextId) -> Option<()> {
let locked_front_buffer = self.locked_front_buffers.remove(&id)?;
let locked_front_buffer = self
.device
.destroy_surface_texture(&mut self.context, locked_front_buffer)
.surfman
.destroy_surface_texture(locked_front_buffer)
.unwrap();

debug!("... unlocked chain {:?}", id);

0 comments on commit e465b27

Please sign in to comment.
You can’t perform that action at this time.