# How to configure Xorg with qxl-driver/xspice on kvm + virt-manager



## granttrec (Jan 31, 2018)

Hello everyone, I am newbie and interested in FreeBSD(11.1), so I decided to try it out on a virtual machine (kvm). The install was simple, but I seem to have hit a wall trying to install and configure Xorg.

As per the handbook (and other sources), I installed Xorg using ports.
`cd /usr/ports/x11/xorg && make install clean`

I checked if the HAL was used by X server: `# pkg info xorg-server | grep HAL`, the output says HAL is off. Then I run `startx` (the xf86-video-qxl driver is installed).

My screen is filled with:


```
[ 10830.268] qxl_surface_create: Bad bpp: 1 (1)
[ 10830.269] qxl_surface_create: Bad bpp: 1 (1)
.
.
.
```

Here is the log file from that attempt: https://paste.ee/p/O28CQ

I have also tried to set the video driver in the file (/etc/X11/xorg.conf and /usr/local/etc/X11/xorg.conf.d/drivers-scfb.conf):


```
Section "Device"
 Identifier "qxl"
 Driver "qxl"
 Option "ENABLE_SURFACES" "False"
EndSection
```

However this just results in a blank screen. Here is the log file from that attempt: https://paste.ee/p/7OVkV

Xorg complains that the modules don't exist, however /usr/local/lib/xorg/modules/drivers/spiceqxl_drv.so exists. I have also configured xorg manually* with `# Xorg --configure` but that had no effect. What are my next steps?

*Note just created the skeleton config file, was not a full manual configure.

Edit - Reading the log and I notice this:

```
[ 10829.508] (II) LoadModule: "spiceqxl"
[ 10829.509] (II) Loading /usr/local/lib/xorg/modules/drivers/spiceqxl_drv.so
```

Is there any way I can get it to load qxl instead?


----------



## Ole (Feb 1, 2018)

QXL uses its own configuration file located in the _/usr/local/etc/X11/xorg.conf.d/spiceqxl.xorg.conf_ directory
The best way to start and test Xorg with an QXL is to run it through a Xspice wrapper ( which by default creates a temporary configuration file for Xorg automatically ):


```
Xspice --disable-ticketing --xsession /usr/local/bin/fluxbox :1 --port 5900
Xspice --disable-ticketing --xsession /usr/local/bin/xterm :1 --port 5900
```

After connecting through the Spice client, you will need to adjust the screen resolution using xrand for qxl-0 device:

```
xrandr
xrandr --output qxl-0 --mode 1280x1024
```


----------



## granttrec (Feb 2, 2018)

Ole said:


> QXL uses its own configuration file located in the _/usr/local/etc/X11/xorg.conf.d/spiceqxl.xorg.conf_ directory
> The best way to start and test Xorg with an QXL is to run it through a Xspice wrapper ( which by default creates a temporary configuration file for Xorg automatically ):
> 
> 
> ...



Thanks for replying! I think I might be misunderstanding something since I could not get past the first command.
Here are the error logs, one as root, and the other as a regular user:
(I'm pretty sure these are the same)
https://paste.ee/p/dklJb
https://paste.ee/p/c84tY

Also was it necessary to use fluxbox? I tried twm but that didn't work either. I did a package install for fluxbox if that makes any difference.


----------



## granttrec (Feb 4, 2018)

I managed to get at the root of the problem. Recompiled xorg-server with gcc.


----------



## Ole (Feb 5, 2018)

It seems that the session has started, but there is no image.
I got a similar behavior when I work on a libspice server port: https://www.spinics.net/lists/spice-devel/msg32190.html
But they were not found in the final version of the ports (in my test). 
In addition, some WM (for example, Gnome3 session or KDE) restart the Xorg video settings at startup (and they can not always determine the resolution - so I ran this WM with xterm)
It looks like the problem has remained and it is floating. Need more time to investigate this problem


----------



## thebardian (Feb 16, 2018)

Just stopping by to report that I too face this issue when running freebsd 11.1 under kvm/qemu/libvirt using spice on the host machine and xf86-video-qxl on the guest, as well as using xorg-server compiled with gcc did not help.


----------

