.. _multimonitor: Multiple Monitors ################# A guest with several displays can be carried over a single Looking Glass session. The host packs every display into one frame, and the client composes that frame back into the guest's desktop. .. _multimonitor_how_it_works: How it works ------------ Running one Looking Glass instance per guest display would mean one shared memory device, one host process and one capture pipeline each. Instead the host places all displays side by side into a single frame, called the **atlas**, and describes the arrangement in the frame's metadata. The atlas is not a picture of the guest's desktop. Displays are packed to waste as little space as possible, so a display's position in the atlas usually has nothing to do with where it sits on the guest's desktop. The metadata records both rectangles for each display: * where its pixels are in the packed frame * where it belongs on the guest's virtual desktop The client uses that to compose the desktop before anything else happens, so scaling, HDR, the cursor and damage tracking all work on one ordinary image and behave exactly as they do for a single display guest. Nothing changes for a single display guest. Such frames carry no layout, and both host and client take the same path they always have. .. _multimonitor_host: Host configuration ------------------ Multi-monitor capture is enabled by default on capture backends that support it. To turn it off and capture only as a single display: .. code:: text dxgi:multiMonitor=no xcb:multiMonitor=no Supported backends: * ``DXGI`` (Windows) duplicates every attached output on the chosen adapter and composes them on the GPU. It falls back to capturing a single display if the outputs cannot be combined safely — if their capture formats differ, which happens when one monitor is HDR and another is not, or if any output is rotated. The reason is always logged. * ``XCB`` (Linux) enumerates RandR monitors and packs them. Backends that do not implement it capture a single display exactly as before. .. warning:: The DXGI implementation has not yet been run on real multi-monitor hardware. If you hit trouble, set ``dxgi:multiMonitor=no`` to confirm the fault lies there, and see ``MULTIMONITOR.md`` beside the DXGI source for what each symptom points at. .. note:: All displays are sent as one frame, so they share a single frame rate. Monitors of differing refresh rates cannot update independently: the fastest is limited by the frame rate the host achieves for the whole atlas. .. _multimonitor_shm_size: Shared memory sizing ^^^^^^^^^^^^^^^^^^^^ **This is the setting most likely to catch you out.** The atlas holds every display, so it needs considerably more shared memory than a single display would. If the shared memory is too small the frame is truncated and the client reports how much is required. Estimate the requirement as:: total pixels of all displays x 4 bytes x 2 frames Then round up to the next power of two. For example, three 1920x1080 displays:: 3 x 1920 x 1080 x 4 x 2 = 49.8 MB -> 64 MB Three 4K displays need 256 MB, and larger or mixed sets can need more. Packing is rarely perfect when displays differ in size, so allow some headroom. The host logs the atlas size at startup: .. code:: text Multi-monitor : 3 monitors, desktop 5760x1080, atlas 1920x3240 .. _multimonitor_client: Client configuration -------------------- By default the client shows the entire guest desktop, with the displays arranged as the guest has them: .. code:: text app:display=all To show a single guest display, give its index or its name as the host reported it: .. code:: text app:display=1 app:display=DP-2 If the selection matches no display the client logs the available displays and falls back to showing the whole desktop. .. _multimonitor_one_window_per_display: One window per guest display ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Several clients can subscribe to the same host at once, so a natural way to use a multi-monitor guest is to run one client per display and put each on its own physical monitor: .. code:: bash looking-glass-client app:display=0 win:fullScreen=yes & looking-glass-client app:display=1 win:fullScreen=yes & looking-glass-client app:display=2 win:fullScreen=yes & Each instance receives the same packed frames and crops its own display, so the guest is captured and transferred only once no matter how many clients are watching. .. _multimonitor_input: Input ----- The guest positions its cursor across the whole virtual desktop, so the client translates between the region it is showing and that desktop. This happens automatically, including when a single display is selected. Be aware that when showing one display of several, the guest's cursor can move onto a display you are not watching, and will appear to vanish. Show the whole desktop, or run a client per display, if that is a problem. .. _multimonitor_limitations: Limitations ----------- * At most 8 guest displays. * The packed frame cannot exceed 16384 pixels on any edge, which is the texture size limit on current hardware. Very large display sets may not fit. * Damage tracking is per frame rather than per display once composed, so a multi-monitor session redraws the whole view each frame. Frame transfer still honours damage, so the cost is on the client's GPU rather than the link. * All displays are captured and sent even when the client is showing only one of them.