News:

Precision Simulator update 10.181 (1 February 2025) is now available.
Navburo update 13 (23 November 2022) is now available.
NG FMC and More is released.

Main Menu

PSX on computers with ARM processors

Started by MFarhadi, Sat, 8 Jun 2024 18:25

MFarhadi

I know, I know. It's been discussed many times so far, and I certainly believe converting PSX to run natively on ARM is excruciatingly hard. But seemingly, the rest of the world is gearing up to be ARM based in the near future? or probably it's just another short-lived hype of the market. I donno.

https://www.youtube.com/watch?v=C0bEew9dqNs
Mohammadreza Farhadi
Ex-pilot, current aerospace student

Jeroen Hoppenbrouwers

Is there a Java VM for ARM? If so, PSX should run.

FlyItLikeYouStoleIt

Java runs on ARM natively and PSX runs just fine in it - with the exception of no audio (on Mac at least).

MFarhadi

Quote from: FlyItLikeYouStoleIt on Sat,  8 Jun 2024 20:11Java runs on ARM natively and PSX runs just fine in it - with the exception of no audio (on Mac at least).

Yep, and PSX runs pretty choppy on x86 Java. M3 Pro with 50-60 FPS, dropping to 15-20 fps when changing views.
Mohammadreza Farhadi
Ex-pilot, current aerospace student

Hardy Heinlin

Quote from: MRFarhadi on Sat,  8 Jun 2024 20:27Yep, and PSX runs pretty choppy on x86 Java. M3 Pro with 50-60 FPS, dropping to 15-20 fps when changing views.

50-60 fps is excellent, actually. Videos run at that rate.

When changing the layout, it may freeze for 100 milliseconds and then immediately continue at 50-50 fps. That's normal. The FPS indicator in PSX shows the average value within the last 1-second period. The indicator runs at 1 Hz. When you read 20, it doesn't mean that it was 20 continuously within that whole last second. The average value just dropped because one single frame took longer. Is that really noticeable? -- When I change the layout, my brain actually needs a fraction of a second anyway to adapt to the new view. The sim will be back to a high frame rate even before my brain will notice the new layout.

MFarhadi

#5
Quote from: Hardy Heinlin on Sat,  8 Jun 2024 21:0950-60 fps is excellent, actually.
Yes, it is.
Quote from: Hardy Heinlin on Sat,  8 Jun 2024 21:09Is that really noticeable?
Yes in some sense. Though the numbers are great, the smoothness is really outta the question, especially with the 14" device I've got here, and I'm used to changing the layouts very quickly. My only take is my very old 7700K used to handle this much smoother.

*EDIT* Just checked PSX with ARM64 Java, and the FPS is still at around 63/s. Is there a MacOS internal limitation on how fast it can run applications? 'cause PSX's resource (CPU, etc.) is comically low.

*EDIT 2* Don't know why, but it seems as if the 100 milisecond delay is a lot longer and more laggy on my M3 Pro. Maybe there's something that I'm missing in here.
Mohammadreza Farhadi
Ex-pilot, current aerospace student

Hardy Heinlin

Quote from: MRFarhadi on Sat,  8 Jun 2024 21:22Is there a MacOS internal limitation on how fast it can run applications?

In the past there were some Windows versions and some Mac versions that limited the frame rate to circa 60 fps. So, that's not unusual. It's not a problem either.

By the way, the platform on which PSX runs will always depend on the respective Java Virtual Machine (JVM) available for that specific platform; there's no thing in PSX that I need to modify for ARMs. It's all Java. As there are JVMs for ARM platforms already, this has never been a problem for PSX. The only problem is that the newer Macs when running with an ARM JVM won't enable the sound system. This might be due to new security systems in newer Macs. My plan is to implement a completely new Java sound system using a newer Java library that will hopefully no longer be restricted by the new Macs. Whether that will work -- I don't know. My plan ist to first make a public sound test progam. Only if that works, I'll implement it in PSX. The implementation will be a lot of work, therefore I want to test it first before all efforts will be in vain.

Jeroen Hoppenbrouwers

... looking for Java VM for Honeywell AIMS ...

MFarhadi

I understand that this thread is approaching to be a support one, but I'm trying my best to avoid doing that.


Alright, seems like my PSX instance is locked at exactly 0% GPU utilization and the majority of jitteriness comes from when changing views or zooming in and out, with the magneta slider jumping back and forth while the whole simulator is lagging. On paper, it shouldn't be an issue running the whole simulator. I even tried Parallels Windows 11; it ran PSX with 73 fps without any hiccups.
Mohammadreza Farhadi
Ex-pilot, current aerospace student

MFarhadi

Quote from: Jeroen Hoppenbrouwers on Sun,  9 Jun 2024 07:33... looking for Java VM for Honeywell AIMS ...

Wouldn't every body be paid less in that case? =))
Mohammadreza Farhadi
Ex-pilot, current aerospace student

Jeroen Hoppenbrouwers

Quote from: MRFarhadi on Sun,  9 Jun 2024 07:42Alright, seems like my PSX instance is locked at exactly 0% GPU utilization [...]
It fully depends on the particular Java VM you use whether it even tries to use the GPU. PSX itself is written in such a way that any available hardware acceleration will be used (2D only, PSX is not a 3D program). But if the Java VM does not map these graphics calls to the GPU, there's nothing PSX can do about it.

This remains the main challenge for PSX: a large amount of the actual on-computer capabilities depends directly on the Java VM in use and there's no way that Aerowinx can tinker with these VMs. Other simulators that don't use Java have the benefit of being able to fully exploit a machine's capabilities at the expense of being locked into one single platform (or two, if you add significant effort). And the developers keep hunting the platform forever in order not to lag behind and become obsolete in two years.


Hoppie

MFarhadi

Quote from: Jeroen Hoppenbrouwers on Sun,  9 Jun 2024 08:24It fully depends on the particular Java VM you use whether it even tries to use the GPU.

Thanks for explaining it this easily, however, it still remains a territory I'm alien to.

After some digging, I found the "WindowServer" process is taking up software accelerated graphics calls, as the information on this matter is miniscule and scattered, only to be found in r/Minecraft subreddit so far.
Mohammadreza Farhadi
Ex-pilot, current aerospace student

Jeroen Hoppenbrouwers

In brief, the way Java works is that it uses software (the Java Virtual Machine) to create a near-complete virtual platform that presents an identical environment to every Java program you run on it. This Virtual Machine does not only execute the typical CPU tasks (thereby giving you a virtual CPU instead of an x86, AMD64, ARM, PowerPC, Z80 whatever chip) but also provides a lot (and I mean a lot) of operating system functions to create files, write files, create windows, paint stuff, produce audio, ... the list is endless.

The advantage of this is that a program written in Java can run unchanged (same binary files) on nearly all Java Virtual Machines out there. Since writing a program usually is very expensive in time (and thus money), having to write it once is a huge benefit.

The drawback is that a Java program rarely is as fast as a native program for the actual hardware CPU (although this difference gets smaller every day as Java VMs get developed and new CPUs actually get designed to better support virtualisation and other techniques) and that if there is no Java VM available to you, you cannot run any Java program.

And in our case, the ARM Java VM does not properly support the sound API that Hardy used, so that function is missing, and there is little Hardy can do about it. Since Java comes in versions, he now hopes that the ARM Java VM supports audio in a newer version.

It's still a small miracle that PSX runs as well as it does. Way too many Java programs have been kludged together by people either not as technically thorough as Hardy, or under time pressure to get anything working and ship very (c)rude material. So Java programs got a nasty name compared to polished "real" products. However this is unfair -- it only means that for some products, quick and dirty was considered "good enough" and then Java is a natural choice as it promises "write once, run anywhere."

Of course this technical magic is all being replaced by "Hey Chatbot, write me a program that runs on my X79 70-bit dual GPU desktop phone and simulates a complete B747-8F in expected United configuration with fully simulated planet, all worldwide airports and immersive 3D video for Apple's next goggles."


Hoppie

MFarhadi

Quote from: Jeroen Hoppenbrouwers on Sun,  9 Jun 2024 15:50It's still a small miracle that PSX runs as well as it does. Way too many Java programs have been kludged together by people either not as technically thorough as Hardy, [...]

The true miracle in this case is what Hardy has delivered and kept on supporting over these years. I can not emphasize enough, the fact that PSX is totally in another level compared to anyhting in its price range, let alone being available on virtually any platform anywhere. Being grateful is the least this very community can do to support Hardy's efforts. Kudos.
Mohammadreza Farhadi
Ex-pilot, current aerospace student

Kurt

Quote from: Hardy Heinlin on Sun,  9 Jun 2024 06:02My plan is to implement a completely new Java sound system using a newer Java library that will hopefully no longer be restricted by the new Macs. Whether that will work -- I don't know. My plan ist to first make a public sound test progam. Only if that works, I'll implement it in PSX. The implementation will be a lot of work, therefore I want to test it first before all efforts will be in vain.

ooohhhhhhhh - missed that news :D  - would be great if some kind of output routing could be implemented to enable more than one stereo channel as it is today. Currently the only reason I need to run PSX on 3 separate PCs is to have true 6 channel audio in my cockpit - I could easily just use 1 PC if I could route to separate outputs from 3 PSX instances.

cheers

Kurt
Best regards
Kurt