This subproject is about emulating an ATI VGA graphics card. This is not an easy task due to the complexity of these GPUs and while the final goal may be to emulate most features of some real GPU it should be done step-by-step, starting from simple and adding more features incrementally, otherwise this would be too big a task. It should probably also be broken down into smaller areas such as 2D, video accel, 3D, etc. so this subproject is likely bigger than others and almost has its own subprojects.
Where to start?
Two of the machines currently emulated by QEMU have an on-board or default ATI GPU:
- The PowerMac3,1 QEMU's mac99 is converging to came with a Rage 128 Pro card.
- The mips_fulong2e machine has an on-board Mobility 7000 aka. M6 chip.
The Rage 128 Pro is the last of the Rage GPUs while the Radeon Mobility 7000 is the simplest of the next generation Radeon GPUs (originally meant to be Rage 6, hence the M6 code name for the Mobility version). The 7000 (originally also called Radeon VE) and the M6 are built on the RV100 GPU which is a simplified version of the R100 Radeon chip lacking its more advanced features. These two chips, being almost direct descendents, are in practice very close so they can likely be emulated by mostly the same code only with some differences so they could be targeted together. MorphOS has driver for both but only supports 3D with the RV100, AmigaOS only supports RV100. MacOS (on mac99) and Linux also has drivers for both so these are a good first target (that may later be enhanced up to X1000/R520 which are the last Radeon chips after which the architecture has changed again).
Gentoo: emerge -ask app-emulation/qemu. RHEL/CentOS: yum install qemu-kvm. SUSE: zypper install qemu. QEMU can be installed from Homebrew: brew install qemu. QEMU can be installed from MacPorts: sudo port install qemu. QEMU requires Mac OS X 10.5 or later, but it is recommended to use Mac OS X 10.7 or later. I have no idea what QEMU is emulating and so the device remains unrecognized in Windows, which, I suspect, leads to quite poor responsiveness. Before I venture on to other areas such as VMware drivers/Spice-QXL and so, is there any way to sort things out with the regular vga device? Last edited by adam777 (2013-07-12 07:50:58).
To further trace back the genealogy of these chips, they are improved versions of the Rage 128 GL which itself stems from the Rage Pro. Therefore, information on these chips could also be useful to understand how these chips have evolved and what has changed between versions. Documentation of these GPUs are not freely available (ATI/AMD has only published info on chips newer than R300) so they cannot be collected here but careful readers should notice that they are not too hard to find.
So the plan is to start with Rage 128 Pro and RV100 and implement enough to get a Linux console on mac99 and mips_fulong2e then improve 2D acceleration to get X working, after that maybe add video overlay so MorphOS R128 driver can work and then implement 3D to reach RV100. From there it could be enhanced towards R520 which may seem very distant but mentioning it is no accident, it is what the Xenos GPU of the XBox 360 is based on and Xenia already has some emulation of, so it might be possible to take inspiration or even code from there to improve 3D emulation without doing it from scratch. Of course this is still a lot of work and likely I can't do it alone but that's why this project was created to bring together interested people who could together reach a goal that could not be reached individually.
Current status and known issues
We only have basic functionality working and most of the features are still missing but simple drivers that only use frame buffer and some 2D acceleration should work such as MorphOS and console output with Linux on mac99 and Linux on x86 pc virtual machines and with the PMON2000 firmware on mips_fulong2e. This is now in upstream QEMU in the form of the experimental ati-vga device so no separate git branch here for this at the moment. Small fixes will be submitted to QEMU directly, but we may create a branch if someone takes up a larger project that needs it (such as video accel or 3D). Below is a summary of known (solved or have a work around) and unknown (outstanding) issues with links to tickets where they are tracked:
Known issues
Besides garbage output due to bugs or missing 2D accel functions there are a few known problems with a workaround:
- The sam460ex firmware has the same problem with VGA BIOS that is mentioned at known issues with Pegasos2 so its BIOS emulator fails with QEMU's default vgabios. The same work around (or using a ROM from a real card) could be used but then mode switching fails and it cannot set right resolution.
- On mac99 OpenBIOS cannot run an x86 option ROM to initialise the card but it has its own driver which seems to work to boot at least Linux but MacOS does not find the card presumably because of missing info in device tree and driver that the Mac ROM of the real card would set up. OpenBIOS currently cannot run FCode ROMs so using card ROMs or their NDRVs is not easy. I've submitted patches to OpenBIOS to fix this but those are not yet in master. As a workaround an NDRV extracted from the card ROM can be passed in the QEMU command line setting it for the card ROM as -device ati-vga,romfile=aty.ndrv.bin -prom-env 'vga-ndrv?=false' where the prom-env part disables the built in QEMU NDRV so OpenBIOS will install the specified NDRV for the card not its own driver. It may also be possible to get a disk based driver to load by setting the name property of the /pci/ATY node in the OpenBIOS prompt (e.g. to ATY,Rage128Pd and disabling the vga-ndrv? loading but without additional patches this won't work yet. If MacOS boots with ATI drivers it seems to hang at the ATI Video Accelerator extension so that should be disabled to get it to boot but currently this does not have any advantage over normal frame buffer as acceleration is not yet implemented.
Qemu Vga Drivers For Macbook
- Mouse pointer is not visible initially (seen on Mac OS X but may happen elsewhere) but works anyway and pointer appears after changes shape e.g. when entering a Terminal window. This is likely due to the default hardware cursor implementation missing a cursor image change. There's an alternative implementation which can be selected with the guest_hwcursor=true property, so -device ati-vga,guest_hwcursor=true that may work better as it renders hardware cursor image differently (reading the guest bitmap when drawing the cursor instead of when cursor shape changes which is what the default guest_hwcursor=false implementation does).
Outstanding issues
- Colors are wrong with Linux framebuffer (#39387)
- Mouse pointer jumps around with guest_hwcursor=false (#39388)
- Video overlay is not implemented (needed for MorphOS Rage128 driver at least)
- Microengine/CCE/PM4 needs to be implemented (#40018)
Running Mac OS X as a QEMU/KVM Guest
Gabriel L. Somlo
See the old version of this page here.FINAL UPDATE (2018-10-21):I no longer have the cycles to work on this project. At this point QEMU and KVM are mostly capable of supporting OS X (up to Sierra), and the largest portion of the effort still required lies with edk2/ovmf (start with my fork on github as indicated below, and go from there).
Additionally, since Apple machines have become increasingly lockeddown and end-userunfriendly, I can't continue considering them for any upcoming hardware refresh (which is too bad, they used to make almost perfect Linux machines for the last 20 years!).
NOTE: Installer .iso images prepared based on Sierra 10.12.4 or later will hang during boot. However, guest images installed with 10.12.3 or earlier can successfully be upgraded, assuming the applesmc fix mentioned above is applied. The cause for this is as of yet unknown (to me, at least).
1. Prerequisites
You will need the following:- Tools: git, gcc[-c++], nasm, [auto]make, iasl, kernel-devel, etc.
- Linux kernel ≥ 4.7
- QEMU ≥ 2.6.0
- Patched OVMF firmware, built from source
2. Creating an OS X boot DVD iso image
SnowLeopard (10.6) was the last OS X version released in DVD format. Starting with Lion (10.7), an install DVD (.iso) image may be generated on an OS X machine by following the steps below (Thanks Dick Marinus for pointing out the Yosemite-specific updates!):First, create an empty hard drive image:Using the following command line, install OS X from the boot media created earlier (Thanks Jim Burns for the Penryn hint, which is needed instead of core2duo as of Sierra):In addition to the OVMF.fd firmware blob, the DVD image, and a blank hard drive image, you'll need to provide the value of OSK0 and OSK1, as a single concatenated 64-character string. If you own a Mac and run Linux on it natively (the license-compliant use case for the application of these instructions), you can retrieve them by compiling and running SmcDumpKey.c.Finally, to start your freshly installed guest, run:NOTE: If using qemu ≤ 2.8, substitute '-device usb-mouse' instead of '-device usb-tablet'. A patch to make the latter work with OS X (thanks to Phil Dennis-Jordan) only became available starting with version 2.9.0.4. Is This Legal?
Let me start with the obligatory disclaimer: I am not a lawyer, and this is not legal advice!We know that OS X is supported on commercial virtualization solutions such as VMWare Fusion and Parallels. Reading through Apple's EULA (which states that '[...] you are granted a [...] license to install, use and run one (1) copy of the Apple Software on a single Apple-Branded computer at any one time'), it appears everything is OK as long as the underlying hardware is made by Apple.What if the hypervisor OS is different than OS X? (both Fusion and Parallels both use OS X as the hypervisor OS). Well, it appears VMWare ESXi allows running OS X guests (presumably only if the hardware is, once again, manufactured by Apple). This is clearly an example of OS X running as guest on top of a non-OS X hypervisor, on top of Apple-manufactured hardware.So, it is my belief that, as long as I'm running a Linux/KVM hypervisor on a genuine Mac computer (which I've personally been doing exclusively since cca. 2006, btw), the license does not forbid me from running OS X as a VM guest on top of it.In terms of advice, all I can say is: Check with the legal and/or moral authorities in your local jurisdiction before trying this at home! :)Qemu Vga Drivers For Mac Os
5. Future Work
A few things still need work:Free Download Vga Drivers Xp
- OS X High Sierra (10.13) doesn't boot at this time. No idea yet if (and how) the new Apple filesystem (APFS) plays into this.
- None of QEMU's current audio devices appear to have native OS X driver support
- Screen resolution / resizing doesn't work
- Most importantly, the HFS+ EDK2 patches (and the OS X boot support ones which depend on HFS+) are rather far from being palatable to the upstream EDK2 project. A major refactoring of the HFS+ support is needed first; Then, cleaning up and upstreaming the OS X boot support work originally done by Reza Jelveh would be needed.
- Additional details on https://github.com/gsomlo/edk2 are needed for those interested. The repository contains three branches, stacked on top of each other: On top of the master branch (which tracks upstream, there's gls-hfsplus, containing the HFS+ driver in its current, fsw-based form. On top of that, there's gls-macboot containing Reza's hacks to get OS X to load, which will need to be cleaned up once we have a reliable upstream HFS+ filesystem. Finally, on top of everything, there's gls-miscopt, containing convenient hacks for everyday OSX use (e.g. forcing the default screen size to something a bit more useful). I (re)structured my clone of edk2 this way so that I can easily rebase things on top of upstream, while at the same time being able to bounce between filesystem driver development in gls-hfsplus and using OSX.