Recent Changes

2019-08-18
2019-06-08
2019-02-11
2019-02-09
2019-02-08
2019-02-07

Wiki Guide

ATI VGA Emulation

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 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).

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.
  • 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)