Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webrender does not compile on Windows with feature=pathfinder #2645

Closed
fschutt opened this issue Apr 11, 2018 · 1 comment
Closed

webrender does not compile on Windows with feature=pathfinder #2645

fschutt opened this issue Apr 11, 2018 · 1 comment

Comments

@fschutt
Copy link
Contributor

@fschutt fschutt commented Apr 11, 2018

After the latest pathfinder (currently pcwalton/pathfinder@235c51e) changes have been merged, webrender does not compile on Windows anymore:

   Compiling pathfinder_gfx_utils v0.1.0 (https://github.com/pcwalton/pathfinder#235c51e1)
   Compiling plane-split v0.8.0
   Compiling lyon_geom v0.10.0
   Compiling webrender_api v0.57.2 (https://github.com/servo/webrender?rev=1ff66239b728083a37c53c98d51e070d4aae8ca0#1ff66239)
   Compiling lyon_path v0.10.0
   Compiling pathfinder_font_renderer v0.3.0 (https://github.com/pcwalton/pathfinder#235c51e1)
   Compiling pathfinder_path_utils v0.1.0 (https://github.com/pcwalton/pathfinder#235c51e1)
   Compiling pathfinder_partitioner v0.1.0 (https://github.com/pcwalton/pathfinder#235c51e1)

error[E0061]: this function takes 2 parameters but 3 parameters were supplied
   --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:579:55
    |
579 |                         match pathfinder_font_context.glyph_dimensions(&pathfinder_font_instance,
    |                                                       ^^^^^^^^^^^^^^^^ expected 2 parameters

error[E0308]: mismatched types
   --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:582:29
    |
582 |                             Ok(glyph_dimensions) => glyph_dimensions,
    |                             ^^^^^^^^^^^^^^^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
    |
    = note: expected type `std::option::Option<pathfinder_font_renderer::GlyphDimensions>`
               found type `std::result::Result<_, _>`

error[E0308]: mismatched types
   --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:583:29
    |
583 |                             Err(_) => continue,
    |                             ^^^^^^ expected enum `std::option::Option`, found enum `std::result::Result`
    |
    = note: expected type `std::option::Option<pathfinder_font_renderer::GlyphDimensions>`
               found type `std::result::Result<_, _>`

error[E0277]: the trait bound `*mut winapi::dwrite::IDWriteFactory: std::marker::Send` is not satisfied in `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`
   --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:824:22
    |
824 |         self.workers.spawn(move || {
    |                      ^^^^^ `*mut winapi::dwrite::IDWriteFactory` cannot be sent between threads safely
    |
    = help: within `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`, the trait `std::marker::Send` is not implemented for `*mut winapi::dwrite::IDWriteFactory`
    = note: required because it appears within the type `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFactory>`
    = note: required because it appears within the type `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
    = note: required because it appears within the type `std::boxed::Box<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
    = note: required because it appears within the type `glyph_rasterizer::FontContexts`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<glyph_rasterizer::FontContexts>`
    = note: required because it appears within the type `[closure@C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:824:28: 834:10 fonts_to_remove:std::vec::Vec<webrender_api::FontKey>, font_contexts:std::sync::Arc<glyph_rasterizer::FontContexts>]`

error[E0277]: the trait bound `*mut winapi::dwrite::IDWriteFontFace: std::marker::Send` is not satisfied in `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>`
   --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:824:22
    |
824 |         self.workers.spawn(move || {
    |                      ^^^^^ `*mut winapi::dwrite::IDWriteFontFace` cannot be sent between threads safely
    |
    = help: within `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>`, the trait `std::marker::Send` is not implemented for `*mut winapi::dwrite::IDWriteFontFace`
    = note: required because it appears within the type `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>`
    = note: required because of the requirements on the impl of `std::marker::Send` for `alloc::btree::node::Root<webrender_api::FontKey, pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>>`
    = note: required because it appears within the type `std::collections::BTreeMap<webrender_api::FontKey, pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>>`
    = note: required because it appears within the type `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
    = note: required because it appears within the type `std::boxed::Box<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
    = note: required because it appears within the type `glyph_rasterizer::FontContexts`
    = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<glyph_rasterizer::FontContexts>`
    = note: required because it appears within the type `[closure@C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:824:28: 834:10 fonts_to_remove:std::vec::Vec<webrender_api::FontKey>, font_contexts:std::sync::Arc<glyph_rasterizer::FontContexts>]`

error[E0599]: no method named `add_native_font` found for type `&mut pathfinder_font_renderer::FontContext<webrender_api::FontKey>` in the current scope
   --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\glyph_rasterizer.rs:870:27
    |
870 |                 drop(self.add_native_font(&font_key, NativeFontHandleWrapper(native_font_handle)))
    |                           ^^^^^^^^^^^^^^^

error[E0277]: the trait bound `*mut winapi::dwrite::IDWriteFactory: std::marker::Send` is not satisfied in `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`
    --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\renderer.rs:1633:61
     |
1633 |         thread::Builder::new().name(rb_thread_name.clone()).spawn(move || {
     |                                                             ^^^^^ `*mut winapi::dwrite::IDWriteFactory` cannot be sent between threads safely
     |
     = help: within `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`, the trait `std::marker::Send` is not implemented for `*mut winapi::dwrite::IDWriteFactory`
     = note: required because it appears within the type `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFactory>`
     = note: required because it appears within the type `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`
     = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>`
     = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
     = note: required because it appears within the type `std::boxed::Box<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
     = note: required because it appears within the type `glyph_rasterizer::FontContexts`
     = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<glyph_rasterizer::FontContexts>`
     = note: required because it appears within the type `glyph_rasterizer::GlyphRasterizer`
     = note: required because it appears within the type `[closure@C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\renderer.rs:1633:67: 1663:10 rb_thread_name:std::string::String, thread_listener_for_render_backend:std::sync::Arc<std::option::Option<std::boxed::Box<renderer::ThreadListener + std::marker::Send + std::marker::Sync>>>, max_device_size:u32, glyph_rasterizer:glyph_rasterizer::GlyphRasterizer, blob_image_renderer:std::option::Option<std::boxed::Box<webrender_api::BlobImageRenderer>>, api_rx:webrender_api::channel::MsgReceiver<webrender_api::ApiMsg>, payload_rx_for_backend:std::sync::mpsc::Receiver<webrender_api::channel::Payload>, result_tx:std::sync::mpsc::Sender<internal_types::ResultMsg>, scene_tx:std::sync::mpsc::Sender<scene_builder::SceneBuilderRequest>, scene_rx:std::sync::mpsc::Receiver<scene_builder::SceneBuilderResult>, device_pixel_ratio:f32, backend_notifier:std::boxed::Box<webrender_api::RenderNotifier>, config:frame_builder::FrameBuilderConfig, recorder:std::option::Option<std::boxed::Box<record::ApiRecordingReceiver>>, enable_render_on_scroll:bool, backend_profile_counters:profiler::BackendProfileCounters]`

error[E0277]: the trait bound `*mut winapi::dwrite::IDWriteFontFace: std::marker::Send` is not satisfied in `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>`
    --> C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\renderer.rs:1633:61
     |
1633 |         thread::Builder::new().name(rb_thread_name.clone()).spawn(move || {
     |                                                             ^^^^^ `*mut winapi::dwrite::IDWriteFontFace` cannot be sent between threads safely
     |
     = help: within `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>`, the trait `std::marker::Send` is not implemented for `*mut winapi::dwrite::IDWriteFontFace`
     = note: required because it appears within the type `pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>`
     = note: required because of the requirements on the impl of `std::marker::Send` for `alloc::btree::node::Root<webrender_api::FontKey, pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>>`
     = note: required because it appears within the type `std::collections::BTreeMap<webrender_api::FontKey, pathfinder_font_renderer::directwrite::com::PathfinderComPtr<winapi::dwrite::IDWriteFontFace>>`
     = note: required because it appears within the type `pathfinder_font_renderer::FontContext<webrender_api::FontKey>`
     = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>`
     = note: required because of the requirements on the impl of `std::marker::Send` for `std::ptr::Unique<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
     = note: required because it appears within the type `std::boxed::Box<std::sync::Mutex<pathfinder_font_renderer::FontContext<webrender_api::FontKey>>>`
     = note: required because it appears within the type `glyph_rasterizer::FontContexts`
     = note: required because of the requirements on the impl of `std::marker::Send` for `std::sync::Arc<glyph_rasterizer::FontContexts>`
     = note: required because it appears within the type `glyph_rasterizer::GlyphRasterizer`
     = note: required because it appears within the type `[closure@C:\Users\Felix Schütt\.cargo\git\checkouts\webrender-c3596abe1cf4f320\1ff6623\webrender\src\renderer.rs:1633:67: 1663:10 rb_thread_name:std::string::String, thread_listener_for_render_backend:std::sync::Arc<std::option::Option<std::boxed::Box<renderer::ThreadListener + std::marker::Send + std::marker::Sync>>>, max_device_size:u32, glyph_rasterizer:glyph_rasterizer::GlyphRasterizer, blob_image_renderer:std::option::Option<std::boxed::Box<webrender_api::BlobImageRenderer>>, api_rx:webrender_api::channel::MsgReceiver<webrender_api::ApiMsg>, payload_rx_for_backend:std::sync::mpsc::Receiver<webrender_api::channel::Payload>, result_tx:std::sync::mpsc::Sender<internal_types::ResultMsg>, scene_tx:std::sync::mpsc::Sender<scene_builder::SceneBuilderRequest>, scene_rx:std::sync::mpsc::Receiver<scene_builder::SceneBuilderResult>, device_pixel_ratio:f32, backend_notifier:std::boxed::Box<webrender_api::RenderNotifier>, config:frame_builder::FrameBuilderConfig, recorder:std::option::Option<std::boxed::Box<record::ApiRecordingReceiver>>, enable_render_on_scroll:bool, backend_profile_counters:profiler::BackendProfileCounters]`

error: aborting due to 8 previous errors

error: Could not compile `webrender`.

To learn more, run the command again with --verbose.

Replicate with (on nightly-x86_64-pc-windows-msvc unchanged - rustc 1.27.0-nightly (0b72d48f8 2018-04-10)`:

cargo build --no-default-features --features="pathfinder"

Now, the problem of this is that, while pathfinder compiles fine, the corresponding webrender code didn't get adjusted to the new changes: For example, the glyph_dimensions function indeed takes 2 arguments now and returns an Option, but the corresponding webrender code for Windows uses 3 arguments and matches on a Result. I am not sure which version is the correct one (I think it's the one with the 2 arguments).

Please add pathfinder to Taskcluster, appveyor and Travis, so that this doesn't happen again.

@fschutt
Copy link
Contributor Author

@fschutt fschutt commented Apr 28, 2018

After #2705 is merged, there are still 4 build errors remaining because we can't share a raw pointer to IDWriteFactory and IDWriteFontFace across threads. But I think these errors have to be resolved in the pathfinder crate, not webrender.

bors-servo added a commit that referenced this issue May 1, 2018
Fix From conversion from NativeFontHandleWrapper to PathfinderComPtr

See https://github.com/pcwalton/pathfinder/pull/81 and #2645 - this fixes 1 compile error, where we can't convert from a NativeFontHandleWrapper to a ComPtr. We need this, so that PathfinderFontContext::add_native_font() works correctly.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2705)
<!-- Reviewable:end -->
bors-servo added a commit that referenced this issue May 8, 2018
…=kvark

Final compile fixes for pathfinder

Closes #2645.

Note: On Windows, pathfinder won't yet run properly, partly due to https://github.com/pcwalton/pathfinder/pull/82 and partly due to some `RenderTask`-related bugs (currently it crashes with "unexpected render task: glyph task") in ` webrender::render_task::RenderTask::uv_rect_kind`.

However, pathfinder now at least compiles on Windows, Linux and Mac. Also added various `#[derive(Debug)]` necessary for debugging the pathfinder crashes.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/2723)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.