gnif / LookingGlass

An extremely low latency KVMFR (KVM FrameRelay) implementation for guests with VGA PCI Passthrough.
GNU General Public License v2.0
4.64k stars 257 forks source link

Regression: Broken libdecor support #1116

Closed blu3bird closed 5 months ago

blu3bird commented 5 months ago

B7-rc1 and current master (a626a114) have broken libdecor support in Gnome 45.5 on Wayland. The LookingGlass window has no decorations.

Cmake output:

  • The following features have been enabled:

  • OPTIMIZE_FOR_NATIVE, Optimized for native

    • ENABLE_OPENGL, Legacy OpenGL renderer.
    • ENABLE_EGL, EGL renderer.
    • ENABLE_BACKTRACE, Backtrace support.
    • ENABLE_PIPEWIRE, PipeWire audio support.
    • ENABLE_PULSEAUDIO, PulseAudio audio support.
    • ENABLE_X11, X11 support.
    • ENABLE_WAYLAND, Wayland support.
    • ENABLE_LIBDECOR, libdecor support.

-- The following features have been disabled:

  • ENABLE_ASAN, AddressSanitizer support.
  • ENABLE_UBSAN, UndefinedBehaviorSanitizer support.

Client output:

0:00:00.000 [I] main.c:1859 | main | Looking Glass (B7-rc1-19-ga626a1142d) 00:00:00.000 [I] main.c:1860 | main | Locking Method: Atomic 00:00:00.000 [I] cpuinfo.c:38 | cpuInfo_log | CPU Model: AMD Ryzen 9 7950X3D 16-Core Processor 00:00:00.000 [I] cpuinfo.c:39 | cpuInfo_log | CPU: 1 sockets, 16 cores, 32 threads 00:00:00.005 [I] config.c:608 | config_load | Loading config from: /home/bluebird/.config/looking-glass/client.ini 00:00:00.010 [I] main.c:1185 | lg_run | Using font: /usr/share/fonts/dejavu/DejaVuSansMono.ttf 00:00:00.010 [I] ivshmem.c:128 | ivshmemOpenDev | KVMFR Device : /dev/kvmfr0 00:00:00.014 [I] audio.c:159 | audio_init | Using AudioDev: PipeWire 00:00:00.014 [I] ps.c:236 | purespice_connect | Connecting to unix socket /run/libvirt/qemu/Nafrayu.sock 00:00:00.020 [I] rsa.c:178 | rsa_encryptPassword | Using Nettle 00:00:00.020 [I] ps.c:268 | purespice_connect | Connected 00:00:00.020 [I] channel_main.c:167 | onMessage_mainName | Guest name: Nafrayu 00:00:00.020 [I] channel_main.c:183 | onMessage_mainUUID | Guest UUID: fe0cf1cc-1917-4790-a9da-> 66a315f8aca4 00:00:00.026 [I] ps.c:644 | ps_connectChannel | INPUTS channel connected 00:00:00.026 [I] channel.c:323 | onMessage_notify | [notify] keyboard channel is insecure 00:00:00.026 [I] egl.c:289 | egl_initialize | Double buffering is off 00:00:00.026 [I] main.c:1139 | tryRenderer | Using Renderer: EGL 00:00:00.026 [I] wayland.c:120 | waylandInit | Compositor: gnome-shell 00:00:00.026 [I] wayland.c:130 | waylandInit | Selected : xdg 00:00:00.026 [I] main.c:1398 | lg_run | Using JIT render mode 00:00:00.027 [I] gl.c:58 | waylandGetEGLDisplay | Using eglGetPlatformDisplay 00:00:00.047 [I] egl.c:856 | egl_renderStartup | Single buffer mode 00:00:00.047 [I] egl.c:883 | egl_renderStartup | EGL : 1.5 00:00:00.047 [I] egl.c:884 | egl_renderStartup | Vendor : AMD 00:00:00.047 [I] egl.c:885 | egl_renderStartup | Renderer: AMD Radeon Graphics (radeonsi, raphael_mendocino, LLVM 17.0.6, DRM 3.57, 6.8.1-gentoo) 00:00:00.047 [I] egl.c:886 | egl_renderStartup | Version : OpenGL ES 3.2 Mesa 24.0.3 00:00:00.047 [I] egl.c:887 | egl_renderStartup | EGL APIs: OpenGL OpenGL_ES 00:00:00.047 [I] egl.c:958 | egl_renderStartup | Debug messages disabled, enable with egl:debug=true 00:00:00.262 [I] main.c:1491 | lg_run | ================================================================================ 00:00:00.262 [I] main.c:1492 | lg_run | The host application seems to not be running 00:00:00.262 [I] main.c:1493 | lg_run | Waiting for the host application to start... 00:00:01.130 [I] eglutil.c:35 | swapWithDamageInit | Using EGL_KHR_swap_buffers_with_damage 00:00:01.181 [I] main.c:1498 | lg_run | ================================================================================ 00:00:01.181 [I] main.c:1512 | lg_run | Check the host log in your guest at %ProgramData%\Looking Glass (host)\looking-glass-host.txt 00:00:01.181 [I] main.c:1513 | lg_run | Continuing to wait... 00:00:01.275 [I] ps.c:644 | ps_connectChannel | DISPLAY channel connected 00:00:01.276 [I] main.c:919 | spice_surfaceCreate | Create SPICE surface: id: 0, size: 1920x1080 00:00:01.279 [I] ps.c:644 | ps_connectChannel | CURSOR channel connected ^C00:00:03.323 [I] main.c:1095 | intHandler | Caught signal, shutting down... 00:00:03.337 [I] channel.c:269 | channel_internal_disconnect | CURSOR channel disconnected 00:00:03.337 [I] channel.c:269 | channel_internal_disconnect | DISPLAY channel disconnected 00:00:03.337 [I] channel.c:269 | channel_internal_disconnect | INPUTS channel disconnected 00:00:03.337 [I] channel.c:269 | channel_internal_disconnect | MAIN channel disconnected 00:00:03.337 [I] ps.c:330 | purespice_disconnect | Disconnected

I believe the cause is a static assignment of the 1st desktop in client/displayservers/Wayland/wayland.c:124.

After applying this patch

diff --git a/client/displayservers/Wayland/wayland.c b/client/displayservers/Wayland/wayland.c
index aa8c632b..0b94c2d8 100644
--- a/client/displayservers/Wayland/wayland.c
+++ b/client/displayservers/Wayland/wayland.c
@@ -121,7 +121,7 @@ static bool waylandInit(const LG_DSInitParams params)
     for(int i = 0; i < WL_DESKTOP_COUNT; ++i)
       if (strcmp(WL_Desktops[i]->compositor, compositor) == 0)
       {
-        wlWm.desktop = WL_Desktops[0];
+        wlWm.desktop = WL_Desktops[i];
         break;
       }
   }

the client output changes from

00:00:00.026 [I] wayland.c:130 | waylandInit | Selected : xdg

to

00:00:00.029 [I] wayland.c:130 | waylandInit | Selected : libdecor

and the window has decorations.

gnif commented 5 months ago

Thanks for this excellent diagnostic, this is indeed the fault here. I will push in a fix for this asap.