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

Issue 23009/separate angle and disable vsync #24525

Merged

Conversation

@glowe
Copy link

glowe commented Oct 23, 2019

The --angle and --disable-vsync options were declared as global options, but only used in the Glutin embedding for desktop builds. Moving them to the Glutin embedding code makes them easier to update in the future.

I modified opts::from_cmdline_args to accept a getopts::Options (as prescribed in the issue) and augmented opts::ArgumentParsingResult to include an opts::Matches and content-process String when appropriate. I could use some feedback on this last bit. I could have changed the function to return opts::Matches and have the embedding code look for the presence of content-process, but I felt that the approach I went with was closer to the original design.

The other aspect I'm not sure about is moving disable-vsync from a global debug option to a plain embedder option. This changes the command line interface for glutin, which is maybe bad. However I wasn't sure whether it was worth preserving the original behavior given the complexity of injecting debug options into opts::from_cmdline_args.

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes partially fix #23009 – there are 2 more options to deal with, but I'm not sure if we should handle them yet.
  • These changes do not require tests because this is a refactoring and I'm hoping that the existing tests cover these changes.

r? @jdm

@jdm jdm self-assigned this Oct 23, 2019
@jdm
Copy link
Member

jdm commented Oct 23, 2019

I like these changes, and I appreciate the care you have taken in describing your reasoning for them! I think moving the disable-vsync flag to be a non-debug option is fine in this case. I've found several other flags that are glutin-only that we can convert as well: device_pixels_per_px, clean_shutdown, use_msaa, and no_native_titlebar.

@glowe
Copy link
Author

glowe commented Oct 24, 2019

I extracted clean_shutdown, use_msaa, and no_native_titlebar. The device_pixels_per_px is a bit more difficult, because it's used in the Constellation pipeline:

self.opts.device_pixels_per_px,

@jdm
Copy link
Member

jdm commented Oct 24, 2019

We can file a followup to remove the use from constellation by passing it as an argument to the constructor instead, if you'd like.

Copy link
Member

jdm left a comment

This looks great!

ports/libmlservo/Cargo.toml Outdated Show resolved Hide resolved
@glowe
Copy link
Author

glowe commented Oct 24, 2019

We can file a followup to remove the use from constellation by passing it as an argument to the constructor instead, if you'd like.

We can definitely make that change in this PR. However, I suspect that's going to force a modification of servo::Servo::new, which would be a public interface change. If so, does that mean we need to bump the version of libservo?

@jdm
Copy link
Member

jdm commented Oct 24, 2019

libservo isn't published anywhere so we don't need to follow any semver rules.

@@ -159,6 +158,7 @@ pub fn init(
gl: Rc<dyn gl::Gl>,
waker: Box<dyn EventLoopWaker>,
callbacks: Box<dyn HostTrait>,
device_pixels_per_px: Option<f32>,

This comment has been minimized.

@jdm

jdm Oct 26, 2019

Member

This will require updating

simpleservo::init(opts, gl.gl_wrapper, wakeup, callbacks).expect("error initializing Servo");
and
simpleservo::init(opts, egl_init.gl_wrapper, wakeup, callbacks)
and
simpleservo::init(opts, gl, wakeup, callbacks).unwrap();
.

However, I just noticed

pub density: f32,
which is the value that is consulted when device_pixels_per_px is None in this code. So I think we don't actually need to add this new argument; the device_pixels_per_px value is an override that is only meaningful in the glutin port, and the other ports already have a supported API for reporting the DPI factor, so we can revert this change to the init method.

This comment has been minimized.

@glowe

glowe Oct 26, 2019

Author

Thanks for catching this. Removed.

@glowe glowe force-pushed the glowe:issue-23009/separate_angle_and_disable_vsync branch from 0e72bba to bf47d85 Oct 26, 2019
@jdm
Copy link
Member

jdm commented Oct 26, 2019

@bors-servo r+
Looks great! Thanks for tackling this work!

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2019

📌 Commit bf47d85 has been approved by jdm

@glowe
Copy link
Author

glowe commented Oct 26, 2019

Looks great! Thanks for tackling this work!

Thank you for your guidance. It was fun!

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2019

Testing commit bf47d85 with merge 0b02cd3...

bors-servo added a commit that referenced this pull request Oct 26, 2019
…sync, r=jdm

Issue 23009/separate angle and disable vsync

The `--angle` and `--disable-vsync` options were declared as global options, but only used in the Glutin embedding for desktop builds. Moving them to the Glutin embedding code makes them easier to update in the future.

I modified `opts::from_cmdline_args` to accept a `getopts::Options` (as prescribed in the issue) and augmented `opts::ArgumentParsingResult` to include an `opts::Matches` and `content-process` String when appropriate. I could use some feedback on this last bit. I could have changed the function to return `opts::Matches` and have the embedding code look for the presence of `content-process`, but I felt that the approach I went with was closer to the original design.

The other aspect I'm not sure about is moving `disable-vsync` from a global debug option to a plain embedder option. This changes the command line interface for glutin, which is maybe bad. However I wasn't sure whether it was worth preserving the original behavior given the complexity of injecting debug options into `opts::from_cmdline_args`.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes partially fix #23009 – there are 2 more options to deal with, but I'm not sure if we should handle them yet.
- [x] These changes do not require tests because this is a refactoring and I'm hoping that the existing tests cover these changes.

r? @jdm
@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2019

💔 Test failed - status-taskcluster

@glowe
Copy link
Author

glowe commented Oct 26, 2019

💔 Test failed - status-taskcluster

Looks like these errors are caused by me failing to update some things in libsimpleservo, however mach build -d built cleanly on my machine. I assume I didn't catch this issue, because mach build -d doesn't compile this crate? Is there an alternate invocation I can run that would catch these types of errors before submitting again?

@CYBAI
Copy link
Collaborator

CYBAI commented Oct 26, 2019

@glowe I guess you're using macOS? maybe it's easier to fix them and push to the PR and ask homu to try 🤔?

error[E0433]: failed to resolve: use of undeclared type or module `Options`
   --> ports/libsimpleservo/api/src/lib.rs:173:33
    |
173 |         opts::from_cmdline_args(Options::new(), &args);
    |                                 ^^^^^^^ use of undeclared type or module `Options`

error[E0061]: this function takes 3 parameters but 2 parameters were supplied
   --> ports/libsimpleservo/api/src/lib.rs:207:17
    |
207 |     let servo = Servo::new(embedder_callbacks, window_callbacks.clone());
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected 3 parameters

error: aborting due to 2 previous errors
@jdm
Copy link
Member

jdm commented Oct 26, 2019

mach build --libsimpleservo is what you're looking for.

glowe added 3 commits Oct 22, 2019
Removed opts::get() access for the two glutin specific options: angle
and disable-vsync. This is the first step in a refactoring to separate
these two options from the global options.
The angle and disable-vsync options were declared as global options but
only used in the Glutin embedding for desktop builds. Moving them to
the Glutin embedding code makes them easier to update.

Partially fixes #23009
Extracted clean-shutdown, msaa, and no-native-titlebar embedder
specific options out from the global options.

Partially fixes #23009
@glowe glowe force-pushed the glowe:issue-23009/separate_angle_and_disable_vsync branch from bf47d85 to a3f9130 Oct 26, 2019
This is also an embedder specific option, so removing it from the
global options makes sense.
@glowe glowe force-pushed the glowe:issue-23009/separate_angle_and_disable_vsync branch from ab4b53e to 0ee3004 Oct 26, 2019
@glowe
Copy link
Author

glowe commented Oct 26, 2019

Thanks for the help again. I believe I've addressed the libsimpleservo build errors.

@jdm
Copy link
Member

jdm commented Oct 26, 2019

@bors-servo r+
Thanks!

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2019

📌 Commit 0ee3004 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2019

Testing commit 0ee3004 with merge 2ad6e94...

bors-servo added a commit that referenced this pull request Oct 26, 2019
…sync, r=jdm

Issue 23009/separate angle and disable vsync

The `--angle` and `--disable-vsync` options were declared as global options, but only used in the Glutin embedding for desktop builds. Moving them to the Glutin embedding code makes them easier to update in the future.

I modified `opts::from_cmdline_args` to accept a `getopts::Options` (as prescribed in the issue) and augmented `opts::ArgumentParsingResult` to include an `opts::Matches` and `content-process` String when appropriate. I could use some feedback on this last bit. I could have changed the function to return `opts::Matches` and have the embedding code look for the presence of `content-process`, but I felt that the approach I went with was closer to the original design.

The other aspect I'm not sure about is moving `disable-vsync` from a global debug option to a plain embedder option. This changes the command line interface for glutin, which is maybe bad. However I wasn't sure whether it was worth preserving the original behavior given the complexity of injecting debug options into `opts::from_cmdline_args`.

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes partially fix #23009 – there are 2 more options to deal with, but I'm not sure if we should handle them yet.
- [x] These changes do not require tests because this is a refactoring and I'm hoping that the existing tests cover these changes.

r? @jdm
@bors-servo
Copy link
Contributor

bors-servo commented Oct 26, 2019

☀️ Test successful - linux-rel-css, linux-rel-wpt, status-taskcluster
Approved by: jdm
Pushing 2ad6e94 to master...

@bors-servo bors-servo merged commit 0ee3004 into servo:master Oct 26, 2019
2 checks passed
2 checks passed
Taskcluster (pull_request) TaskGroup: success
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.

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