32bpp in XenServer virtual machine

Written by Ingmar Verheij on June 22nd, 2012. Posted in XenServer

Recently I had to setup a virtual machine on a Citrix XenServer host that could use 32bpp. This turned out harder than I thought because the default video adapter in a Xen virtual machine is a Cirrus with 4MB, and that video card is not capable of 32bpp.

To be honest when I read Cirrus I had a flash-back to the times I bought my first computer; a 386SX 33Mhz with 2MB RAM and a Cirrus VGA card (on a ISA interface if I’m not mistaking).

 

Adding video memory

I thought hoped it would be easy to just add some video memory with xe vm-param-set but couldn’t find a parameter to configure. In fact, there isn’t (yet).

There is method described but this will affect all virtual machines on the same XenServer host, it is described below (qemu-dm-wrapper). Knowing it is possible to ‘swap’ the videocard in a virtual machine and adding video memory by adding parameters to the QEMU (open source machine emulator and virtualizer) process.

A Xen virtual machine consist of two processes and can be found with ps aux | grep qemu

When the video adapter is ‘swapped’ the result of the ps command is:

As you can see two parameters are added:

  • -std-vga  (use ‘standard’ video card, instead of the cirrus)
  • -videoram 4 (set 4MB of video ram)

Since there is no configurable parameter per VM (xe vm-param-set) I looked for a solution to inject the parameter via another parameter. In github.com I found the xenops.ml file that launched the qemu-dm-wrapper script. Here I found three possible candidates:

  • static_max_kib;
  • boot;
  • vcpus.

Since both static_max_kib and vcpus are integer values there was no way I could add the parameter (-std-vga –videoram 4), but boot… let’s give it a shot!

Don’t try this at home/office/wherever, it doesn’t work (spoiler alert)

I added the parameters to the boot priority (default=dc: 1) cd-rom [d] and then 2) hdd ([c]) parameter of the virtual machine…

…and started the virtual machine. Nothing happened, the VM could not be started. The /var/log/messsage logfile should me why.

There is a check builtin the vl.c that verifies each boot option, a space is not allowed as a boot option.

I’ve run some more test but it all came to a death end…

…until I found a pull request from David Scott (XenServer System Architect at Citrix Systems) with the name ‘Add platform options for HVM display adapter and videoram’.  So there will be a configurable parameter per VM that enable you to specify which video adapter to use and how many video ram it has. It has even been merged in the Xen code! On my XenServer 6.0.12 the parameters didn’t work so I assume they’re not included the XenServer code (yet).

I’ve sent David an e-mail to ask him if and when it will be included in Citrix XenServer. To be continued!?!

 

qemu-dm-wrapper

You can add the parameters to the QEMU process by altering the qemu-dm-wrapper file, which can be found in the /opt/xensource/libexec directory of the XenServer host.

Keep in mind this will change the behaviour of ALL virtual machines running on this (and only on this ) XenServer host .

  1. Locate the line def main(argv):
  2. Below you will find a line that lookes like qemu_args = [‘qemu-dm-%d’%domid] + argv[3:] (this is different for XenServer 5 / 6 / etc.)
  3. Immediately after that line add the following lines:
    • qemu_args.append(‘-std-vga’)
    • qemu_args.append(‘-videoram’)
    • qemu_args.append(‘4’) << you can increase the video memory if you want

    Now each virtual machine that gets started will receive a ‘standard’ VGA adapter instead of a Cirrus. Most importantly (for me), 32bpp is available.

Ingmar Verheij

At the time Ingmar wrote this article he worked for PepperByte as a Senior Consultant (up to May 2014). His work consisted of designing, migrating and troubleshooting Microsoft and Citrix infrastructures. He was working with technologies like Microsoft RDS, user environment management and (performance) monitoring. Ingmar is User Group leader of the Dutch Citrix User Group (DuCUG). RES Software named Ingmar RES Software Valued Professional in 2014.

More Posts - Website

Follow Me:
TwitterLinkedInGoogle Plus

Tags: , , , ,

Comments (1)

  • 25 May 2014 at 08:48 |

    At Citrix Blogs a post was added which described how to change the videocard (and memory) in a much easier way:
    http://blogs.citrix.com/2014/05/12/from-my-virtual-desktop-using-standard-vga-instead-of-cirrus/

    “1. Halt your VM

    2. From the command line, find the UUID of your VM:
    xe vm-list name-label=”Name of your VM”

    3. Taking the UUID value, run the following two commands:
    xe vm-param-set uuid= platform:vga=std
    xe vm-param-set uuid=
    platform:videoram=4

    Restart your VM and presto. You should now be able to achieve 32bpp. AND as for the videoram, the max value is 16MiB (just because the max is 16MiB doesn’t mean you need to use it).”

Leave a comment

*

Donate

%d bloggers like this: