Add ppc64le/ppc64 architecture support MVP#1945
Add ppc64le/ppc64 architecture support MVP#1945illwieckz merged 1 commit intoDaemonEngine:masterfrom
Conversation
|
Without NaCl, it is impossible to join online matches. But the idea to build a partially-working version is fine. That way you can host servers (the native nexe VM type is recommended for that) and play single-player. However the VM cvar type handling should work a bit differently. If you make the default value not NaCl, this results in confusing behavior when a player attempts to join an online match. The game would run, but everything would likely be messed up because the wrong client gamelogic is used. So instead of changing the default, exit with an error using |
I like your proposal. I was thinking of giving a go at adding ppc64 support for NaCl but unsure if it is worth the effort taking into the fact it has been discontinued by Google. |
I would recommend against trying that, since we are trying to get rid of NaCl and it would be an enormous undertaking. |
As slipher said, this is an enormous undertaking, and more precisely this requires:
I do remind that not only we don't have an NaCl loader for PPC64, but we also don't have a compiler for NaCl on PPC64 as well. Implementing that is expected to be huge effort. I actually wonder if qemu-user wouldn't be the shortest path to get NaCl running on something else than amd64/i686/armhf. |
2d1326f to
8976266
Compare
|
@slipher what's the best way to determine if a player is about to join an online game vs self-hosted / LAN game? EDIT: nvm, I think the issue I am dealing with is how to pass on the params (vm.cgame.type etc) to the server when I choose to host local game |
|
@illwieckz thanks for your feedback. in theory it should be possible to add support of PPC64 for NaCl because some folks in the community has attempted to do so back in the day when Chromium was still on NaCl. So it's just a matter of digging up to see if the changes could be adapted or not. Cross-compilation from a x86_64 host is one of many ways to compile the codes for ppc64. Alternatively you could even apply for a native POWER8-based GitHub Action runner (ref: https://github.com/IBM/actionspz/issues). |
|
@slipher I've just ran into a blocker, the |
|
Yes, loading a non-NaCl game is a cheat. You can play locally using the |
That's interesting! But did it actually succeed?
You probably missed something very important there: there is no compiler producing ppc64 nexe binaries. I'm not talking about a ppc64 compiler to build the nacl loader, neither about how to compile a ppc64 compiler. NaCl runs native binaries, but built for the virtual machine. It is system-independent, not platform-independent. Without a compiler to build the NaCl game code for PPC64, a PPC64 NaCl loader has nothing to load. |
I have to dig in and will let you know. Perhaps the amount of efforts would far outweigh the alternatives like WASM.
Great to know. I am planning to add a ROM cvar |
|
I have mixed feelings about this. I'm an obvious enthusiast in cross-platform stuff, I'm actually the one who made the game running on arm, on FreeBSD, and made it possible to build native games on platforms unsupported. But while there can be an actual usage of running a native server whatever the platform, right now the multiplayer client cannot go online without running on x86 or arm. So that seems to be a lot of work for being able to not play a multiplayer game the multiplayer way… |
|
Since you're working on PPC support, you may want to reintroduce We removed it because we could not test it. Here is the commit removing it: 2b7f64c. If you want to reimplement |
I agree we don't want to have hundreds of lines of coded dedicated to something that is only marginally useful. But I think it's worthwhile if we do a minimal version without any unneeded bells and whistles. I suggest dropping the changes to default VM type values and the extra error message in If anyone wants to get into assembly micro-optimizations that can go in a separate PR. |
I will do it in a separate PR |
|
While we are at it, I would like to invite both of you to the idea of using box64 emulator, I've developed a working PoC at #1946 |
Yes, I like that. This is kind of thing I meant when I said:
Though I just tried qemu-user, and while I can run some hello-world, that didn't worked with the gamecode for unknown reason. If box64 works that would be better. |
|
@slipher I do not think I could remove the changes related to default VM type. So the issue is even |
|
The cheat stuff better be investigated separately. The ”minimum viable product” would be a server running a map with devmap, then other things can be considered in other PRs after that. |
|
Actually, did you try a ppc64 native server ( It's possible that the cheat thing you're seeing is client-specific. If I'm right the server can run native code without cheats. But then only NaCl (non-cheat) clients can join. |
Instead of |
d8d1eb0 to
dd63ad1
Compare
@slipher yay! you are right. It works! |
|
@slipher @illwieckz the PR is ready for review |
|
Very nice. Not blocking, but we prefer doing |
Add build support for ppc64le (little-endian, POWER8+) and ppc64 (big-endian, POWER5+) architectures: - CMake architecture detection, compiler flags (-mcpu), and NaCl build defines for ppc64el/ppc64 - NACL_RUNTIME_ARCH allowlist and DAEMON_NACL_RUNTIME_ENABLED define to track whether a NaCl loader exists for the target architecture - vm.nacl.available ROM cvar so the UI can detect NaCl availability - Sys::Error when attempting to launch a NaCl VM on a platform without a NaCl loader, advising to use native DLL mode with devmap
dd63ad1 to
bf1b024
Compare
illwieckz
left a comment
There was a problem hiding this comment.
That looks good!
For your knowledge, we have the usage to not merge things before 1 day has passed.
|
Thanks a lot @runlevel5! I'm now eager to see that box64 thing rebased. 🙂️ |
Summary
Add build and runtime support for ppc64el (little-endian) and ppc64 (big-endian) POWER architectures. NaCl does not support PPC, so this ensures the engine builds cleanly and provides a clear error when NaCl is attempted on an unsupported platform.
CMake changes
-mcpu=power8(ppc64el) and-mcpu=power5(ppc64) compiler flags via newGCC_GENERIC_CPUvariable, since GCC on POWER uses-mcpuinstead of-march/-mtuneppc64el_PARENT = ppc64parent architecture relationship; addNACL_RUNTIME_ARCHallowlist andDAEMON_NACL_RUNTIME_ENABLEDcompile-time define that is only set when a NaCl loader exists for the target architecture (amd64, i686, armhf)Runtime changes
vm.nacl.availableROM cvar (true on amd64/i686/armhf, false otherwise) so the game UI can detect NaCl availability at runtime; addSys::Errorguard inVMBase::Create()if NaCl VM type is attempted on a platform without a NaCl loaderUsage on non-NaCl platforms
Dedicated server (sgame is not a CHEAT cvar):
Client (cgame is a CHEAT cvar, use
-setto override before reset):