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.
Note that I am streaming at the moment, if you would like a demo just ask in the chat box.
Edit: Two more new keybinds.
ScrollLock+F
= Full Screen Toggle
ScrollLock+I
= Spice KB/Mouse Input Enable Toggle
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 |
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 |
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 |
|------------------------------------------------------------------------------------|
The c-host
FINALLY has a application Icon, Tray icon and context menu
Two new configurables added:
- app:cursorPollInterval
- app:framePollInterval
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
At the request of several people I have setup a Ko-Fi account for those that would rather donate there instead of Patreon.
Automated bleeding edge builds of the c-host
for Windows are now available at:
https://looking-glass.hostfission.com/downloads
These builds include NvFBC support if your lucky enough to have hardware that this will work it.
New client feature:
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.
B1-rc2 was just tagged for release, a host build is available on the downloads page.
Please beware this is a release candidate and not the final B1 release
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.
B1-rc4
was just tagged and is available for download.
This version includes fixes for initial startup issues (missing cursor and long time to first frame).
Edit: B1-rc4 has a cursor type bug, B1-rc5 was just tagged which contains the fix
Just a FYI, I have now submitted this project to OpenHub for statistics analysis.
https://www.openhub.net/p/LookingGlass
In a Nutshell, KVMFR Looking Glass…
… has had 848 commits made by 26 contributors
representing 15,247 lines of code… is mostly written in C
with a low number of source code comments… has a young, but established codebase
maintained by a large development team
with stable Y-O-Y commits… took an estimated 4 years of effort (COCOMO model)
starting with its first commit in October, 2017
ending with its most recent commit 2 days ago
Estimated Effort: 3 person-years
Estimated Cost: $ 190,553
Damn, that cost though!
Everyone give @Wendell and the L1Tech team a cheer for their support of this project! Thanks guys, as always the support is very much appreciated!
Today a parcel arrived from @Wendell containing some hardware to allow building a permanent test platform for looking glass.
Along with this it will allow for easier regression testing, as well as provide a system that I can use to film start to finish setup guides for Looking Glass.
B1-rc6 was just tagged, it contains the following changes:
- Nicer Icon for windows (might be the final icon too)
- A bug causing a crash instead of a clean termination
- The client won’t stop the screensaver anymore (fixed properly this time)
- Added keybinds for Ctrl+Alt+Fn for Linux guests.
- DKMS configuration was reworked (thanks to Omar007)
- Failure to build the host under some versions of MinGW has been fixed.
- Improvement to client texture streaming support in EGL.
A pre-compiled build of the Windows host executable is available at:
https://looking-glass.hostfission.com/downloads
This is not a change but an announcement.
Yesterday one of our users on the LG Discord channel diagnosed and found that when using the AMD Vega GPU as a pass-through graphics adaptor the performance was far lower then it should be.
The cause was found to be the GPU is not scaling it’s performance profile correctly when video capture is in use, the workaround is to force the card into performance mode.
While this is not a great solution due to increased power consumption and heat, it should at least get you going.
Beta 1
Support
Please be aware that this project consists of literally thousands of hours of my personal time, if you like what you see here it would be greatly appreciated if you would be so kind as to donate towards the cost in development using one of the following methods:
Download
All downloads are now available at https://looking-glass.hostfission.com/downloads.
Important changes to the host application
Please be aware that the host application now requires Administrator access and as such launching via the Run
registry entry no longer works. To have the host application launch at startup you now need to setup a Scheduled Task in Windows. Documentation on how to perform this will be provided in the coming days on the Looking Glass website.
Documentation
As of writing this, the LG website documentation is out of date and will be updated over the next few days, please be patient. In the meantime please see the various README.md files in this project as they are currently the most up to date.
Known Issues & Workarounds (Please do not report these issues)
- The host application doesn’t show any information on a standard windows command prompt.
- This is due to how windows handles terminals and will be fixed at a later time. In the meantime please use a posix compatible terminal such as GitBash if you wish to see CLI output from the host executable.
- NvFBC doesn’t work on GeForce cards
- This is not a bug! You must have a Quadro or better as NVIDIA have decided that this feature is for “Pro” users only, write them and complain.
- 4K is still slow
- Some titles at 4K will still be slow due to hardware/driver limitations, there is nothing we can do about this, things that may help are:
- Enable vsync in the title
- Run in windowed mode
- Use rivatuner statistics server (RTSS) to limit the frame rate
- If you are using a Vega/Navi in Windows, set the card to “Performance” mode.
- Some titles at 4K will still be slow due to hardware/driver limitations, there is nothing we can do about this, things that may help are:
Changes of note since A12
- Complete rewrite of the host application in C supporting cross platform compilation (Linux and Windows only currently)
- Massive improvement to DXGI capture performance, using windowed mode in applications is no longer required and 4K resolutions are now possible if your hardware is up to the task.
- If supported, HDR (ARGB10) capture is now supported and used when appropriate.
- NvFBC support has been updated and is now included in the pre-built host executable (You still need a Quadro or better).
- SPICE: full bi-directional clipboard support
- NightVision/Brightness hotkey ScrLck+N (EGL only)
- Disable input hotkey ScrLck+I
- FullScreen hotkey ScrLck+F
- Command line arguments and settings file parser has been rewritten
- The host application now has an icon
- The host application now has a tray icon and logs to a file
- Mouse sensitivity hotkeys ScrLck+Ins/ScrLck+Del
- Switch term hotkeys ScrLck+F1…F12 to send Ctrl+Alt+F1…F12
- Client FPS limiter is now auto set based on your refresh rate for optimal performance.
- Client debug back-trace support (this can be disabled, but if you have a crash no support can be rendered without this feature, or a full backtrace from GDB).
- KVMFR module for VM->VM and Linux Guests now has a DKMS config.