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

Add WebRender integration to Servo. #9589

Merged
merged 1 commit into from Feb 18, 2016
Merged

Conversation

glennw
Copy link
Member

@glennw glennw commented Feb 10, 2016

WebRender is an experimental GPU accelerated rendering backend for Servo.

The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).

WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!

Review on Reviewable

@highfive
Copy link

Heads up! This PR modifies the following files:

  • @ecoal95: components/script/dom/webglrenderingcontext.rs

@highfive
Copy link

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@glennw
Copy link
Member Author

glennw commented Feb 10, 2016

Since this is such a large patch, if anyone can take a look at their areas and do partial reviews, that would be great!

@emilio
Copy link
Member

emilio commented Feb 10, 2016

Awesome work!

Reviewed everything (except the glsl files) and I couldn't spot anything that looked wrong or deserved a change... Not an expert in every part of the codebase this patch touches though.

Left a few notes for myself and for the curious regarding the moved WebGL code.


Review status: 0 of 76 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed.


components/canvas/webgl_paint_thread.rs, line 182 [r1] (raw file):
If someone's curious, all this logic is moved to webrender_traits in order to be shared with the webrender WebGL backend, which is different from Servo's.


components/canvas_traits/lib.rs, line 43 [r1] (raw file):
Just as a note to self when this merges: An E-Easy should be filled as a follow-up to remove this re-export(s), which were done to avoid extra rebase pain.


Comments from the review on Reviewable.io

@pcwalton
Copy link
Contributor

Should I review parts of this or am I too close to being the author for that?

@jgraham
Copy link
Contributor

jgraham commented Feb 10, 2016

I don't know if it's needed, but note that wptrunner supports switching the expected results of tests based on the render backend, so if we plan to run webrender in CI we should check in metadata updates and not disable tests.

{
vColorTexCoord = aColorTexCoordRectTop.xy;
vMaskTexCoord = aMaskTexCoordRectTop.xy;
gl_Position = uTransform * vec4(aPosition, 1.0);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The alignment is broken in this line

@jdm
Copy link
Member

jdm commented Feb 10, 2016

   Compiling gfx_tests v0.0.1 (file:///home/travis/build/servo/servo/components/servo)

/home/travis/build/servo/servo/tests/unit/gfx/font_cache_thread.rs:14:27: 14:57 error: this function takes 2 parameters but 1 parameter was supplied [E0061]

/home/travis/build/servo/servo/tests/unit/gfx/font_cache_thread.rs:14   let font_cache_thread = FontCacheThread::new(inp_chan);

                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

/home/travis/build/servo/servo/tests/unit/gfx/font_cache_thread.rs:14:27: 14:57 help: run `rustc --explain E0061` to see a detailed explanation

error: aborting due to previous error

Build failed, waiting for other jobs to finish...

Could not compile `gfx_tests`.

@steveklabnik
Copy link
Contributor

Builds on my machine, seems to work just fine 👍

There's a lot of strange indentation in the GSL files, not sure if that's on purpose or not.

@glennw
Copy link
Member Author

glennw commented Feb 10, 2016

Fixed up the unit tests and the notes about the shaders.

@glennw
Copy link
Member Author

glennw commented Feb 10, 2016

@jgraham Great! Are there any docs / examples on how I should set up the files to have different expectations?

@jgraham
Copy link
Contributor

jgraham commented Feb 10, 2016

You can use backend == "cpu" or backend == "webrender" in the expectation files in the same way you can use e.g. os == "mac". If you create a log file from a non-webrender run and a log file from a webrender run then use mach update-wpt default.log webrender.log then it will add the necessary conditions for any tests with different results.

@@ -976,6 +985,7 @@ pub enum DisplayItem {
StackingContextClass(Arc<StackingContext>),
LayeredItemClass(Box<LayeredItem>),
NoopClass(Box<BaseDisplayItem>),
IframeClass(Box<IframeDisplayItem>),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels like NoopClass could simply be removed in favor of the new IframeClass. NoopClass exits just as a placeholder so that iframes can hold a place in the display list without drawing anything.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrobinson Sounds good - is it fine to this as a follow up once this PR lands do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@glennw Yeah, I think it would be fine to do in a separate patch.

@emilio
Copy link
Member

emilio commented Feb 11, 2016

Review status: 0 of 77 files reviewed at latest revision, 7 unresolved discussions.


components/gfx/font_cache_thread.rs, line 300 [r4] (raw file):
This could probably use or_insert_with. Something like:

let font_key = self.webrender_api.as_ref().map(|webrender_api| {
    self.webrender_fonts.entry(template.identifier.clone()).or_insert_with(|| {
        match (template.bytes_if_in_memory(), template.native_font()) {
            (Some(bytes), _) => webrender_api.add_raw_font(bytes),
            (None, Some(native_font)) => webrender_api.add_native_font(native_font),
            (None, None) => webrender_api.add_raw_font(template.bytes().clone()),
        }
    })
});

Comments from the review on Reviewable.io

@mbrubeck
Copy link
Contributor

Reviewed 3 of 76 files at r1.
Review status: 3 of 77 files reviewed at latest revision, 8 unresolved discussions.


components/compositing/compositor.rs, line 1422 [r4] (raw file):
Should have a TODO comment and/or follow-up issue to implement zooming.


Comments from the review on Reviewable.io

@mbrubeck
Copy link
Contributor

Reviewed 7 of 76 files at r1, 1 of 1 files at r2.
Review status: 11 of 77 files reviewed at latest revision, 9 unresolved discussions.


tests/wpt/harness/wptrunner/browsers/servo.py, line 61 [r4] (raw file):
This will also need to be upstreamed.


Comments from the review on Reviewable.io

@mbrubeck
Copy link
Contributor

Reviewed 4 of 76 files at r1.
Review status: 15 of 77 files reviewed at latest revision, 11 unresolved discussions.


components/util/Cargo.toml, line 29 [r4] (raw file):
This appears to be unused.


components/util/lib.rs, line 49 [r4] (raw file):
This looks unused.


Comments from the review on Reviewable.io

@bors-servo
Copy link
Contributor

The latest upstream changes (presumably #9622) made this pull request unmergeable. Please resolve the merge conflicts.

fn initialize_png(width: usize, height: usize) -> (Vec<gl::GLuint>, Vec<gl::GLuint>) {
fn initialize_png(width: usize, height: usize) -> (Vec<gl::GLuint>,
Vec<gl::GLuint>,
Vec<gl::GLuint>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we change the return value of this to be a struct?

WebRender is an experimental GPU accelerated rendering backend for Servo.

The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).

WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!
@glennw
Copy link
Member Author

glennw commented Feb 18, 2016

Fixed the android build failure in WR, and updated the cargo.lock files.

@glennw
Copy link
Member Author

glennw commented Feb 18, 2016

r=pcwalton

@glennw
Copy link
Member Author

glennw commented Feb 18, 2016

@bors-servo r=pcwalton

@bors-servo
Copy link
Contributor

📌 Commit c0531c3 has been approved by pcwalton

@bors-servo
Copy link
Contributor

Testing commit c0531c3 with merge 3640b82...

bors-servo pushed a commit that referenced this pull request Feb 18, 2016
Add WebRender integration to Servo.

WebRender is an experimental GPU accelerated rendering backend for Servo.

The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).

WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9589)
<!-- Reviewable:end -->
@samlh
Copy link
Contributor

samlh commented Feb 18, 2016

PASS [expected FAIL] /css21_dev/html4/floats-wrap-bfc-002-right-table.htm

PASS [expected FAIL] /css21_dev/html4/position-relative-035.htm

@bors-servo
Copy link
Contributor

💔 Test failed - mac-rel-css

@KiChjang
Copy link
Member

Ran 9335 tests finished in 1478.0 seconds.
  • 9333 ran as expected. 58 tests skipped.
  • 2 tests passed unexpectedly

Tests with unexpected results:
  ▶ PASS [expected FAIL] /css-transforms-1_dev/html/transform-input-017.htm

  ▶ PASS [expected FAIL] /css-transforms-1_dev/html/transform-input-018.htm

Looking really good!

@jdm
Copy link
Member

jdm commented Feb 18, 2016

Those are the same tests that are being reported as unexpected passes in #9668. What's going on here?

@glennw
Copy link
Member Author

glennw commented Feb 18, 2016

@jdm This patch includes the commit in #9668 - I was trying to upstream that individually before this patch got reviewed.

@glennw
Copy link
Member Author

glennw commented Feb 18, 2016

@bors-servo
Copy link
Contributor

Testing commit c0531c3 with merge ab07b06...

bors-servo pushed a commit that referenced this pull request Feb 18, 2016
Add WebRender integration to Servo.

WebRender is an experimental GPU accelerated rendering backend for Servo.

The WebRender backend can be specified by running Servo with the -w option (otherwise the default rendering backend will be used).

WebRender has many bugs, and missing features - but it is usable to browse most websites - please report any WebRender specific rendering bugs you encounter!

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9589)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

☀️ Test successful - android, gonk, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet