Raspberry Pi4, BasiliskII performance - must use X!

About BasiliskII, a 68k Mac emulator for Windows, MacOSX, and Linux that can run System 7.x through MacOS 8.1.

Moderators: Cat_7, Ronald P. Regensburg

Post Reply
ujimaflip
Space Cadet
Posts: 9
Joined: Wed Apr 28, 2021 11:44 pm

Raspberry Pi4, BasiliskII performance - must use X!

Post by ujimaflip »

Hi All,
I'm new to the forum, but been using the emulators for years. I'm sure there are a few out there with similar setups to me: A series of Raspberry Pis, all running various iterations of retro games, including our favourites from the that time when the mac was a serious gaming machine (Maybe it will happen again with the M1s - I guess we will see).
Back to the reason for the post: I was very disappointed with the performance of BasiliskII on the pi4 (compared to the pi3). It took me some time to work it out, but essentially the graphics drivers are only optimised to function when running X. After a lot of playing with various settings, I have managed to achieve a satisfactory setup by creating custom .xinitrc for each env (BasiliskII, SheepShaver).
I typical xinit script looks something like this - save the file in something like startbasilisk in your home dir

Code: Select all

#!/bin/sh
xrandr --output HDMI-1 --mode 800x600 --panning 800x600 --transform 1.33333333,0,-125,0,1,0,0,0,1
exec sudo -E /home/pi/macemu/BasiliskII/src/Unix/BasiliskII
Probably not the best idea to run from the build directory - but I was also trying out lots of build config settings, so was useful for me to configure this way.
The first line sets the X resolution to 800x600, and transforms the image adding borders left and right to stop the image being stretched across the screen (maybe you prefer stretched - it which case you can omit this, or simply set the resolution - something like xrandr -s 800x600. sudo is only required for sheep_net. We could change the ownership of the sheep_net.. but that still requires sudo in the script, so I'm not sure how much we save.
My script to launch:

Code: Select all

sudo modprobe sheep_net
startx /home/pi/startbasilisk
This script can simply be dropped into RetroPie roms/ports if you use RetroPie.
User avatar
adespoton
Forum All-Star
Posts: 3388
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by adespoton »

Thanks for the details!

When you weren't using X, what were you using? SDL1.2, SDL2, or direct framebuffer? These will likely all have different results.

Here's the specs for RPi3 and RPi4:

RPi3:
SoC: Broadcom BCM2837
CPU: 4× ARM Cortex-A53, 1.2GHz
GPU: Broadcom VideoCore IV

RPi4:
SoC: Broadcom BCM2711B0
CPU: quad-core A72 (ARMv8-A) 64-bit @ 1.5GHz
GPU: Broadcom VideoCore VI

They both have 64-bit quad core ARM chips that adhere to ARMv8-A. So the big difference is likely the GPU. Possibly SDL 1.2 doesn't handle the instruction set for VideoCore VI, so is stepping back to generic instructions that run slower?

I'd be interested to see if you could get the SDL2 version running, as that should have VideoCore VI support.
ujimaflip
Space Cadet
Posts: 9
Joined: Wed Apr 28, 2021 11:44 pm

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by ujimaflip »

Hi both the pi3 and pi4 are built with sdl2. There is quite some debate online regarding the OpenGL drivers for the pi4. More energy has gone into X support. Running without X on the pi4 results in poor stuttering performance. If launched via X the performance is a lot better.

As an update to the above, I’ve changed monitors. This new one automatically swaps to 4:3 so I no longer have to pass and xrandr transforms (just the resolution).
ebann
Student Driver
Posts: 21
Joined: Tue Jan 19, 2021 10:26 pm

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by ebann »

ujimaflip wrote: Mon May 03, 2021 11:26 pm Hi both the pi3 and pi4 are built with sdl2. There is quite some debate online regarding the OpenGL drivers for the pi4. More energy has gone into X support. Running without X on the pi4 results in poor stuttering performance. If launched via X the performance is a lot better.

As an update to the above, I’ve changed monitors. This new one automatically swaps to 4:3 so I no longer have to pass and xrandr transforms (just the resolution).
Hello! I have a Pi3B and compiled Basilisk II using SDL2 without X. Performance was over 3x according to Speedometer 4. A few caveats:

1. Speedometer 4 crashes when doing graphics test at multiple color bit depths; occasional HD corruption
2. Stuck at 640x480 resolution.

Did you manage to get higher resolution without X server?
ujimaflip
Space Cadet
Posts: 9
Joined: Wed Apr 28, 2021 11:44 pm

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by ujimaflip »

Yes I have the pi3 running fine with 800x600 without X. The pi4 is the problem as the performance is dreadful unless launched via X. There may be a way to recompile SDL to take advantage of the acceleration, but I have not resolved it yet. Right now, a simple startx is serving up spectre supreme in multiplayer AppleTalk mode without issue!
I tend to launch in 640x480 as the majority of the games run at that resolution anyway. If your sole focus is BasiliskII, I would suggest there is no real advantage of moving to pi4 ata this stage
ebann
Student Driver
Posts: 21
Joined: Tue Jan 19, 2021 10:26 pm

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by ebann »

ujimaflip wrote: Mon May 17, 2021 7:43 am Yes I have the pi3 running fine with 800x600 without X. The pi4 is the problem as the performance is dreadful unless launched via X. There may be a way to recompile SDL to take advantage of the acceleration, but I have not resolved it yet.
How did you run Basilisk 2 at 800x600 without X. I could only get 640x480 and MacOS 7.6.1 control panel/monitors only shows 640x480 as an option. SDL2 (I’m assuming you are using SDL2) doesn’t use DGA nor FRAMEBUFFER nor WINDOW modes right? What does your config file look like?

I’m getting my Pi 400 next week so I’ll test it out as well. It must be related to the Linux OpenGL driver for the Pi4.
ujimaflip
Space Cadet
Posts: 9
Joined: Wed Apr 28, 2021 11:44 pm

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by ujimaflip »

On the pi3 I build BasilliskII from https://github.com/kanjitalk755/macemu git repository

I use the following screen config:

Code: Select all

screen win/800/600
Note: if I use gda I get the same issue as you do
ebann
Student Driver
Posts: 21
Joined: Tue Jan 19, 2021 10:26 pm

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by ebann »

ujimaflip wrote: Wed May 19, 2021 11:44 am On the pi3 I build BasilliskII from https://github.com/kanjitalk755/macemu git repository

I use the following screen config:

Code: Select all

screen win/800/600
Note: if I use gda I get the same issue as you do
I think I found out why my system was not running 800x600 correctly (I was getting massive screen tearing followed by a segmentation fault and unresponsive Pi).

1. the Quadra 800 ROM that I was using has a limitation, i.e., it cannot run 24-bit color modes. Wikipedia says:

Video: The logic board has 512 KB of on-board VRAM; this is sufficient to provide 256-color (8-bit) support on monitors up to 16 inches in size. Two VRAM SIMM slots provide the ability to upgrade to 1 MB of VRAM, which allows for 32,768 color (16-bit) resolutions. The Quadra 800 is not capable of operating at 24-bit color, regardless of how much VRAM is installed, or whether an external video card is used. David Pogue described this as "Apple deliberately crippling this machine to enhance the attractiveness of the Quadra 900 and 950 models."

2. I left the "displaycolordepth" parameter to 0 (zero) meaning highest color depth, i.e. 24-bit. For some reason, 640x480x24 worked but not 800x600x24. (Omitting the "screen" parameter defaults to 640x480 which was my case)

Using "displaycolordepth 8" and "screen win/800/600" worked successfully.

Apple Specifications shows the following valid modes for Quadra 800:

Code: Select all

Resolution	512K VRAM	1MB VRAM

512 x 384	16-bit		16-bit
640 x 400	n/a-bit		n/a-bit
640 x 480	8-bit		16-bit
800 x 600	8-bit		16-bit
832 x 624	8-bit		16-bit
1024 x 768	4-bit		8-bit
1152 x 870	4-bit		8-bit
1280 x 1024	n/a-bit		n/a-bit
Basilisk II manual instructs to set "model ID" to "14" (Quadra 900) if you want to run MacOS 8, which I am also assuming when running 7.6.1 as well. The Gestalt ID is used by the OS to query all the functions and capabilities of the machine. Perhaps the OS was confused to be fed a Quadra 900 ID but running a Quadra 800 ROM with its crippled non-24-bit video.

Apple Specifications shows the following valid modes for Quadra 900:

Code: Select all

Resolution	1MB VRAM	2MB VRAM

512 x 384	24-bit		24-bit
640 x 400	n/a-bit		n/a-bit
640 x 480	8-bit		24-bit
800 x 600	n/a-bit		n/a-bit
832 x 624	8-bit		24-bit
1024 x 768	n/a-bit		n/a-bit
1152 x 870	8-bit		8-bit
1280 x 1024	n/a-bit		n/a-bit
Notice how some video resolutions do not intersect, namely the common 800x600 and 1024x768 which are not available on the Quadra 900.

I am going to do some video testing on these resolutions versus Quadra 800 and 900 ROMs using the recommended "model ID 14". I'll post results in a few days.
User avatar
adespoton
Forum All-Star
Posts: 3388
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com
Contact:

Re: Raspberry Pi4, BasiliskII performance - must use X!

Post by adespoton »

Probably worth noting that the most recent BII code on cebix uses the Mini vMac graphics handling, where the display is totally disassociated from the ROM being used, and instead uses whatever the host system can provide. This means you can use any depth and resolution with any ROM/virtual hardware. At least on macOS and Windows; should work on Pi as well.
Post Reply