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
Support building for Magic Leap. #21985
Conversation
Heads up! This PR modifies the following files:
|
It depends on servo/mozjs#158 and servo/media#158. |
Filed #21999 to get servo-media updated. |
libservo = { path = "../../components/servo" } | ||
servo-egl = "0.2" | ||
log = "0.4" | ||
smallvec = "0.6" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: let's start this in alphabetic order at least.
ports/libmlservo/src/lib.rs
Outdated
screen_avail: TypedSize2D::new(500, 500), | ||
window: (TypedSize2D::new(500, 500), TypedPoint2D::new(0, 0)), | ||
framebuffer: TypedSize2D::new(500, 500), | ||
viewport: TypedRect::new(TypedPoint2D::new(0, 0), TypedSize2D::new(500, 500)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: weird indentation.
ports/libmlservo/src/lib.rs
Outdated
fn get_coordinates(&self) -> EmbedderCoordinates { | ||
EmbedderCoordinates { | ||
hidpi_factor: TypedScale::new(1.0), | ||
screen: TypedSize2D::new(500, 500), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we move these magic numbers into constants at least?
Resource::QuirksModeCSS => &include_bytes!("../../../resources/quirks-mode.css")[..], | ||
Resource::RippyPNG => &include_bytes!("../../../resources/rippy.png")[..], | ||
Resource::DomainList => &include_bytes!("../../../resources/public_domains.txt")[..], | ||
Resource::BluetoothBlocklist => &include_bytes!("../../../resources/gatt_blocklist.txt")[..], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth adding a build script to this crate that forces a rebuild if any of these files are modified?
ports/libmlservo/src/lib.rs
Outdated
|
||
impl log::Log for MLLogger { | ||
fn enabled(&self, metadata: &log::Metadata) -> bool { | ||
metadata.level() <= log::Level::Info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe store the level in a constant so the set_max_level call earlier matches?
|
||
// The prism dimensions | ||
const glm::vec3 Servo2D::getInitialPrismExtents() const { | ||
return glm::vec3(0.5f, 0.5f, 0.5f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these relate to the 500s in libmlservo, or is that just coincidence?
lumin::ui::Cursor::SetScale(prism_, 0.03f); | ||
instanceInitialScenes(); | ||
|
||
// Get the panar resource that holds the EGL context |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panar?
EGLSurface surf = plane_->getEGLSurface(); | ||
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); | ||
eglMakeCurrent(dpy, surf, surf, ctx); | ||
glViewport(0, 0, 500, 500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to match the 500s in libmlservo? Can we pass this value in to Rust?
int main(int argc, char **argv) | ||
{ | ||
ML_LOG(Debug, "Servo2D Starting."); | ||
Servo2D myApp; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does argv contain meaningful values for us? Can we accept a URL on the command line?
EGLSurface surf = plane_->getEGLSurface(); | ||
EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); | ||
eglMakeCurrent(dpy, surf, surf, ctx); | ||
glViewport(0, 0, 500, 500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make this a named constant somewhere.
☔ The latest upstream changes (presumably #20755) made this pull request unmergeable. Please resolve the merge conflicts. |
I did some fixes, but can't test the C++ code because I'm at home rather than in the office. |
Rebased. |
Updated |
I see that you introduced a new port. Did you consider using the c api of libsimpleservo instead of libmlservo? |
@paulrouget yes, originally I was using libsimpleservo but ran into horrible linking problems which went away if I used libservo directly. My suspicion is that the ML is going to be a different enough target from Android that we're going to need a different port at some point anyway. |
libsimpleservo can be compiled without any android stuff (it compiles on Desktop for example). It's supposed to be capable of being dynamically loaded like libservo. I'd be interested to know what kind of issues you ran into. I don't want to block this, but maybe later we could look at how to re-use libsimpleservo for ML. |
It's been a while, but there was some issue about |
support/magicleap/README.md
Outdated
|
||
## Building the Servo2D application | ||
|
||
From inside the `ports/magicleap/Servo2D` directory: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/ports/support
@bors-servo delegate+ |
✌️ @asajeffrey can now approve this pull request |
@bors-servo r=jdm |
📌 Commit dab8f4a has been approved by |
Support building for Magic Leap. <!-- Please describe your changes on the following line: --> This PR gets Servo to build for Magic Leap, and provides a dummy Servo2D app. --- <!-- 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 it's a port to a new architecture <!-- 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. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21985) <!-- Reviewable:end -->
☀️ Test successful - android, android-mac, android-x86, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, status-taskcluster, windows-msvc-dev |
This PR gets Servo to build for Magic Leap, and provides a dummy Servo2D app.
./mach build -d
does not report any errors./mach test-tidy
does not report any errorsThis change is