2024-03-04 - Looking Glass News

The long belated Looking Glass Beta 7 release is almost here, with a huge list of improvements and quality of life changes.

We will start release candidates soon for B7, but if you want to know what changes are coming, or wish to jump the gun and upgrade to Bleeding Edge, below are some of the major changes you have to look forward to:

DirectX12

As many of you might be aware, LG has had a D3D12 back end in the DXGI capture interface for a while now. Unfortunately this back end has always been bugged with some synchronisation issues that have caused all sorts of issues which is why we never encouraged it’s use and disabled it by default.

With a few recent discoveries and misuses (abuses?) of the DirectX12 API, we have found a way to create a ID3D12Resource (DX12’s version of a texture) that is directly backed by memory we provide. As such we can create this texture directly inside the IVSHMEM shared memory, and then use the GPUs hardware copy engine to stream the textures directly from GPU directly into the shared memory segment.

We have been looking for a way do to this since the creation of this project, not only does it remove an additional memory copy, it offloads the copy we still need to perform from the GPU’s render and compute engine.

Note: D12 still is using Microsoft’s DXGI layer, but in a very different way, so it’s still technically DXGI. It was just unfortunate that I named the capture interface DXGI in Looking Glass in the first instance, confusing things.

What does all this mean for you?

Lower latency, higher frame rates, lower memory bandwidth pressure, better performance in the guest, and enormously lower CPU usage. The difference this has made can not be overstated, this new capture backed is now faster and lighter then even the proprietary NvFBC interface from NVIDIA.

Combine this with the KVMFR module (provided you set it up) on the host system allowing the GPU to perform DMA transfers from shared memory, the CPU is no longer involved at all in shuffling any frame data directly anymore.

For laptop/iGPU users especially this has made a night and day difference. We have users reporting 300+UPS using the D12 capture interface, while also reporting an increased rendering performance in the guest VM.

My own laptop with an Intel iGPU and a NVidia 2070 MAX-Q at the highest refresh I can set the guest to (330Hz) attains 330UPS where NvFBC could only attain ~80FPS. On my desktop I have been able to play games like HellDivers 2, at 5120x1440 at 120UPS with the new capture backend.

Can you tell I am excited? :slight_smile:

What will happen to the old D3D12 copy backend?

We have removed the buggy and broken DirectX12 support from the older DXGI capture interface, and the new D12 capture interface is now the default unless you have overridden it in your looking-glass-host.ini file.

If you had d3d12 configured in the host configuration file, it will now be ignored and DXGI will revert to using d3d11.

What will happen to the old DXGI capture interface?

It’s not going anywhere, we know many people are using this on older versions of windows, and as the new D12 capture interface requires DirectX 12, obviously Windows 10 or later is required.

What about the Indirect Display Driver (IDD)

This was put on hold while the above was developed, debugged and tested to avoid needlessly duplicating testing and debugging effort. Once B7 has released focus will move almost entirely onto fininshing the Looking Glass IDD host.

Other changes:

  • Added the ability to specify the default playback and record devices for PipeWire
  • [EGL] fixed a rounding issue in the shaders on hardware that actually uses half precision floats (nvidia)
  • [X11] fixed issue with window managers (i3) that prevented focus following the mouse from working correctly
  • Detect and warn on improper guest CPU configuration
  • Update LGMP to support building under MSVC for the incoming Idd support
  • Fixed RGB10 support to handle both HDR and non-HDR content by means of HDR to SDR mapping (this does not mean HDR support in linux yet!)
  • added new input:captureOnFocus feature to automatically enter capture mode when the window has been focused by the user.
  • If the client is running on i3, make use of the IPC to allow LG to run global full screen (spans all monitors) if the new option i3:globalFullScreen is enabled
  • added new win:requestActivation option to opt-out of activation requests from the guest
  • [X11] changed the cursor dot to a more visible cursor and added an optional larger cursor for the vision impared which may be enabled with the new option spice:largeCursorDot
  • [EGL] Added configuration parameters to disable and adjust the HDR to SDR mapping
  • [D12] Implemented new DirectX12 capture engine using DXGI Desktop Duplication (results in a 50% bandwidth saving, and higher guest GPU performance… aka, faster then NvFBC!)
  • [DXGI & D12] Convert RGB16 to RGB10 when in HDR for a 50% memory transfer bandwidth saving (note that this has overheads and may not benefit everyone)
  • [DXGI] Removed buggy/broken D3D12 copyBackend

I am sure there is more, we do try to keep track of major changes as they are made, as a volunteer project we don’t always remember to do so. You can always look at the LG git commit history if you want more details :slight_smile:

20 Likes

With my new machine, I will hopefully make use of all the amazing work done in LG.

:pray: Thank you kind sir!

2 Likes

Excellent work as always!

2 Likes

Makes me excited as well! Will give it a try as soon as the beta is out!

1 Like

Today I have been working on the LG documentation in preparation for release candidates to start. I would appreciate it if people could proof it, see if things make sense before we start tagging releases:

https://looking-glass.io/docs/bleeding/

Perhaps add a note to disable iGPU in the BIOS if you have two dGPUs installed. Failure to do so prevented the AMDGPU kernel driver to load and led to all sorts of problems on my machine.

Excited to try this out once you tag a release!

Thanks but we do not provide VFIO specific help in the guide, when using LG as stated in the introduction, you are expected to already have a working VFIO setup before proceeding.