Skip to content

HarmonyOS/OpenHarmony Port #13152

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

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open

Conversation

Jack253-png
Copy link

Description

SDL support for harmonyos

Existing Issue(s)

#9837

@Jack253-png
Copy link
Author

@slouken Request for review

@Jack253-png
Copy link
Author

@madebr @sezero Request for review

@madebr
Copy link
Contributor

madebr commented May 31, 2025

Can you please rebase on top of current master and remove all commits which you did not author?

git fetch https://github.com/libsdl-org/SDL main
git rebase -i FETCH_HEAD
<remove all commits which you did not author. In vim, "dd" removes the current line, "<ESC>:wq" saves and exits)>
git push [email protected]:Jack253-png/SDL HEAD:OpenMinecraft-Dev -f

@madebr
Copy link
Contributor

madebr commented May 31, 2025

Seeing you implemented vulkan support, does SDL_gpu work? Do the SDL_gpu_examples work?

@Jack253-png
Copy link
Author

Seeing you implemented vulkan support, does SDL_gpu work? Do the SDL_gpu_examples work?

I will test later, because I don't have test platform, I need to find other people to do this.

@Jack253-png
Copy link
Author

Do the testautomation tests pass for this platform?

Sorry, for now the official emulator only supports opengles2, so the vulkan/gles3 test cases couldn't pass

@slouken
Copy link
Collaborator

slouken commented Jul 16, 2025

Can you enable tests in CI, so we can see what's passing?

@Jack253-png
Copy link
Author

Can you enable tests in CI, so we can see what's passing?

Unfortunately, it's hard to download emulator in CI (it's terrible internet speed), The opengles2 demo is included, but it's hard for you and other developers outside China to build it.

@Jack253-png
Copy link
Author

Can you enable tests in CI, so we can see what's passing?

It just crashes with vulkan error -6, it must be tested through the real Huawei phones or tablets

@madebr
Copy link
Contributor

madebr commented Jul 16, 2025

It just crashes with vulkan error -6, it must be tested through the real Huawei phones or tablets

Do you intend to test it on hardware soon?
A simulator is only as good as its model.
Some assurance that SDL3 behaves correctly on the real thing would be nice. (Imho, it is essential)

@Jack253-png
Copy link
Author

It just crashes with vulkan error -6, it must be tested through the real Huawei phones or tablets

Do you intend to test it on hardware soon?
A simulator is only as good as its model.
Some assurance that SDL3 behaves correctly on the real thing would be nice. (Imho, it is essential)

But I don't have any real machines, it's sooooooo expensive

@slouken
Copy link
Collaborator

slouken commented Jul 16, 2025

Is there anyone with a real Huawei device that can work with you to run tests and validate functionality?

@Jack253-png
Copy link
Author

Is there anyone with a real Huawei device that can work with you to run tests and validate functionality?

No, but harmonyos has its strange non-standard apis, the tests may likely fail. Although I have tested opengles2 through a simple triangle demo, the renderer still refused to work because of shader compilation issues. I can't solve the problem by myself.
I planned to port the rest subsystems (locale, audio, sensor, joystick), is there any possibility to create a dev branch on the repo?

@slouken
Copy link
Collaborator

slouken commented Jul 16, 2025

If you’re still early in development, you can continue to work in this branch until you’re ready. Just mark it draft and feel free to continue iterating.

@madebr
Copy link
Contributor

madebr commented Jul 16, 2025

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

@Jack253-png
Copy link
Author

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

@Jack253-png
Copy link
Author

But the OpenHarmony is hard to compile, this CI testing maybe impossible if Huawei official developers doesn't notice this library

@BA489
Copy link

BA489 commented Jul 17, 2025

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

There is an OpenHarmony-based emulator for global developers in English from European derivative called Oniro that works with QEMU environment, you can check it out: https://docs.oniroproject.org/device-development/developer-boards/emulator/

@BA489
Copy link

BA489 commented Jul 17, 2025

But the OpenHarmony is hard to compile, this CI testing maybe impossible if Huawei official developers doesn't notice this library

Don't worry I already communicated this with Huawei engineers via Oniro matrix channel

@Jack253-png
Copy link
Author

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

There is an OpenHarmony-based emulator for global developers in English from European derivative called Oniro that works with QEMU environment, you can check it out: https://docs.oniroproject.org/device-development/developer-boards/emulator/

Or you can try the current wrapper app, I wrote a opengles2 triangle demo, you could run it

@BA489
Copy link

BA489 commented Jul 17, 2025

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

There is an OpenHarmony-based emulator for global developers in English from European derivative called Oniro that works with QEMU environment, you can check it out: https://docs.oniroproject.org/device-development/developer-boards/emulator/

Or you can try the current wrapper app, I wrote a opengles2 triangle demo, you could run it

perfect! I will test it and keep you updated on it. I want to make sure if you wrote it within SDL or SDL ohos shell itself so I can test it on DevEco Studio with the QEMU Oniro emulator?
https://github.com/OpenMinecraft-Dev/SDL
https://github.com/[OpenMinecraft-Dev/sdl-ohos-shell](https://github.com/OpenMinecraft-Dev/sdl-ohos-shell)

@bipinnatus2k
Copy link

Huawei offers a cloud debugging service for Chinese developers with a free daily quota of 300 minutes, you can refer to this document to test it on a real machine.
https://developer.huawei.com/consumer/cn/doc/app/agc-help-clouddebug-0000002235870046
If you encounter any problems, you can ask Huawei engineers by submitting a work order:
https://developer.huawei.com/consumer/cn/support/feedback/#/ticketCard

@Jack253-png
Copy link
Author

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

There is an OpenHarmony-based emulator for global developers in English from European derivative called Oniro that works with QEMU environment, you can check it out: https://docs.oniroproject.org/device-development/developer-boards/emulator/

Or you can try the current wrapper app, I wrote a opengles2 triangle demo, you could run it

perfect! I will test it and keep you updated on it. I want to make sure if you wrote it within SDL or SDL ohos shell itself so I can test it on DevEco Studio with the QEMU Oniro emulator?
https://github.com/OpenMinecraft-Dev/SDL
https://github.com/[OpenMinecraft-Dev/sdl-ohos-shell](https://github.com/OpenMinecraft-Dev/sdl-ohos-shell)

I have already synced it. You can run the one in the SDL repo directly

@BA489
Copy link

BA489 commented Jul 19, 2025

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

There is an OpenHarmony-based emulator for global developers in English from European derivative called Oniro that works with QEMU environment, you can check it out: https://docs.oniroproject.org/device-development/developer-boards/emulator/

Or you can try the current wrapper app, I wrote a opengles2 triangle demo, you could run it

perfect! I will test it and keep you updated on it. I want to make sure if you wrote it within SDL or SDL ohos shell itself so I can test it on DevEco Studio with the QEMU Oniro emulator?
https://github.com/OpenMinecraft-Dev/SDL
[https://github.com/OpenMinecraft-Dev/sdl-ohos-shell](https://github.com/%5BOpenMinecraft-Dev/sdl-ohos-shell%5D(https://github.com/OpenMinecraft-Dev/sdl-ohos-shell))

I have already synced it. You can run the one in the SDL repo directly

ah great!

@BA489
Copy link

BA489 commented Jul 19, 2025

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

There is an OpenHarmony-based emulator for global developers in English from European derivative called Oniro that works with QEMU environment, you can check it out: https://docs.oniroproject.org/device-development/developer-boards/emulator/

Or you can try the current wrapper app, I wrote a opengles2 triangle demo, you could run it

perfect! I will test it and keep you updated on it. I want to make sure if you wrote it within SDL or SDL ohos shell itself so I can test it on DevEco Studio with the QEMU Oniro emulator?
https://github.com/OpenMinecraft-Dev/SDL
[https://github.com/OpenMinecraft-Dev/sdl-ohos-shell](https://github.com/%5BOpenMinecraft-Dev/sdl-ohos-shell%5D(https://github.com/OpenMinecraft-Dev/sdl-ohos-shell))

I have already synced it. You can run the one in the SDL repo directly

I done it! Tested it and it runs successfully without any code/runtime errors
Official SDL graphics library port on HarmonyOS/OpenHarmony work I think based on opengles2 triangle demo.
I downgraded the project to test on API 12 5.0.0
Due to the emulator I have on my machine being HarmonyOS 5.0.0/NEXT API 12 & earlier, pre-API 13 era
https://github.com/user-attachments/assets/83cd5f3c-2593-4941-b734-4b91cc726123

@Jack253-png
Copy link
Author

I noticed you added a x86-64 OpenHarmony ci job. Perhaps it is possible to run it on ordinary Intel/AMD hardware?

The official emulator on Windows is x86-64, but the emulator is impossible to embed into the CI testing, it requires a China Huawei account, perhaps I need to find an OpenHarmony emulator for testing. HarmonyOS and OpenHarmony is just like Google Android and AOSP

There is an OpenHarmony-based emulator for global developers in English from European derivative called Oniro that works with QEMU environment, you can check it out: https://docs.oniroproject.org/device-development/developer-boards/emulator/

Or you can try the current wrapper app, I wrote a opengles2 triangle demo, you could run it

perfect! I will test it and keep you updated on it. I want to make sure if you wrote it within SDL or SDL ohos shell itself so I can test it on DevEco Studio with the QEMU Oniro emulator?
https://github.com/OpenMinecraft-Dev/SDL
[https://github.com/OpenMinecraft-Dev/sdl-ohos-shell](https://github.com/%5BOpenMinecraft-Dev/sdl-ohos-shell%5D(https://github.com/OpenMinecraft-Dev/sdl-ohos-shell))

I have already synced it. You can run the one in the SDL repo directly

I done it! Tested it and it runs successfully without any code/runtime errors
Official SDL graphics library port on HarmonyOS/OpenHarmony work I think
downgraded it to test on API 12 5.0.0
Due to the emulator I have on my machine being HarmonyOS 5.0.0/NEXT API 12 & earlier, pre-API 13 era
https://github.com/user-attachments/assets/83cd5f3c-2593-4941-b734-4b91cc726123

You could try to port the audio subsystem, I am not familiar with it

@BA489
Copy link

BA489 commented Jul 19, 2025

based on opengles2 triangle demo

oh ok, I will research on hooking the audio subsystem of OpenHarmony/HarmonyOS with SDL and test it

@Jack253-png
Copy link
Author

based on opengles2 triangle demo

oh ok, I will research on hooking the audio subsystem of OpenHarmony/HarmonyOS with SDL and test it

Open PR if you have done it

@Jack253-png
Copy link
Author

based on opengles2 triangle demo

oh ok, I will research on hooking the audio subsystem of OpenHarmony/HarmonyOS with SDL and test it

Any progress?

@Jack253-png
Copy link
Author

based on opengles2 triangle demo

oh ok, I will research on hooking the audio subsystem of OpenHarmony/HarmonyOS with SDL and test it

Have you succeed in porting audio subsystem?

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.

7 participants