š¾ Archived View for gemini.mcgillij.dev āŗ looking_glass.gmi captured on 2022-07-16 at 13:50:37. Gemini links have been rewritten to link to archived content
ā¬ ļø Previous capture (2022-03-01)
-=-=-=-=-=-=-
:author:
mcgillij
:category:
Virtualization
:date:
2020-12-30 22:32
:tags:
Linux, VFIO, Virtualization, Tutorial, BIOS, LookingGlass, #100DaysToOffload
:slug:
looking-glass-vfio
:cover_image:
lg.png
:summary:
Basic Looking Glass setup
is at two part application that uses a shared memory device, that allows dumping of a framebuffer through the PCI bus to be rendered by a secondary GPU.
This is a fancy way to say you can have Windows powered by a secondary GPU rendered in your Host OS as either a window or full-screen with very little overhead or latency.
1. Setup your "/dev/shm/looking-glass"
2. Install the **client** in your Host OS.
3. Configure your Guest VM to use the **shm** device
Setting up Looking Glass is very straight forward, and they put together a really great
on their homepage. I highly suggest following along with their directions.
However it seems that thereās always a bit of confusion as to how the various components are named and what you should be downloading and installing where.
Iāll briefly describe the steps involved with setting up Looking Glass as some of the pieces are named in a way that sounds more complicated than it actually is.
If your rendering a guest between "1920 x 1080" or "2560 x 1440" youāll need **32mb** otherwise larger resolutions should create a device **64mb** in size.
Use systemd to create a your shared memory device, create a file located at "/etc/tmpfiles.d/10-looking-glass.conf" with the following content:
f /dev/shm/looking-glass 0660 yourusernamehere kvm -
Replace āyourusernamehereā with your own user, this will make sure that your device gets recreated at boot time. Now you can create it right away with the following command, as to not have to reboot right away.
systemd-tmpfiles --create /etc/tmpfiles.d/10-looking-glass.conf
Follow the compiling directions for your distribution and make sure you install the dependencies first. Directions for compiling can be found here in the
.
Once itās compiled make sure to grab the binary and fire it in your "PATH" somewhereās so you can use it later.
Next up we will want to add the device to your virtual machineās configuration. This can be done with the following command:
virsh edit win10
Where **win10** is your virtual machine configuration name. Add the following block near the bottom above the end "</devices>" section.
<shmem name='looking-glass'> <model type='ivshmem-plain'/> <size unit='M'>64</size> <address type='pci' domain='0x0000' bus='0x09' slot='0x01' function='0x0'/> </shmem>
Make sure to swap out the value with the one determined above (32 or 64) in the previous step. Now a Ram Drive will show up in your Windows guest the next time we boot it up and youāll need to install the
for it.
Boot up your Guest and install the VirtIO Ram Drive driver, you can find the driver
.
Download and install the **Looking Glass āhostā Windows application** from the looking glass site inside your Guest and make sure itās the same version as you compiled the āclientā for in your Host OS.
So looking glass has 2 components:
The **LG_Host** running in your VM will dump the frames to be rendered to the shared memory device, and you can use a the **looking-glass-client** to render those frames in either the *Host OS* or another *Guest VM* depending on what type of setup your running.
Finally you will want to change your display type to **none** from QXL in *virt-manager* to allow the **looking-glass-client** to take over responsibility for displaying output from the VM.
Looking glass installs the the host application as a Windows service, so it should be started when the VM boots up.