realnc / dosbox-core

A DOSBox core for use in RetroArch and other libretro frontends.
GNU General Public License v2.0
42 stars 16 forks source link

How to build with dynamic recompiler support for arm64? #37

Closed vanfanel closed 2 years ago

vanfanel commented 2 years ago

Hi there, @realnc

Once again I come to you with a question about dosbox-core. I build the core on the Pi4 (running 64bit kernel & libs) with this line:


make -j4 platform=unix WITH_FAKE_SDL=1 STATIC_LIBCXX=1 \
WITH_FLUIDSYNTH=0 BUNDLED_AUDIO_CODECS=0 BUNDLED_GLIB=0 BUNDLED_LIBSNDFILE=0 WITH_PINHACK=0 WITH_VOODOO=0 WITH_BASSMIDI=0

However, I have observer that CPU usage is exactly the same whether I chose DYNAMIC (generic recompiler) or NORMAL CPU emulation modes in SPECS.

I have run Dosbox on x86 many times, and the dynamic recompiler usually leads to a way lower CPU usage, so my guess here is that there is no dynamic recompiler running here.

So, what am I missing to build it with the best possible dynamic recompiler for arm64?

Thanks!

realnc commented 2 years ago

WITH_DYNAREC=arm64 for ARM64 and WITH_DYNAREC=arm for 32-bit ARM.

Also, what's the output of uname -m? The makefile parses it to set the dynarec automatically.

vanfanel commented 2 years ago

WITH_DYNAREC=arm64 for ARM64 and WITH_DYNAREC=arm for 32-bit ARM.

Also, what's the output of uname -m? The makefile parses it to set the dynarec automatically.

~# uname -m aarch64

vanfanel commented 2 years ago

Also, I see this during compilation:

g++ -std=gnu++17 -Wno-register -DFMT_HEADER_ONLY -D__LIBRETRO__ -MMD -fPIC -I../libretro/fakesdl -I../src -I../libretro -I../libretro/virtual_keyboard -I../libretro/deps/common/include -I../include -Ideps/fmt/includepkg-config --cflags-only-I mt32emu -march=armv8-a+crc+simd -mtune=cortex-a72 -ftree-vectorize -pipe -fomit-frame-pointer -DGIT_VERSION=\""51c4822"\" -DSVN_VERSION=\""r4471"\" -DHAVE_ALSA -DC_HAVE_MPROTECT="1" -O3 -DNDEBUG -DWITH_FAKE_SDL -Ifakesdl/SDL -DC_DYNREC="1" -DC_TARGETCPU="ARMV8LE" -c -o ../src/cpu/core_dynrec.o ../src/cpu/core_dynrec.cpp

So it seems as if dynarec is being built.. confusing.

realnc commented 2 years ago

Can you test stand-alone dosbox? If it has the same behavior, then this is normal.

vanfanel commented 2 years ago

@realnc Good idea!

And yes, stadalone does the same. Huh! How strange... Well, it's not a dosbox-core specific issue then, I guess!

Thanks for your attention!

realnc commented 2 years ago

You might want to ask about it in the dosbox forum on vogons.org. I don't have a Pi (or any other ARM device other than a phone) so I can't even test that stuff.

vanfanel commented 2 years ago

@realnc In case you are curious, I opened a new thread discussing this matter on the VOGONS forums here:

https://www.vogons.org/viewtopic.php?f=31&t=85602

Let's see what comes out of this! :)

andres-asm commented 2 years ago

I have tested on my SHIELD and it made a big difference in performance (I don't care for CPU usage) (dosbox-svn core) haven't tested in a while.

I even had videos on that when I was an active contributor.

vanfanel commented 2 years ago

I have tested on my SHIELD and it made a big difference in performance (I don't care for CPU usage) (dosbox-svn core) haven't tested in a while.

I even had videos on that when I was an active contributor.

Interesting. Hadn't considered that point of view. But isn't performance limited by CPU usage? (Among other factors like memory bandwidth etc)

I mean: wouldn't we start seeing emulation speed problems from a certain CPU usage?

andres-asm commented 2 years ago

I guess, but with dynarec I can play duke nukem 3d at full speed, without it I can't at all. Sadly I have removed such video.