QEMU-hosted Haiku: High Display Resolution or Custom Resolution?

I’m trying to host Haiku OS inside QEMU KVM (I’m using virt-manager with it because its what the Haiku docs said to use) and I have a 2560x1440 monitor which I’d like to make full use of. I’ve tried all of QEMU’s available graphics drivers (Xen, Serrius, QXL, VGA, VMVGA, etc) and none of them have the correct resolution, which seems strange to me because its a quite common resolution on modern monitors. My old laptop had the same resolution as well (the new one is 4K, heaven forbid I try to get Haiku working there!).

I’d really like to make Haiku a workable development environment, I already have Spacemacs working and a nice little dev setup, so maybe I could contribute to the community somehow. Honestly, Haiku is one of the coolest OS ideas I’ve ever seen, and its actually really making progress and gaining attention, so I’m trying to see how much of my development environment I can transfer to it. Part of that is having a correct resolution, I’d like to avoid just choosing 1920x1080 and having QEMU scale up.

I’ve already tried doing this at the QEMU end the only way I could think of (following this link: https://www.tablix.org/~avian/blog/archives/2013/05/custom_display_resolutions_in_qemu/) but that’s for a very old version of QEMU and the VGA roms are nowhere to be found in the modern source tree.

Can anyone help? Thanks!

The VGA roms are part of SeaBIOS most likely.

You might try VirtualBox as that actually has a method of doing this without recompiling.

This is the code QEMU uses for the vga bios it ships with binaries built out of tree.
https://git.qemu.org/?p=seabios.git;a=summary

Thanks, I’l try VirtualBox. I heard there were bugs in VirtualBox that Haiku couldn’t deal with, anything I should know about?

Nope, maybe sound is flakey other than that no… you may want to run a version that matches the guest extensions. Also the guest extensions were a bit out of date you might want to check the haiku depot website to see which versions are available on which haiku built platforms.

If you can get the guest extension to work you should get automatic mouse grabbing and resolution changes more seamlessly I think.

VirtualBox works completely for my Haiku. Lots of instructions on the web site, list of posts at https://www.haiku-os.org/tags/virtualbox/ including some on setting custom video modes. Main points: SATA hard drive in AHCI mode, having only one CPU is unintuitively much faster.

Choosing a single CPU seems unfortunate, in light of the fact that Haiku is very multithreaded?

That sounds like a bug… as when running Linux on a Vbox windows host, even adding hyperthreaded cores to the VM increases performance in most cases (detrimental to the host however).

More than one core is definitely faster for QEMU, though it may reduce single threaded performance slightly. Note you should --enable-kvm with QEMU otherwise it will run all the cores on a single thread.

Note: I just checked and if you allocate 1 core to Haiku in my VM madelbrot would render the area I selected in about 40 seconds with 16k iterations. 2 cores no benefit though half the mandelbrot finished much faster, 4 cores split it up enough that it was able to finish in half the time that 1 core was able to do it. Note this PC only has 2 real cores and 2 hyperthreaded cores.

Haiku is multithreaded so even with one CPU the user interface will still be snappy when a program is busy doing something (unless they fiddled with the task priorities - unusual).

Though with real hardware, it will be able to have a core for each thread, making the actual work part of the job go faster, and the UI will still feel great. The subtle drawback is that some bugs only show up when you have multiple cores trying to do something at the same time.

No, it’s that VirtualBox has some bug in their IO-APIC implementation which results in seriously degraded performance with more than one core. VMware, QEMU/KVM, etc. are just fine.

I just updated my comment, I imagine there is some slight degradation in certain cases but having 4 cores enabled is certainly faster than 1 by a very large margin in most cases, appears to be so for Mandelbrot, and I know it’s about a 2x+ speedup in Gentoo when compiling.

Mouse (trackpad) is flakey for me in VirtualBox. It doesn’t matter if Linux or Windows is the host.

Yesterday i tried recompiling Seabios roms manually adding a couple of custom resolutions and it’s working fine. The tutorials online are outdated but the idea behind still works. What i did is: downloaded the source of the current QEMU version I’ve installed in my system. Edited the resolutions tables, there a two:
roms/seabios/vgasrc/bochsvga.c and roms/seabios/vgasrc/cbvga.c. In my case for example i added 1440p resolution with: { 0x193, { MM_DIRECT, 2560, 1440, 32, 8, 16, SEG_GRAPH } }, at the end of the table definition.
To build the roms you’ll need to go to roms/seabios, run make vgabios, then take the bin files created in the folder pc-bios located in the root directory of the QEMU source folder and copy them to the roms location in your distro ( in openSUSE is /usr/share/qemu/ ).

KVM performance is way better than VirtualBox, so this is worth it.
Hope it helps someone.

1 Like

Thanks, could be useful to me in the future.

Have you tried qemu’s vgastd coupled with spice?
I’m running Haiku w/ qemu-kvm under Fedoa Linux w/ 4 cores, 6GB, and vgastd VGA display card, and all resolutions up to 2560x1440 are available and working.

However, draw performance leaves much to be desired.

  • Gilboa

I did not have 1440p available with any driver. Currently i’m using SPICE+QXL, the performance is decent but much slower than running on real hardware. I think is the fastest config i tried, but i’m not sure if there’s something better.