Qemu virtio drivers for Mac OS 9.x

About Qemu-system-ppc, a PPC Mac emulator for Windows, macOS and Linux that can run Mac OS 9.0 up to Mac OS X 10.5

Moderators: Cat_7, Ronald P. Regensburg

User avatar
adespoton
Forum All-Star
Posts: 4473
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: Qemu virtio drivers for Mac OS 9.x

Post by adespoton »

codoodguy wrote: Tue Jul 09, 2024 3:48 am Would it be possible for the mouse driver to be patched up for games? Due to the way it works, it breaks fps games currently so I'm stuck w/ USB inputs.
The driver is a tablet driver; as I doubt you'd want to use a tablet to play FPS games, it's probably not the right option for doing so.

The idea behind the driver is that it can map precise points instead of the delta coordinates, which means the emulator can integrate the host mouse by passing through mouse location. The alternatives are to either emulate the pointing device completely, or to do some heavy math to translate the host delta or coordinates into the emulator delta. The last would be slow and stuttery and potentially innacurate, and the middle option is the USB input option you already have.

Did you have another idea beyond those three that could be viably implemented?
codoodguy
Student Driver
Posts: 16
Joined: Tue Nov 17, 2015 8:14 am

Re: Qemu virtio drivers for Mac OS 9.x

Post by codoodguy »

adespoton wrote: Tue Jul 09, 2024 2:33 pm
codoodguy wrote: Tue Jul 09, 2024 3:48 am Would it be possible for the mouse driver to be patched up for games? Due to the way it works, it breaks fps games currently so I'm stuck w/ USB inputs.
The driver is a tablet driver; as I doubt you'd want to use a tablet to play FPS games, it's probably not the right option for doing so.

The idea behind the driver is that it can map precise points instead of the delta coordinates, which means the emulator can integrate the host mouse by passing through mouse location. The alternatives are to either emulate the pointing device completely, or to do some heavy math to translate the host delta or coordinates into the emulator delta. The last would be slow and stuttery and potentially innacurate, and the middle option is the USB input option you already have.

Did you have another idea beyond those three that could be viably implemented?
I think at this point, the only option is to improve input emulation upstream. Even w/ other OSes, Qemu's mouse emulation really sucks. This might sound stupid, but I always liked how WinUAE handled mouse input in games. I wonder if some of the code for that could be adapted to qemu?
User avatar
Madd the Sane
Student Driver
Posts: 19
Joined: Fri Aug 31, 2012 6:27 pm
Location: Idaho

Re: Qemu virtio drivers for Mac OS 9.x

Post by Madd the Sane »

Are there any plans on adding OpenGL pass-thru or RAVE emulation?
Get out of my mind, idea! I already have an idea in there!
mattsaved
Space Cadet
Posts: 1
Joined: Mon Aug 12, 2024 9:09 pm

Re: Qemu virtio drivers for Mac OS 9.x

Post by mattsaved »

I am an amateur database/php developer, microcontroller hacker, and Mac zealot of the macOS6-9 days. I covet the idea of learning enough older Mac development to understand this code. This is so exciting!

I can imagine using the old open source MesaGL driver as a frame work for openGL frontend support, and then rewrite the backend to pipe to virtio instead of Glide.

I can imagine using MacGLide as template for a Glide frontend to translate to virtio....or
I can imagine, passing the glide though to MESAs voodoo emultor just like you could run a windows glide game in virtual pc while pipeing though to a the voodoo car running in the Mac. Glide2 (full screen only) might be the easiest option to do if I wanted to pretend I know what Im talking about.

I can imaging the using the 3dfxRave driver as a model to pipe Rave to virtio. but im not sure if that was ever open source. Would love to see Ravebench detect an incomplete driver.


The holy grail for me is recreating the first time I ran Unreal on my Powermac with voodoo 1. There are several games on macOS that I never used software rendering for that I wish I could play like the old days. (But of coarse I need to emulate the Mac version, still don't want to touch windows98 :)


Also Perhaps eventually USB passthrough will be sufficient for games control. Im happy to just have second mouse nearby captured by qemu.
thom75
Tinkerer
Posts: 41
Joined: Sat May 06, 2017 6:40 pm

Re: Qemu virtio drivers for Mac OS 9.x

Post by thom75 »

Hi Cat_7,

I've seen there is screamer + virtio build for MacOS so I tried to compile Screamer build with VirtIO patch, it seem to work, device is visible on yellow screen but refresh rate is like 0.5Hz and full of artifacts.
openbios-qemu-screamer-virtio.elf copied from OSX build.

this how I build it:

Code: Select all

git clone -b screamer-v9.0.0 https://github.com/mcayland/qemu.git screamer-v9.0.0
git clone https://github.com/elliotnunn/classicvirtio.git
cd screamer-v9.0.0
patch -p1 < ../classicvirtio/patches/qemu-virtio-gpu.patch
./configure --target-list="ppc-softmmu" --enable-gtk --enable-sdl --enable-slirp --audio-drv-list="pa"
make
cd build
strip qemu-system-ppc
this is how I run it:

Code: Select all

#!/bin/sh
cd "$(dirname "$0")"

LD_PRELOAD=$LIBSLIRP_PATH/lib/libslirp.so.0 ./bin/qemu-system-ppc-screamer-virtio-pa-9.0.0 \
-L bin/pc-bios \
-bios ./bin/pc-bios/openbios-qemu-screamer-virtio.elf \
-M mac99,via=pmu \
-m 256 \
-display gtk \
-g 1024x768x32 \
-rtc base=localtime \
-boot c \
-drive file=./disks/macos9.img,format=raw,media=disk \
-drive file=./disks/storage-disk.img,format=raw,media=disk \
-drive file=./disks/Apple_MacOS_9.2.2.iso,format=raw,media=cdrom \
-netdev user,id=network0,hostfwd=tcp::2121-:21 \
-device sungem,netdev=network0 \
-device virtio-vga \
-device virtio-tablet-pci \
-device loader,addr=0x4000000,file=./bin/pc-bios/ndrvloader \
-prom-env "boot-command=init-program go" \
-device virtio-9p-pci,fsdev=SHARED,mount_tag="Shared" \
-fsdev local,id=SHARED,security_model=none,path=./shared
User avatar
Cat_7
Expert User
Posts: 6344
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Qemu virtio drivers for Mac OS 9.x

Post by Cat_7 »

So it seems you like living on the edge ;-)
The slowdown is caused by the virtio-vga option. It should not be used and might disappear in the future.

Best,
Cat_7
thom75
Tinkerer
Posts: 41
Joined: Sat May 06, 2017 6:40 pm

Re: Qemu virtio drivers for Mac OS 9.x

Post by thom75 »

Hi Cat_7,

I see, but is the graphics accelerated anyhow when it's compiled with the patch and patched openbios?
I can see that something is loaded on yellow screen but can't "feel it". I don't know any PPC benchmark utility to see a difference and Speedtest for 68k doesn't show improvement.

Also if I look what the patch is changing is seem only be related to VirtIO graphics, isn't it?
So I wonder if I even need to apply the patch and use screamer + virtio bios instead just screamer bios if not going to use virtio-vga option?
Tablet driver and shared folder with host system work without virtio bios or patch anyway.
Sorry for me asking damn questions, I'm simply not a developer so don't understand this bit.

Do I like living on edge??? Hmm... I'm daily driving Linux (NixOS, currently) so I think yes, sure at least a little bit. :)

Kind regards
Thom
User avatar
Cat_7
Expert User
Posts: 6344
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Qemu virtio drivers for Mac OS 9.x

Post by Cat_7 »

Hi,

No, there is no speed to be gained by using the virtio-vga.
And yes, the other two virtio drivers work without the vga patch.

You can test speed with e.g., macbench 5.

Best,
Cat_7
User avatar
Cat_7
Expert User
Posts: 6344
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Qemu virtio drivers for Mac OS 9.x

Post by Cat_7 »

The virtio-vga device has been removed from the virtio options. At some point it will be replaced with the arbitrary resolutions patch by SolraBizna.

Best,
Cat_7
someperson
Space Cadet
Posts: 1
Joined: Thu Sep 05, 2024 5:42 pm

Re: Qemu virtio drivers for Mac OS 9.x

Post by someperson »

Do these drivers require a special build of Qemu or OpenBIOS? I'm trying to get the tablet driver to work on Linux, and am not having much luck. If it does require special builds, where can I find the source? Thank you!

EDIT: Nevermind, I figured it out. via=pmu doesn't work. Switched to via=pmu-adb and it worked!
Last edited by someperson on Thu Sep 05, 2024 6:04 pm, edited 1 time in total.
User avatar
Madd the Sane
Student Driver
Posts: 19
Joined: Fri Aug 31, 2012 6:27 pm
Location: Idaho

Re: Qemu virtio drivers for Mac OS 9.x

Post by Madd the Sane »

Well, the source code for the RAVE driver was released by 3Dfx in the past, but I can only find one reference of it is on VerySource.
Get out of my mind, idea! I already have an idea in there!
vivid
Inquisitive Elf
Posts: 26
Joined: Fri Sep 06, 2024 7:06 am

Re: Qemu virtio drivers for Mac OS 9.x

Post by vivid »

Hello,
with these lines;

Code: Select all

cd h:\"QEMUvirtio2"
.\qemu-system-ppc-virtio.exe -M mac99,via=pmu -m 512 -L pc-bios -bios openbios-qemu-virtio.elf -display sdl -device loader,addr=0x4000000,file=ndrvloader -prom-env "boot-command=init-program go" -boot c -drive file=M.img,format=raw,media=disk -device virtio-tablet-pci -device virtio-9p-pci,fsdev=UNIQUENAME,mount_tag="Macintosh HD" -fsdev local,id=UNIQUENAME,security_model=none,path=h:/QEMUvirtio2

"Macintosh HD" is on the Os 9 desktop, but everything that goes into it disappears! impossible to format it either.
Do you have this problem?

Thank you.
User avatar
adespoton
Forum All-Star
Posts: 4473
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: Qemu virtio drivers for Mac OS 9.x

Post by adespoton »

vivid wrote: Thu Sep 26, 2024 11:24 am Hello,
with these lines;

Code: Select all

cd h:\"QEMUvirtio2"
.\qemu-system-ppc-virtio.exe -M mac99,via=pmu -m 512 -L pc-bios -bios openbios-qemu-virtio.elf -display sdl -device loader,addr=0x4000000,file=ndrvloader -prom-env "boot-command=init-program go" -boot c -drive file=M.img,format=raw,media=disk -device virtio-tablet-pci -device virtio-9p-pci,fsdev=UNIQUENAME,mount_tag="Macintosh HD" -fsdev local,id=UNIQUENAME,security_model=none,path=h:/QEMUvirtio2

"Macintosh HD" is on the Os 9 desktop, but everything that goes into it disappears! impossible to format it either.
Do you have this problem?

Thank you.
-boot c -drive file=M.img,format=raw,media=disk

Isn't the name of that file "Macintosh HD"? By default it should be. This could be causing problems with the file share.

The other issue is... why are you trying to format a shared folder? And finally, it's possible that the share is read-only, which would explain why writing to it has no effect.

I thought Eliott had eventually updated the driver to both read and write, but possibly not the version you (and a few other people) are using?
vivid
Inquisitive Elf
Posts: 26
Joined: Fri Sep 06, 2024 7:06 am

Re: Qemu virtio drivers for Mac OS 9.x

Post by vivid »

it's here;

Code: Select all

https://github.com/elliotnunn/classicvirtio
to compile?! :shock:
User avatar
adespoton
Forum All-Star
Posts: 4473
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: Qemu virtio drivers for Mac OS 9.x

Post by adespoton »

vivid wrote: Fri Sep 27, 2024 5:15 am it's here;

Code: Select all

https://github.com/elliotnunn/classicvirtio
to compile?! :shock:
No, it's built right into the virtio-enabled QEMU builds we've got on here. No need to build the drivers yourself anymore. But you DO have to use a virtio-enabled build of QEMU. And older ones used an older read-only version of Elliot's work.
elliotnunn
Student Driver
Posts: 23
Joined: Sun Sep 11, 2016 6:35 am

Re: Qemu virtio drivers for Mac OS 9.x

Post by elliotnunn »

Cat_7, thanks for your stewardship of this thread and your great work helping people to use Mac OS on QEMU. Thank you everyone for your interest in these drivers. I hope that some of you have found them useful.

But as you undoubtedly know, the 9P filesystem driver is buggy and slow. I quote "Guide to the File System Manager" below to explain why. But development is moving fairly fast, and you might find that the very latest version works for you. You can download it from GitHub, no compiling necessary: https://github.com/elliotnunn/classicvirtio/releases
Even though the File System Manager provides many services that simplify development of foreign file systems, developing a foreign file system is both a difficult and time-consuming process. A minimal foreign file system must implement over forty Macintosh file system routines while a networked, sharable file system will have to implement as many as eighty Macintosh file system routines. To write a foreign file system you must be familiar with the low-level Macintosh file system data routines and data structures described in Inside Macintosh: Files and with the material covered in the chapters of the Guide to the File System Manager.
And if this doesn't dissuade you, and you know some C and a little bit about the Mac OS API, then I'd love your help!
elliotnunn
Student Driver
Posts: 23
Joined: Sun Sep 11, 2016 6:35 am

Re: Qemu virtio drivers for Mac OS 9.x

Post by elliotnunn »

Madd the Sane wrote: Sat Jul 20, 2024 4:07 am Are there any plans on adding OpenGL pass-thru or RAVE emulation?
I would love to add GPU acceleration. Thoughts:
  1. I removed the virtio-gpu driver (2D, unaccelerated) because virtio-gpu does not provide a framebuffer and is therefore a poor fit for the QuickDraw driver model. (Instead the guest must explicitly notify the host of every "new frame".)
  2. The 3D acceleration provided by virtio-gpu ("Virgl") might still be useful for Mac OS: we would need to bridge from the RAVE level to Gallium3D commands, which is a similar job to what Mesa does.
  3. I understand that Vulkan support might be coming to Virgl. Depending on how this is implemented, it might make our job easier.
  4. I use macOS as my host OS, and mainline QEMU for macOS hosts does not support Virgl without merging a tricky patchset.
  5. Hosts are pretty fast these days, and QEMU's code translation is pretty good. What are our chances of implementing RAVE purely in host CPU code?
elliotnunn
Student Driver
Posts: 23
Joined: Sun Sep 11, 2016 6:35 am

Re: Qemu virtio drivers for Mac OS 9.x

Post by elliotnunn »

codoodguy wrote: Tue Jul 09, 2024 3:48 am Would it be possible for the mouse driver to be patched up for games? Due to the way it works, it breaks fps games currently so I'm stuck w/ USB inputs.
Would switching the mouse back to "relative" mode fix these FPS games? Because it might be possible to offer a GUI option to do this before starting the game.
User avatar
adespoton
Forum All-Star
Posts: 4473
Joined: Fri Nov 27, 2009 5:11 am
Location: Emaculation.com

Re: Qemu virtio drivers for Mac OS 9.x

Post by adespoton »

elliotnunn wrote: Fri Nov 08, 2024 12:55 am
Madd the Sane wrote: Sat Jul 20, 2024 4:07 am Are there any plans on adding OpenGL pass-thru or RAVE emulation?
I would love to add GPU acceleration. Thoughts:
  1. I removed the virtio-gpu driver (2D, unaccelerated) because virtio-gpu does not provide a framebuffer and is therefore a poor fit for the QuickDraw driver model. (Instead the guest must explicitly notify the host of every "new frame".)
  2. The 3D acceleration provided by virtio-gpu ("Virgl") might still be useful for Mac OS: we would need to bridge from the RAVE level to Gallium3D commands, which is a similar job to what Mesa does.
  3. I understand that Vulkan support might be coming to Virgl. Depending on how this is implemented, it might make our job easier.
  4. I use macOS as my host OS, and mainline QEMU for macOS hosts does not support Virgl without merging a tricky patchset.
  5. Hosts are pretty fast these days, and QEMU's code translation is pretty good. What are our chances of implementing RAVE purely in host CPU code?
My votes are:
1. wait for Vulkan support to see if this makes things any simpler (and works for macOS hosts)
2. If it doesn't, implementing RAVE in host CPU kinda makes sense; we should be able to emulate RAVE on a single host core these days without much of a penalty, leaving plenty of cores for other purposes.

Specifications for the Rage II+DVD:
60 MHz 64-bit core
up to 83 MHz SGRAM memory
480 MB/s memory bandwidth
DirectX 5.0

Handling 128-bit instructions with the later extensions would be a bit trickier, but that's a LOT of slack a modern CPU has to handle RAVE-compliant instructions.
User avatar
Cat_7
Expert User
Posts: 6344
Joined: Fri Feb 13, 2004 8:59 am
Location: Sittard, The Netherlands

Re: Qemu virtio drivers for Mac OS 9.x

Post by Cat_7 »

There is some ATI rage support in Qemu, but it only supports some 2D. It seems there is no source code for the 3D micro engine.
https://codeberg.org/qmiga/pages/wiki/SubprojectAti

Best,
Cat_7
Post Reply