VESA X driver (and qemu)

Michael Tokarev mjt at tls.msk.ru
Sun Mar 25 00:07:32 PDT 2012


Hello.

For a long time already, linux plays quite, well,
unpleasant role in virtualization area, which may
sound surprizing at first.  The problem is the
graphics mode of linux _guest_ (virtual) system.

The issue is that, for some reason, X VESA driver
does not play well with - at least particular
implementation of - virtual VGA adaptor as exposed
to a guest by qemu/kvm (www.qemu.org, www.linux-kvm.org)

Up to today version of qemu[-kvm], linux as guest is
unable to use many video modes presented to the guest
by qemu and its vgabios, offering just built-in list
of 3 video modes (640x480, 800x600 and 1024x768 iirc).
For example, windows7 allows to choose from more than
20 different video modes in the same situation.

Somehow, X rejects all video modes it actually finds
listed by the video bios, and resorts to built-in list
of 3 modes based on "detected" screen size of 1024x768
pixels.  I don't know if such a thing even exists in
this context, since qemu will provide a "monitor" of
which matches the size (in pixels) of the resolution
choosen by the guest.  The Xorg.log resulting from
that is available at
http://www.corpit.ru/mjt/tmp/Xorg-qemu-nomodes.log

This issue - lack of useful video modes in linux guests -
was the main and very frequently heard complaint I've
seen about this issue.

But later on, 3 new "HDTV" video modes has been added
to the list of available modes in vgabios which is used
by qemu/kvm.  The source of this package is here:
http://savannah.nongnu.org/projects/vgabios

This commit:

 http://cvs.savannah.gnu.org/viewvc/vgabios/vbetables-gen.c?root=vgabios&r1=1.5&r2=1.6

added 3 new modes I mentioned.

The fun thing is that starting with this commit,
which just added new entries to an array of available
video modes, vesa X driver started behaving in a
different and weird way.

It now "detects" different screen size, which is 1280x768
(which is one of the new resolutions), and adds another
mode to the list of 3 previously available, which is
1280x720 (but not 1280x768).  The result is that now,
guest screen size is larger than the window, and the
missing parts can be scrolled to by moving mouse inside.
This is shown in
http://www.corpit.ru/mjt/tmp/Xorg-qemu-wrongmodes.log

Now, I don't know any internals of bios and video
drivers so it is difficult for me to even use the
right words to describe the problem.

I tried digging into x vesa sources, but immediately
discovered that the driver - apparently - does not
contain the code to detect screen size.  For example,
this line in the log:

 (--) VESA(0): Virtual size is 1280x768 (pitch 1280)

is not found in the source of xorg vesa driver, while
e.g this:

 (II) VESA(0): Setting up VESA Mode 0x18F (1280x720)

is present in the source.

So I'm not even sure if the issue is within vesa
driver in X or somewhere in X server itself.

Any hints on how to sort it all out?

Thank you!

/mjt



More information about the xorg-devel mailing list