I am working on some more updates to the Spice interface that will help both performance and hopefully bring spice guest agent communications (read, Clipboard Sync).
It’s slow going due to the fact that RedHat have not updated the spice protocol documentation since 2009 which is full of errors, typos and missing a ton of information about the later versions of the protocol. It’s even a “Draft” according to the title page.
I have opened a ticket to try to get some traction on this being updated over here:
I am honestly not surprised that it hasn’t been maintained however, as far as I am aware Looking Glass is the first and only third party spice client implementation to date.
Made some more progress today, the latest version in git now supports client to host clipboard sync for text. To make it work you will need to ensure you have the spice-agent tools installed in windows and the appopriate spicevmc device on the guest.
Just a status update. Over the past week I have been working on rewriting the host application for several reasons.
It’s written in C++ and the rest of the project is written in C
It require’s Microsoft VS to build it which is a pain
It’s very windows specific
The code is very convoluted from all the DXGI experimentation early on.
I am very pleased to announce there is a new c-host directory in the git repository. This is a pure C rewrite with DXGI support and preliminary XCA SHM support (Yes, you read that right, Linux support!)
Bug reports for the c-host will be ignored until I announce an official release!
This code is extremely new and experimental, expect bugs and missing features.
The state of DXGI is good, it works but with a few minor issues. XCA capture on the other hand requires some TLC to get it working correctly.
If you would like to build this application under windows it couldn’t be easier, simply install mingw64 and ensure your path is configured correctly, then run gmake.
Again there is ZERO support for the c-host at this time so please DO NOT open any issues for it unless they are Pull Requests to contribute code to the project.
Another long awaited update that will make many people happy. I have updated the project to make far better use of cmake. There are now options to enable/disable core features for people that want to build on platforms that may not have support for them.
It is now possible to disable the following features:
Feature
cmake option
default
description
OpenGL
ENABLE_OPENGL
Enabled
The Legacy OpenGL Renderer
EGL
ENABLE_EGL
Enabled
The modern OpenGL ES Renderer
X11 Clipboard
ENABLE_CB_X11
Enabled
X11/Xorg Clipboard Integration
For those unfamiliar with cmake, to specify these you must pass the -D switch, for example:
mkdir build
cd build
cmake -DENABLE_OPENGL=0 ..
make
New feature, Scroll Lock is now also a super/escape key for additional commands.
For now there is only additional command bound which is ScrollLock+N for the EGL renderer which increases the gain/brightness of the capture source to assist with monitors with poor brightness when playing games that are dark.
Still getting this ready for the Beta 1 (B1) release, today a major milestone was accomplished that has been holding this back. The option parsing, loading and saving has been overhauled to a platform agnostic interface. This has changed a few things of note for the end user:
Some option switches have changed and/or been removed.
The configuration file format is now a standard INI type, making it easier to get the syntax correct.
The help output has changed to hopefully be a bit easier to search through.
Note: As usual this code is extremely new and may contain bugs and/or errors.
The old short option arguments have mostly been deprecated, some have been kept around however to make this transition a little smoother for those launching LG from scripts, etc.
The new format is as follows:
module:name=value
For example, to turn on the FPS display the argument would be:
win:showFPS=yes
If you wish to put this into a configuration file, the format would be:
[win]
showFPS = yes
Below lists the current options as they stand at the time of posting this:
Long
Short
Value
Description
app:configFile
-C
NULL
A file to read additional configuration from
app:shmFile
-f
/dev/shm/looking-glass
The path to the shared memory file
app:shmSize
-L
0
Specify the size in MB of the shared memory file (0 = detect)
app:renderer
-g
auto
Specify the renderer to use
app:license
-l
no
Show the licence for this application and then terminate
Enable the built in SPICE client for input and/or clipboard support
spice:host
-c
127.0.0.1
The SPICE server host or UNIX socket
spice:port
-p
5900
The SPICE server port (0 = unix socket)
spice:input
yes
Use SPICE to send keyboard and mouse input events to the guest
spice:clipboard
yes
Use SPICE to syncronize the clipboard contents with the guest
spice:clipboardToVM
yes
Allow the clipboard to be syncronized TO the VM
spice:clipboardToLocal
yes
Allow the clipboard to be syncronized FROM the VM
spice:scaleCursor
-j
yes
Scale cursor input position to screen size when up/down scaled
Long
Short
Value
Description
egl:vsync
no
Enable vsync
Long
Short
Value
Description
opengl:mipmap
yes
Enable mipmapping
opengl:vsync
yes
Enable vsync
opengl:preventBuffer
yes
Prevent the driver from buffering frames
opengl:amdPinnedMem
yes
Use GL_AMD_pinned_memory if it is available
The list of options and their current values are obtainable by launching the application with the -h or --help option, for example:
./looking-glass-client -h
The following is a complete list of options accepted by this application
|-----------------------------------------------------------------------------------------------------------------|
| Long | Short | Value | Description |
|-----------------------------------------------------------------------------------------------------------------|
| app:configFile | -C | NULL | A file to read additional configuration from |
| app:shmFile | -f | /dev/shm/looking-glass | The path to the shared memory file |
| app:shmSize | -L | 0 | Specify the size in MB of the shared memory file (0 = detect) |
| app:renderer | -g | auto | Specify the renderer to use |
| app:license | -l | no | Show the licence for this application and then terminate |
|-----------------------------------------------------------------------------------------------------------------|
|-------------------------------------------------------------------------------------------------------|
| Long | Short | Value | Description |
|-------------------------------------------------------------------------------------------------------|
| win:title | | Looking Glass (client) | The window title |
| win:position | | center | Initial window position at startup |
| win:size | | 1024x768 | Initial window size at startup |
| win:autoResize | -a | no | Auto resize the window to the guest |
| win:allowResize | -n | yes | Aallow the window to be manually resized |
| win:keepAspect | -r | yes | Maintain the correct aspect ratio |
| win:borderless | -d | no | Borderless mode |
| win:fullScreen | -F | no | Launch in fullscreen borderless mode |
| win:fpsLimit | -K | 200 | Frame rate limit (0 = disable - not recommended) |
| win:showFPS | -k | no | Enable the FPS & UPS display |
| win:ignoreQuit | -Q | no | Ignore requests to quit (ie: Alt+F4) |
| win:noScreensaver | -S | no | Prevent the screensaver from starting |
| win:alerts | -q | yes | Show on screen alert messages |
|-------------------------------------------------------------------------------------------------------|
|---------------------------------------------------------------------------------------------------------------------------------------|
| Long | Short | Value | Description |
|---------------------------------------------------------------------------------------------------------------------------------------|
| input:grabKeyboard | -G | yes | Grab the keyboard in capture mode |
| input:escapeKey | -m | 71 = ScrollLock | Specify the escape key, see https://wiki.libsdl.org/SDLScancodeLookup for valid values |
| input:hideCursor | -M | yes | Hide the local mouse cursor |
|---------------------------------------------------------------------------------------------------------------------------------------|
|------------------------------------------------------------------------------------------------------------------|
| Long | Short | Value | Description |
|------------------------------------------------------------------------------------------------------------------|
| spice:enable | -s | yes | Enable the built in SPICE client for input and/or clipboard support |
| spice:host | -c | 127.0.0.1 | The SPICE server host or UNIX socket |
| spice:port | -p | 5900 | The SPICE server port (0 = unix socket) |
| spice:input | | yes | Use SPICE to send keyboard and mouse input events to the guest |
| spice:clipboard | | yes | Use SPICE to syncronize the clipboard contents with the guest |
| spice:clipboardToVM | | yes | Allow the clipboard to be syncronized TO the VM |
| spice:clipboardToLocal | | yes | Allow the clipboard to be syncronized FROM the VM |
| spice:scaleCursor | -j | yes | Scale cursor input position to screen size when up/down scaled |
|------------------------------------------------------------------------------------------------------------------|
|------------------------------------------|
| Long | Short | Value | Description |
|------------------------------------------|
| egl:vsync | | no | Enable vsync |
|------------------------------------------|
|------------------------------------------------------------------------------------|
| Long | Short | Value | Description |
|------------------------------------------------------------------------------------|
| opengl:mipmap | | yes | Enable mipmapping |
| opengl:vsync | | yes | Enable vsync |
| opengl:preventBuffer | | yes | Prevent the driver from buffering frames |
| opengl:amdPinnedMem | | yes | Use GL_AMD_pinned_memory if it is available |
|------------------------------------------------------------------------------------|
Prior to this update, these were hard coded to 1us, this change increases these to 1000us as their default as this should be fast enough for most use cases. This has reduced the client’s CPU consumption by about 80% in my dev configuration.
These values are simply how long to wait before checking for another update from the host if there wasn’t already an update pending.
EGL texture streaming has been updated to use persistent memory mappings which should also improve performance and help us to skip 1/2 frames if/when we start to fall behind the host. It may induce minor tearing but should provide for an overall better experience.
Another milestone reached, the host application can now be cross compiled for Windows on Linux using mingw64.
geoff@aeryn:~/Projects/LG/LookingGlass/c-host/build# cmake -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw64.cmake -DUSE_NVFBC=1 -DNVFBC_SDK="/home/geoff/Projects/LG/NVIDIA Capture SDK" ..
-- The C compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/x86_64-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Success
-- The CXX compiler identification is GNU 8.3.0
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/x86_64-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
--
-- Configuring done
-- Generating done
-- Build files have been written to: /home/geoff/Projects/LG/LookingGlass/c-host/build
geoff@aeryn:~/Projects/LG/LookingGlass/c-host/build# make
Scanning dependencies of target lg_common
[ 5%] Building C object common/CMakeFiles/lg_common.dir/src/crash.windows.c.obj
[ 11%] Building C object common/CMakeFiles/lg_common.dir/src/stringutils.c.obj
[ 16%] Building C object common/CMakeFiles/lg_common.dir/src/stringlist.c.obj
[ 22%] Building C object common/CMakeFiles/lg_common.dir/src/option.c.obj
[ 27%] Linking C static library liblg_common.a
[ 27%] Built target lg_common
Scanning dependencies of target capture_DXGI
[ 33%] Building C object platform/Windows/capture/DXGI/CMakeFiles/capture_DXGI.dir/src/dxgi.c.obj
[ 38%] Linking C static library libcapture_DXGI.a
[ 38%] Built target capture_DXGI
Scanning dependencies of target capture_NVFBC
[ 44%] Building C object platform/Windows/capture/NVFBC/CMakeFiles/capture_NVFBC.dir/src/nvfbc.c.obj
[ 50%] Building CXX object platform/Windows/capture/NVFBC/CMakeFiles/capture_NVFBC.dir/src/wrapper.cpp.obj
[ 55%] Linking CXX static library libcapture_NVFBC.a
[ 55%] Built target capture_NVFBC
Scanning dependencies of target capture
[ 61%] Building C object platform/Windows/capture/CMakeFiles/capture.dir/__/__/__/src/capture.c.obj
[ 66%] Linking C static library libcapture.a
[ 66%] Built target capture
Scanning dependencies of target platform_Windows
[ 72%] Building C object platform/Windows/CMakeFiles/platform_Windows.dir/src/platform.c.obj
[ 77%] Building C object platform/Windows/CMakeFiles/platform_Windows.dir/src/windebug.c.obj
[ 83%] Building C object platform/Windows/CMakeFiles/platform_Windows.dir/src/mousehook.c.obj
[ 88%] Linking C static library libplatform_Windows.a
[ 88%] Built target platform_Windows
Scanning dependencies of target looking-glass-host
[ 94%] Building C object CMakeFiles/looking-glass-host.dir/src/app.c.obj
[100%] Linking C executable looking-glass-host.exe
[100%] Built target looking-glass-host
geoff@aeryn:~/Projects/LG/LookingGlass/c-host/build# ls -lah looking-glass-host.exe
-rwxr-xr-x 1 geoff geoff 745K May 22 15:33 looking-glass-host.exe
The mouse sensitivity while in capture mode can be adjusted on the fly with the key combination ScrLock+Insert and ScrLock+Delete.
This was added to help with titles that are missing a separate mouse sensitivity setting for ADS but may also help when using drawing programs when mouse accuracy is needed.
I just pushed in a change that seems to substantially improve DXGI capture performance and from my initial testing seems to finally break the 1K capture barrier, I am getting excellent framerates at 4K now.
If you wish to give it a go please grab the host at 21b02efb from the bleeding edge releases on the LG website.