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

Final compile fixes for pathfinder #2723

Merged
merged 7 commits into from May 8, 2018
Merged

Final compile fixes for pathfinder #2723

merged 7 commits into from May 8, 2018

Conversation

@fschutt
Copy link
Contributor

fschutt commented May 3, 2018

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.


This change is Reviewable

fschutt added 2 commits May 3, 2018
…r" compile errors on Windows

Fixes #2645. PathfinderFontContext can contain a raw *mut IDWriteFactory (on Windows).
However, since we know that it is wrapped in a Mutex here, it is safe to assume that
the struct is thread-safe.

PathfinderComPtr::new is an unsafe function, so we have to wrap it in an unsafe block.
@glennw
Copy link
Member

glennw commented May 3, 2018

@kvark
Copy link
Member

kvark commented May 3, 2018

Can we have that path tested on CI?

@fschutt
Copy link
Contributor Author

fschutt commented May 3, 2018

Yes although, as I said, it will crash at runtime. Compilation tests should work, though.

@fschutt
Copy link
Contributor Author

fschutt commented May 3, 2018

@kvark Would it be enough to do only appveyor + taskcluster? Linux + macOS would already be tested on taskcluster, so no need for travis to re-check for that...

Verify that the patfinder feature compiles on Windows,
Mac and Linux
@kvark
Copy link
Member

kvark commented May 3, 2018

@fschutt I think we should keep Travis is sync with TaskCluster in what it's building for as long as Travis is useful, to avoid confusion at least.

use std::ops::Deref;
use tiling::RenderTargetKind;
use webrender_api::{DeviceIntPoint, DevicePixel};
} else if #[cfg(not(feature = "pathfinder"))] {

This comment has been minimized.

@kvark

kvark May 3, 2018

Member

does this need if after else?

use tiling::SpecialRenderPasses;
#[cfg(feature = "pathfinder")]
use webrender_api::{DeviceIntPoint, DevicePixel};
cfg_if! {

This comment has been minimized.

@kvark

kvark May 3, 2018

Member

The amount of diversion between the pathfinder and whatnot features of this module is pretty high. We should consider splitting those into separate modules, potentially leaving something shared in another module. This would be cleaner than multiple #[cfg(feature = "pathfinder")] spread over the code.

This comment has been minimized.

@fschutt

fschutt May 3, 2018

Author Contributor

Yeah ok, but this is going to take a while to split up the files and resolve all the errors. I'll do two seperate files for the pathfinder and the no_pathfinder configuration.

This comment has been minimized.

@fschutt

fschutt May 3, 2018

Author Contributor

btw, is there any difference between use api:: and use webrender_api:: or are they the same?

This comment has been minimized.

@kvark

kvark May 3, 2018

Member

No, this is because of this line in "lib.rs": pub use webrender_api as api;
I'd much prefer us just doing pub extern crate webrender_api as api; in the first place, without any ambiguity.

This comment has been minimized.

@fschutt

fschutt May 3, 2018

Author Contributor

But, are you ok with the rest of the changes? If I push the refactored glyph_rasterizer module, this will create a huge commit, so I'd prefer a review before I split up the module. Semanticall it'll all be the same, just the PR will be larger.

This comment has been minimized.

@kvark

kvark May 3, 2018

Member

Yes, although TaskCluster CI is not ok :)

@kvark
kvark approved these changes May 3, 2018
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

//! Module only available when pathfinder is activated

This comment has been minimized.

@pcwalton

pcwalton May 4, 2018

Collaborator

How about just naming this pathfinder.rs? It's shorter :)

This commit doesn't change any semantics, but it exposes the files
`glyph_rasterizer_ext_no_pathfinder` (containing only the items
previously marked with cfg(not(feature = "pathfinder")) and the
`glyph_rasterizer_pathfinder`, which has all previous
cfg(feature = "pathfinder") items.

The public / private visibilities of the structs are the same as before.
@fschutt
Copy link
Contributor Author

fschutt commented May 4, 2018

@kvark @pcwalton All done, tests passed. Ready to merge.

@kvark
Copy link
Member

kvark commented May 4, 2018

Reviewed 2 of 4 files at r1, 3 of 3 files at r2, 2 of 3 files at r3, 1 of 6 files at r4, 3 of 6 files at r5.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


appveyor.yml, line 23 at r5 (raw file):

  - cd ../webrender
  - cargo test --verbose
  - cargo build --verbose --no-default-features --features pathfinder

somewhat less relevant, I wonder if we can use cargo check instead of cargo build on CI to speed it up a bit


webrender/src/glyph_rasterizer/no_pathfinder.rs, line 24 at r5 (raw file):

use std::collections::hash_map::Entry;

pub(in super) fn create_pathfinder_font_context() -> Result<(), ResourceCacheError> {

why do we need pathfinder-related methods in this module at all?


Comments from Reviewable

@fschutt
Copy link
Contributor Author

fschutt commented May 5, 2018

Review status: all files reviewed at latest revision, 5 unresolved discussions.


appveyor.yml, line 23 at r5 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

somewhat less relevant, I wonder if we can use cargo check instead of cargo build on CI to speed it up a bit

I think we can change from "cargo build" to "cargo check" whenever we are not doing anything with the final binary. I.e. we just see if it compiles, then throw the binary away. I am not aware of checks where you have to compile the crate in order to verify that it compiles. I'll change it for all of the CI.


webrender/src/glyph_rasterizer/no_pathfinder.rs, line 24 at r5 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

why do we need pathfinder-related methods in this module at all?

The FontContexts struct currently contains a pathfinder_context field, although that is unused on non-pathfinder builds. I'll change that, thanks.


Comments from Reviewable

@fschutt
Copy link
Contributor Author

fschutt commented May 7, 2018

@kvark Just notifying you that the issues are fixed now. I changed cargo build to cargo check and removed the pathfinder-related functions from the no_pathfinder module.

@kvark
Copy link
Member

kvark commented May 7, 2018

Looks like we are almost there!


Reviewed 5 of 6 files at r6.
Review status: all files reviewed at latest revision, 3 unresolved discussions.


webrender/src/glyph_rasterizer/mod.rs, line 355 at r6 (raw file):

                worker_contexts: contexts,
                shared_context: Mutex::new(shared_context),
                pathfinder_context: create_pathfinder_font_context()?,

let's put the cfg on those extra fields as opposed to the whole structure initialization


Comments from Reviewable

This now uses compile-time flags instead of an empty `()` field
for the pathfinder_context.
@fschutt
Copy link
Contributor Author

fschutt commented May 8, 2018

Review status: 10 of 11 files reviewed at latest revision, 4 unresolved discussions.


webrender/src/glyph_rasterizer.rs, line 47 at r3 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

does this need if after else?

Done.


webrender/src/glyph_rasterizer/mod.rs, line 355 at r6 (raw file):

Previously, kvark (Dzmitry Malyshau) wrote…

let's put the cfg on those extra fields as opposed to the whole structure initialization

Done.


Comments from Reviewable

@kvark
Copy link
Member

kvark commented May 8, 2018

Reviewed 1 of 1 files at r7.
Review status: all files reviewed at latest revision, 2 unresolved discussions.


Comments from Reviewable

@kvark
Copy link
Member

kvark commented May 8, 2018

As this is just moving things around, I don't expect any reftest failures, but we'll stay on guard.
Thank you for pushing this to the end!
@bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented May 8, 2018

📌 Commit f06f503 has been approved by kvark

@bors-servo
Copy link
Contributor

bors-servo commented May 8, 2018

Testing commit f06f503 with merge 1eb46da...

bors-servo added a commit that referenced this pull request 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 -->
@bors-servo
Copy link
Contributor

bors-servo commented May 8, 2018

☀️ Test successful - status-appveyor, status-taskcluster
Approved by: kvark
Pushing 1eb46da to master...

@bors-servo bors-servo merged commit f06f503 into servo:master May 8, 2018
3 of 4 checks passed
3 of 4 checks passed
code-review/reviewable 2 discussions left (fschutt, kvark, pcwalton)
Details
Taskcluster (pull_request) TaskGroup: success
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
homu Test successful
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

5 participants
You can’t perform that action at this time.