Custom display resolutions in QEMU
QEMU emulates a VESA-compliant VGA card that supports a static set of standard and a-bit-less-standard display resolutions. However, this set is far from universal and for example doesn't include the wide-screen 1600x900 resolution on my laptop. This means that running a virtualized OS full-screen would always stretch the display somewhat and give a blurry image.
Here's how I fixed that. Following instructions should pretty much work for adding an arbitrary resolution to QEMU's virtualized graphics card (but only when using -vga std). They are based on this patch.
Fetch QEMU source (I used 1.4.0) and edit roms/vgabios/vbetables-gen.c. For instance, to add 1600x900 I applied this patch:
Update: this patch still works for QEMU release 2.5.0. If you are using a git checkout instead of the release tarball, see comments below.
--- qemu-1.4.0.orig/roms/vgabios/vbetables-gen.c 2013-02-16 00:09:22.000000000 +0100 +++ qemu-1.4.0/roms/vgabios/vbetables-gen.c 2013-05-04 11:46:55.000000000 +0200 @@ -76,6 +76,9 @@ { 2560, 1600, 16 , 0x18a}, { 2560, 1600, 24 , 0x18b}, { 2560, 1600, 32 , 0x18c}, +{ 1600, 900, 16 , 0x18d}, +{ 1600, 900, 24 , 0x18e}, +{ 1600, 900, 32 , 0x18f}, { 0, }, };
Now re-build the VGA BIOS binary image (apt-get install bcc first):
$ cd roms/vgabios $ make stdvga-bios
QEMU's make install will not install the image you just built. Instead, it will use an already built binary they ship with the source. Therefore you have to install it manually:
$ cp VGABIOS-lgpl-latest.stdvga.bin $PREFIX/share/qemu/vgabios-stdvga.bin
Of course, replace $PREFIX with the prefix you used when installing QEMU (/usr/local by default). Now when you start a virtualized OS you should see the resolution you added to vbetables-gen.c (for example as reported by xrandr or under Screen resolution in Windows).
This was very useful, thx.