.. _installing: Installation ############ .. _libvirt: libvirt/QEMU Configuration: --------------------------- This article assumes you already have a fully functional libvirt domain with PCI passthrough working. If you use virt-manager, this guide also applies to you, since virt-manager uses libvirt as its back-end. .. _libvirt_ivshmem: IVSHMEM ^^^^^^^ Configuration ~~~~~~~~~~~~~ .. note:: If your host GPU is either AMD or Intel it is better to set this up using the KVMFR kernel module as this will allow you to make use of DMA transfers to offload some of the memory transfers to the GPU. See `VM->host` in :ref:`kernel_module`. Add the following to your libvirt machine configuration inside the 'devices' section by running ``virsh edit `` where ```` is the name of your virtual machine. .. code:: xml 32 .. note:: If you are using QEMU directly without libvirt the following arguments are required instead. Add the following to the commands to your QEMU command line, adjusting the ``bus`` parameter to suit your particular configuration: .. code:: bash -device ivshmem-plain,memdev=ivshmem,bus=pcie.0 \ -object memory-backend-file,id=ivshmem,share=on,mem-path=/dev/shm/looking-glass,size=32M The memory size (show as 32 in the example above) may need to be adjusted as per the :ref:`Determining Memory ` section. .. warning:: If you change the size of this after starting your virtual machine you may need to remove the file `/dev/shm/looking-glass` to allow QEMU to re-create it with the correct size. If you do this the permissions of the file may be incorrect for your user to be able to access it and you will need to correct this. See :ref:`libvirt_shmfile_permissions` .. _libvirt_determining_memory: Determining Memory ~~~~~~~~~~~~~~~~~~ You will need to adjust the memory size to be suitable for your desired maximum resolution, with the following formula: ``width x height x pixel size x 2 = total bytes`` ``total bytes / 1024 / 1024 = total megabytes + 10`` Where `pixel size` is 4 for 32-bit RGB (SDR) or 8 for 64-bit (HDR :ref:`* `). Failure to do so will cause Looking Glass to truncate the bottom of the screen and will trigger a message popup to inform you of the size you need to increase the value to. For example, for a resolution of 1920x1080 (1080p): ``1920 x 1080 x 4 x 2 = 16,588,800 bytes`` ``16,588,800 / 1024 / 1024 = 15.82 MB + 10 = 25.82 MB`` You must round this value up to the nearest power of two, which for the provided example is 32MB. .. note:: Increasing this value beyond what you need does not yield any performance improvements, it simply will block access to that RAM making it unusable by your system. .. list-table:: Common Values :widths: 50 25 25 :header-rows: 1 * - Resolution - Standard Dynamic Range - High Dynamic Range (HDR) :ref:`* ` * - 1920x1080 (1080p) - 32 - 64 * - 1920x1200 (1200p) - 32 - 64 * - 1920x1440 (1440p) - 32 - 64 * - 3840x2160 (2160p/4K) - 128 - 256 .. _libvirt_determining_memory_hdr: .. warning:: While Looking Glass can capture and display HDR, at the time of writing neither Xorg or Wayland can make use of it and it will be converted by the GPU drivers/hardware to SDR. Additionally using HDR doubles the amount of memory, bandwidth, and CPU load and should generally not be used unless you have a special reason to do so. .. _libvirt_shmfile_permissions: Permissions ~~~~~~~~~~~ The shared memory file used by IVSHMEM is found in ``/dev/shm/looking-glass``. By default, it is owned by QEMU, and does not give read/write permissions to your user, which are required for Looking Glass to run properly. You can use `systemd-tmpfiles` to create the file before running your VM, granting the necessary permissions which allow Looking Glass to use the file properly. Create a new file ``/etc/tmpfiles.d/10-looking-glass.conf``, and populate it with the following:: #Type Path Mode UID GID Age Argument f /dev/shm/looking-glass 0660 user kvm - Change ``UID`` to the user name you will run Looking Glass with, usually your own. .. _libvirt_spice_server: Keyboard/Mouse/Display/Sound ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Looking Glass makes use of the SPICE protocol to provide keyboard and mouse input, sound input and output, and display fallback. .. note:: The default configuration that libvirt uses is not optimal and must be adjusted. Failure to perform these changes will cause input issues along with failure to support 5 button mice. If you would like to use Spice to give you keyboard and mouse input along with clipboard sync support, make sure you have a ```` device, then: - Find your ``