Guests 3D acceleration

Today, I would like to spend more time with 3D acceleration for guests.

You always need more electricity

In September last year, I bought an electric car, a e-Mehari:

s1-presentation-video-citroen-e-mehari-vamos-a-la-playa-367978

This is a very cool car. But like most electric cars, it actually uses electricity. A lot of electricity. So while it’s really nice to always have a car that is topped off just by plugging it at home, the downside is that since we had the car, we frequently lost power at home just when trying to cook or having the washing machine and the dryer running at the same time, because the car alone required about half of my allotted wattage.

Losing power regularly is a good way to age your hard disks pretty rapidly. So this morning, we finally had our electricity meter upgraded. Hopefully, I should no longer fear dinner time… 🙂

Minor Spice patches

Patch review raised an interesting issue about how to check for error messages in virt-viewer. The question is whether error->message can ever be NULL when we dereference it (where error is some GError pointer). In any normal use of g_error_new, I see no reason message would ever be NULL. But defensive coding led me to send another patch that addresses this possibility.

Spice on Mac

Compiling Spice on Mac from git sources is not completely straightforward.

spice-protocol

No issue there. Running autogen.sh, make, make install does the right thing. I will need to run that in a macOS clean VM, because there are good chances that this won’t work without some additional tools that don’t come standard on macOS, like autoconf.

spice

This one does not work out of the box:

> ./autogen.sh 
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force -I m4
Use of uninitialized value $msg in concatenation (.) or string at /usr/local/Cellar/autoconf/2.69/bin/autom4te line 1026.
Use of uninitialized value $stacktrace in pattern match (m//) at /usr/local/Cellar/autoconf/2.69/bin/autom4te line 1026.
unknown channel m4trace: -1- AS_VAR_APPEND(ac_configure_args, " '$ac_arg'")
 at /usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/Channels.pm line 638.
    Autom4te::Channels::msg('m4trace: -1- AS_VAR_APPEND(ac_configure_args, " \'$ac_arg\'")\x{a}', undef, 'warning: ', 'partial', 0) called at /usr/local/Cellar/autoconf/2.69/bin/autom4te line 1026
aclocal: error: echo failed with exit status: 1
autoreconf: aclocal failed with exit status: 1

Hmm, that does not look too good… We are deep in Perl code somewhere in autom4te. Probably something for another day.

GitHub

Started forking the interesting projects on GitHub. I’m still waiting for an account on freedesktop.org, and meanwhile, I’d rather have a place where to push things.

Virtual machine for 3D acceleration

Trying again to setup a 3D-accelerated VM. This time, I’m following these instructions, except that since the VM I was interested in was under qemu:///system, I used that instead of qemu:///session:

$ virt-xml --connect qemu:///system fedora3D --confirm --edit --video clearxml=yes,model=virtio,accel3d=yes
$ virt-xml --connect qemu:///system fedora3D --confirm --edit --graphics clearxml=yes,type=spice,gl=on,listen=none

Well, it does not work. I ran into this bug. So time to try agin, this time with the correct changes:

$ virt-xml --connect qemu:///session fedora3D --confirm --edit --video clearxml=yes,model=virtio,accel3d=yes
$ virt-xml --connect qemu:///session fedora3D --confirm --edit --graphics clearxml=yes,type=spice,gl=on,listen=none

Apparently, using the session limits me to user networking. I need to dig a bit deeper to understand this.

Tao3D updates

Made a few changes to Tao3D for compilation on Fedora 25 and with GCC 6. This code has not been maintained in over a year, and it shows. Finally got it to compile successfully, but it does not work very well.

The optimized build crashes in libxlr. The debug build works for a short while, and then dies with a std::bad_alloc() being thrown from QMessageLogger::warning. There is no code belonging to Tao3D in the call stack leading to the exception, which is a bit annoying.

However, the good news is that after a bit more fiddling, I finally got Tao3D to run in a 3D-accelerated guest, and with acceptable speed. Still some too-frequent crashes, notably as soon as I resize a window but overall, good enough to call it a day!

screen-shot-2017-02-09-at-22-19-32

Advertisements

Author: Christophe de Dinechin

I try to change the world, but that's work in progress. If you want to know me, google "Christophe de Dinechin". Keywords: concept programming, virtualization, OS design, programming languages, video games, 3D, modern physics. Some stuff I did that I'm proud of: the first "true" 3D game for the PC, HP's big iron virtualization, real-time test systems for car electronics, some of the best games for the HP48 calculator, a theory of physics that makes sense (at least to me).

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s