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 initial support for OpenHarmony #293

Merged
merged 6 commits into from
May 29, 2024
Merged

Conversation

jschwe
Copy link
Member

@jschwe jschwe commented May 24, 2024

Follow-up PR to #285.

Todo:

  • Is platform/egl really the best name for the shared code?
  • It would be great if someone else could test the changes on android - I couldn't get the servo android build to work on my personal machine (unrelated to these changes)

@mrobinson
Copy link
Member

This is looking great. I tested the Android build locally and it compiled. I didn't test it in an emulator.

I suppose this is just blocked on a new raw-window-handle release now.

@jschwe jschwe force-pushed the jschwender/ohosv3 branch from f4b4b2d to 4ea8df7 Compare May 28, 2024 13:31
@jschwe
Copy link
Member Author

jschwe commented May 28, 2024

I suppose this is just blocked on a new raw-window-handle release now.

Ah, actually raw-window-handle 0.6.2. is already released, I just forgot to update this PR after the release.
I adjusted the PR to use rwh 0.6.2 and added the missing code for ohos.

@jschwe jschwe marked this pull request as ready for review May 28, 2024 13:53
Copy link
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

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

Just a couple small comments:

@@ -0,0 +1,87 @@
// surfman/surfman/src/platform/egl/android_surface.rs
Copy link
Member

Choose a reason for hiding this comment

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

I think this file name is incorrect now. To be honest, I'm not sure why the file name is included at the top of these files. It seems redundant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I was also wondering about this, but assumed that perhaps there was some kind of tooling I don't know about, which requires these comments.

I will fix the name here, but if there is no reason for these comments (anymore), then I'd also be happy to open a PR that removes all of the filenames at the top.

Comment on lines 74 to 77
// Safety: `OH_NativeWindow_NativeWindowHandleOpt` takes two output i32 pointers as
// variable arguments when called with `GET_BUFFER_GEOMETRY`. See the OHNativeWindow
// documentation for details:
// https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-arkgraphics2d/_native_window.md
Copy link
Member

Choose a reason for hiding this comment

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

Perhaps this should move to a rustdoc safety section?

Copy link
Member Author

@jschwe jschwe May 28, 2024

Choose a reason for hiding this comment

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

This comment is intended for reviewers of the unsafe block, since OH_NativeWindow_NativeWindowHandleOpt takes different arguments depending on the value of second parameter, and thus needs to be manually cross-referenced with the documentation during review.
Callers of this function don't need to know about OH_NativeWindow_NativeWindowHandleOpt.

To be honest I'm not really sure what the Safety preconditions of create_window_surface() should be (and if it needs to be unsafe). But I'm pretty sure the Safety preconditions should be the same as the android version (which isn't documented either, though)

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a Safety section to the rustdoc of the function declaration in ohos_ffi.rs

Copy link
Member

Choose a reason for hiding this comment

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

I agree with your original statement and IMO the original placement isn't an issue. I've just seen that clippy often complains if an unsafe function does not have a "# Safety" section. It just seems that since you have already gone through the trouble of writing a nice comment here, we can use it to make clippy happy as well. :D

@mrobinson mrobinson enabled auto-merge May 28, 2024 19:55
@mrobinson mrobinson disabled auto-merge May 28, 2024 19:55
@mrobinson
Copy link
Member

Is this still a draft or is it okay to merge this?

@jschwe jschwe changed the title Draft: Add initial support for OpenHarmony Add initial support for OpenHarmony May 29, 2024
@jschwe
Copy link
Member Author

jschwe commented May 29, 2024

It's okay to merge from my side. Should I squash the review changes into the second commit, or will you squash everything into one commit anyway?

@mrobinson
Copy link
Member

The merge queue automatically squashes commits, so it shouldn't be an issue. Thanks!

@mrobinson mrobinson added this pull request to the merge queue May 29, 2024
Merged via the queue into servo:main with commit 1a522fa May 29, 2024
17 checks passed
@jschwe jschwe deleted the jschwender/ohosv3 branch June 12, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants