Looking Glass - Triage

Oh yeah, there was one other thing that I was meaning to ask you. Is it possible to add more scan codes for keyboards with extra keys? For example, some keyboards have a little scroll bar/wheel that lets you adjust the volume. According to the output in looking glass, scan code 80 is volume up, scan code 81 is volume down, and scan code 7f is mute. Also some keyboards have media keys such as play/pause, stop, forward, and rewind. The scan codes for these are 105, 104, 102, and 103 respectively.

Perhaps, I have not looked at the spice keyboard code in over a year now. To be honest though you would be better off controlling the volume of your guest in the host under pavucontrol.

Ah, I see, just used to controlling the volume like that. Also is it normal for some windows to turn white for like a second when starting or closing out of looking glass?

Not in my experience, however you have not shared any information as to your hardware, you’re setup may simply be under powered.

Oh I see, well thanks for all your help. Hopefully everything’s fine, now off to fix the sound!

I will be live streaming a demo of the new c-host shortly with some game play included on twitch for anyone interested.

1 Like

Is this “XCA SHM” X11-only?

Yes, X11/xorg :). It’s not working yet though, it needs some TLC

1 Like

Thanks. Are you planning support for console (framebuffer) and Wayland in the future?

It’s capture interface is designed to allow for alternative capture means, if there is a way to do it, yes, I will do my best to add support.

1 Like

Just tried my hand at writing a filter for OBS for two reasons…

  1. To determine how hard it would be to write a LG capture plugin.
  2. I want to XOR overlaid text

Here is the end result:

6 Likes

Super excited to see your latest development work. Super awesome that you are open sourcing all this effort you are putting in. It would be interesting to see if virt-manager could pick up looking-glass as a display option along with vnc and spice.

Keep up the awesome work!

2 Likes

Hi, I hope this is the right place for questions?

I was wondering if there is any limit to how many LG clients or how big resolution I can run?
Or is everything fine as long as I have enough system RAM or GPU ram? Or is it related to host GPU display buffer?

Why - I plan setup:
Host Lnx, 8-16 cores, 64GB RAM, 3-4 GPUs. Single 4K display. I’m planning to use qemu+LG to have 3 VMs, some with 1080p /some 4K:
Guest 1 Win, 2C/4T pinned, 8GB RAM, 1 GPU
Guest 2 Lnx, same as above
Guest 3 Mac, same as above
Optional Guest 4 with Lnx

So should it be fine or this won’t be possible?
Thank you for great software!

This certainly will work, you will just have to create separate shared memory files for each. However, 4K under LG is slow due to the capture performance of DXGI Desktop Duplication.

Looking glass Linux guest support is currently very early and incomplete.

There is no mac support, nor is it planned.

1 Like

Hello, it happened again, last time I was having a problem where if I were to start looking glass. The tops/bars of some of the windows where the minimize, maximize, and close buttons are would disappear and the windows will be frozen in place. Right clicking the taskbar icons won’t do anything either and restarting the desktop environment doesn’t fix it, only a reboot will. I’ve tried checking dmesg when this happened and there are no errors or any red text saying that something went wrong, this happens randomly too. Also using version A12 of looking glass.

Any idea where the sweet spot for max resolution is? Ty

IIRC 1440p performance isn’t too bad.

1080p for 144 hertz or higher though.

2 Likes

Alright, first issue in a while. When I use LG for my display, it disconnects the VM audio in pulse. At this point, I have to cold boot the VM to fix it.

XML
<domain type='kvm' id='6' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>win10</name>
  <uuid>ab29d004-85b9-42a0-9adf-784e62e05d65</uuid>
  <metadata>
    <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
      <libosinfo:os id="http://microsoft.com/win/10"/>
    </libosinfo:libosinfo>
  </metadata>
  <memory unit='KiB'>16777216</memory>
  <currentMemory unit='KiB'>16777216</currentMemory>
  <memoryBacking>
    <hugepages/>
  </memoryBacking>
  <vcpu placement='static'>16</vcpu>
  <iothreads>4</iothreads>
  <cputune>
    <vcpupin vcpu='0' cpuset='0'/>
    <vcpupin vcpu='1' cpuset='16'/>
    <vcpupin vcpu='2' cpuset='1'/>
    <vcpupin vcpu='3' cpuset='17'/>
    <vcpupin vcpu='4' cpuset='2'/>
    <vcpupin vcpu='5' cpuset='18'/>
    <vcpupin vcpu='6' cpuset='3'/>
    <vcpupin vcpu='7' cpuset='19'/>
    <vcpupin vcpu='8' cpuset='4'/>
    <vcpupin vcpu='9' cpuset='20'/>
    <vcpupin vcpu='10' cpuset='5'/>
    <vcpupin vcpu='11' cpuset='21'/>
    <vcpupin vcpu='12' cpuset='6'/>
    <vcpupin vcpu='13' cpuset='22'/>
    <vcpupin vcpu='14' cpuset='7'/>
    <vcpupin vcpu='15' cpuset='23'/>
    <iothreadpin iothread='1' cpuset='8-9'/>
    <iothreadpin iothread='2' cpuset='10-11'/>
    <iothreadpin iothread='3' cpuset='12-13'/>
    <iothreadpin iothread='4' cpuset='14-15'/>
  </cputune>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-q35-3.0'>hvm</type>
    <loader readonly='yes' type='pflash'>/usr/share/edk2/ovmf/OVMF_CODE.fd</loader>
    <nvram>/var/lib/libvirt/qemu/nvram/win10_VARS.fd</nvram>
    <boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>
  <features>
    <acpi/>
    <apic/>
    <hyperv>
      <relaxed state='on'/>
      <vapic state='on'/>
      <spinlocks state='on' retries='8191'/>
      <vendor_id state='on' value='whatever'/>
    </hyperv>
    <kvm>
      <hidden state='on'/>
    </kvm>
    <vmport state='off'/>
  </features>
  <cpu mode='host-passthrough' check='none'>
    <topology sockets='1' cores='8' threads='2'/>
  </cpu>
  <clock offset='localtime'>
    <timer name='rtc' tickpolicy='catchup'/>
    <timer name='pit' tickpolicy='delay'/>
    <timer name='hpet' present='no'/>
    <timer name='hypervclock' present='yes'/>
  </clock>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>destroy</on_crash>
  <pm>
    <suspend-to-mem enabled='no'/>
    <suspend-to-disk enabled='no'/>
  </pm>
  <devices>
    <emulator>/usr/bin/qemu-kvm</emulator>
    <disk type='file' device='cdrom'>
      <driver name='qemu'/>
      <target dev='sda' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>
    <disk type='file' device='cdrom'>
      <driver name='qemu'/>
      <target dev='sdb' bus='sata'/>
      <readonly/>
      <alias name='sata0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/2000/win10-vda.img'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/2000/game-storage.img'/>
      <backingStore/>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
    </disk>
    <controller type='usb' index='0' model='ich9-ehci1'>
      <alias name='usb'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci1'>
      <alias name='usb'/>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci2'>
      <alias name='usb'/>
      <master startport='2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1'/>
    </controller>
    <controller type='usb' index='0' model='ich9-uhci3'>
      <alias name='usb'/>
      <master startport='4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x2'/>
    </controller>
    <controller type='sata' index='0'>
      <alias name='ide'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
    </controller>
    <controller type='pci' index='0' model='pcie-root'>
      <alias name='pcie.0'/>
    </controller>
    <controller type='pci' index='1' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='1' port='0x8'/>
      <alias name='pci.1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='2' model='pcie-to-pci-bridge'>
      <model name='pcie-pci-bridge'/>
      <alias name='pci.2'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
    </controller>
    <controller type='pci' index='3' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='3' port='0x9'/>
      <alias name='pci.3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
    </controller>
    <controller type='pci' index='4' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='4' port='0xa'/>
      <alias name='pci.4'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    </controller>
    <controller type='pci' index='5' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='5' port='0xb'/>
      <alias name='pci.5'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x3'/>
    </controller>
    <controller type='pci' index='6' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='6' port='0xc'/>
      <alias name='pci.6'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x4'/>
    </controller>
    <controller type='pci' index='7' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='7' port='0xd'/>
      <alias name='pci.7'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x5'/>
    </controller>
    <controller type='pci' index='8' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='8' port='0xe'/>
      <alias name='pci.8'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x6'/>
    </controller>
    <controller type='pci' index='9' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='9' port='0xf'/>
      <alias name='pci.9'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x7'/>
    </controller>
    <controller type='pci' index='10' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='10' port='0x10'/>
      <alias name='pci.10'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
    </controller>
    <controller type='pci' index='11' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='11' port='0x11'/>
      <alias name='pci.11'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
    </controller>
    <controller type='pci' index='12' model='pcie-root-port'>
      <model name='pcie-root-port'/>
      <target chassis='12' port='0x12'/>
      <alias name='pci.12'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
    </controller>
    <controller type='virtio-serial' index='0'>
      <alias name='virtio-serial0'/>
      <address type='pci' domain='0x0000' bus='0x0a' slot='0x00' function='0x0'/>
    </controller>
    <interface type='network'>
      <mac address='52:54:00:a4:e9:3e'/>
      <source network='default' bridge='virbr0'/>
      <target dev='vnet0'/>
      <model type='virtio'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
    </interface>
    <input type='mouse' bus='ps2'>
      <alias name='input0'/>
    </input>
    <input type='keyboard' bus='ps2'>
      <alias name='input1'/>
    </input>
    <graphics type='spice' port='5900' autoport='yes' listen='127.0.0.1'>
      <listen type='address' address='127.0.0.1'/>
      <gl enable='no' rendernode='/dev/dri/by-path/pci-0000:42:00.0-render'/>
    </graphics>
    <sound model='ich6'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x01' function='0x0'/>
    </sound>
    <video>
      <model type='none'/>
      <alias name='video0'/>
    </video>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x09' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev0'/>
      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x09' slot='0x00' function='0x1'/>
      </source>
      <alias name='hostdev1'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </hostdev>
    <hostdev mode='subsystem' type='pci' managed='yes'>
      <driver name='vfio'/>
      <source>
        <address domain='0x0000' bus='0x08' slot='0x00' function='0x0'/>
      </source>
      <alias name='hostdev2'/>
      <address type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
    </hostdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir0'/>
      <address type='usb' bus='0' port='1'/>
    </redirdev>
    <redirdev bus='usb' type='spicevmc'>
      <alias name='redir1'/>
      <address type='usb' bus='0' port='2'/>
    </redirdev>
    <memballoon model='virtio'>
      <stats period='5'/>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
    </memballoon>
    <shmem name='looking-glass'>
      <model type='ivshmem-plain'/>
      <size unit='M'>128</size>
      <alias name='shmem0'/>
      <address type='pci' domain='0x0000' bus='0x02' slot='0x02' function='0x0'/>
    </shmem>
  </devices>
  <seclabel type='dynamic' model='selinux' relabel='yes'>
    <label>system_u:system_r:svirt_t:s0:c635,c856</label>
    <imagelabel>system_u:object_r:svirt_image_t:s0:c635,c856</imagelabel>
  </seclabel>
  <seclabel type='dynamic' model='dac' relabel='yes'>
    <label>+1000:+107</label>
    <imagelabel>+1000:+107</imagelabel>
  </seclabel>
  <qemu:commandline>
    <qemu:env name='QEMU_AUDIO_DRV' value='pa'/>
    <qemu:env name='QEMU_PA_SAMPLES' value='8192'/>
    <qemu:env name='QEMU_AUDIO_ADC_FIXED_FREQ' value='48000'/>
    <qemu:env name='QEMU_PA_SERVER' value='unix:/run/user/1000/pulse/native'/>
  </qemu:commandline>
</domain>


I’m not really up-to-speed on the “passing guest audio to the host” situation, so I’m hoping someone can help me out here.

I found that using the scream audio driver works WONDERFULLY pushing the audio over the network with no perceivable latency. Been doing this for months.

Scream

What I do on my Linux side of things is just start the scream listener on the bridge interface that the VM is getting its networking from and throw it in the background. I have a script that sets permissions, starts the vm, starts the scream listener, and launches looking glass.

sudo touch /dev/shm/looking-glass
sudo chown $USER:kvm /dev/shm/looking-glass
sudo chmod 660 /dev/shm/looking-glass
virsh start Windows10 &
./scream-pulse -i virbr0 &
./looking-glass-client -F -j

of course there is more logic in the script to put delays and what not to make sure the machine is booted before launching all this, but that’s the gist.

2 Likes

Hello !
I am still having a performance regression between the a11 and A12 version of Looking Glass :slight_smile:

My specs :
9700K, 6 cores to the guest and 2 for the host (I tried 4/4, it did not change anything)
2080 TI
1920*1080 @ 60 FPS
Asrock Z390 Phantom Gaming ITX/AC
Archlinux as the host OS. I’m not using the AUR package for the client, but compiled it from the sources on github.

Native (Screen directly connected to the GPU) : 1046 Cinebench score
A11 : 966 cinebench score, no difference in gaming
A12 : 841, but suddenly all games lose a ton of fps, WoW can’t maintain 60 locked fps anymore and goes down to 40/45, more modern games like Assassin’s Creed Odyssey become unplayable, etc.
CPU usage of the host application is normal : 2.4%.
I get my framerate back as soon as I close the client application on Linux side.

Here is my .xml in case there is something wrong with my configuration :
https://hastebin.com/ezewoginav.xml

Is there something else I could investigate ?