hyprwm / xdg-desktop-portal-hyprland

xdg-desktop-portal backend for Hyprland
BSD 3-Clause "New" or "Revised" License
305 stars 48 forks source link

Screenshare stuttering #295

Closed haroldojunios closed 2 weeks ago

haroldojunios commented 3 weeks ago

When I screenshare the mouse cursor starts to stutter on my side, and all the stream stutters for the viewer, as if old frames are being shown in the middle of the new ones. This happens on any browser and OBS.

https://github.com/user-attachments/assets/ba3d5a47-df58-4ef8-9922-b73e2dc0078a

I followed the wiki about the Nvidia setup and screensharing.

The installed packages are:

❯ pacman -Qs hyprland
local/hyprcursor-git 0.1.10.r7.g0264e698-1
    The hyprland cursor format, library and utilities
local/hypridle-git 0.1.4.r1.g4d2fb9e7-1
    Hyprland's idle daemon
local/hyprland-git 0.44.0.r97.93b4478e-1
    Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
local/hyprlock-git 0.5.0.r4.gedbecc87-1
    Hyprland's GPU-accelerated screen locking utility
local/hyprutils-git 0.2.3.r3.gfd4be8b9-1
    Hyprland utilities library used across the ecosystem
local/hyprwayland-scanner-git 0.4.2.r1.g500c81a9-1
    A Hyprland implementation of wayland-scanner, in and for C++
local/xdg-desktop-portal-hyprland-git 1.3.8.r8.g998f6467-1
    xdg-desktop-portal backend for hyprland

❯ pacman -Qs nvidia
local/egl-gbm 1.1.2-1
    The GBM EGL external platform library
local/egl-wayland 4:1.1.16-1
    EGLStream-based Wayland external platform
local/lib32-nvidia-utils 565.57.01-1
    NVIDIA drivers utilities (32-bit)
local/lib32-opencl-nvidia 565.57.01-1
    OpenCL implemention for NVIDIA (32-bit)
local/libva-nvidia-driver-git 0.0.12.r23.g68efa33-1
    VA-API implementation that uses NVDEC as a backend (git version)
local/libvdpau 1.5-3
    Nvidia VDPAU library
local/libxnvctrl 565.57.01-1
    NVIDIA NV-CONTROL X extension
local/nvidia-dkms 565.57.01-1
    NVIDIA kernel modules - module sources
local/nvidia-settings 565.57.01-1
    Tool for configuring the NVIDIA graphics driver
local/nvidia-utils 565.57.01-1
    NVIDIA drivers utilities
local/opencl-nvidia 565.57.01-1
    OpenCL implemention for NVIDIA

Relevant Nvidia setup:

❯ cat ~/.config/hypr/hyprland/nvidia.conf
env = LIBVA_DRIVER_NAME,nvidia
env = GBM_BACKEND,nvidia-drm
env = __GLX_VENDOR_LIBRARY_NAME,nvidia
env = NVD_BACKEND,direct
env = __GL_VRR_ALLOWED,0
env = DRI_PRIME,pci-0000_01_00_0
env = __VK_LAYER_NV_optimus,NVIDIA_only

cursor {
    no_hardware_cursors = true
}

render {
    explicit_sync = 0
}

misc {
    vfr                      = true
    vrr                      = 2
    animate_manual_resizes   = false
    render_ahead_of_time     = false
}

Relevant env vars:

❯ env | grep -Ei 'xdg|wayland'
XDG_BACKEND=wayland
GVIM_ENABLE_WAYLAND=1
GDK_BACKEND=wayland,x11
XDG_CURRENT_DESKTOP=Hyprland
WAYLAND_DISPLAY=wayland-1
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_DATA_DIRS=/home/haroldo/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
CLUTTER_BACKEND=wayland
XDG_SESSION_DESKTOP=Hyprland
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
SDL_VIDEODRIVER=wayland
QT_QPA_PLATFORM=wayland;xcb
QT_WAYLAND_DISABLE_WINDOWDECORATION=1
XDG_SESSION_TYPE=wayland
XDG_VTNR=1
XDG_SESSION_CLASS=user
XDG_MENU_PREFIX=arch-
MOZ_ENABLE_WAYLAND=1
XDG_SESSION_ID=6
XDG_SEAT=seat0
XDG_RUNTIME_DIR=/run/user/1000
Elibrio commented 2 weeks ago

I have had the exact same problem with Nvidia 560 drivers since I started using Hyprland. I have tested open-dkms and dkms drivers, as well as the xdph git package with a lot of different environment variables and settings.

This is one of the few things that really bothers me about Hyprland, I would be happy if there is a solution for it

id3v1669 commented 2 weeks ago

had same problem, enabling render:explicit_sync = 1 seems to fix the issue. That brings it's own problems, but at least screensharing works for me.

Elibrio commented 2 weeks ago

Hmm I thought I had already tested this, but it actually seems to fix the problem for the most part. It's still visible sometimes, but hopefully that will change in the future with driver optimizations. Thanks a lot!

haroldojunios commented 2 weeks ago

It's good enough for me, thanks @id3v1669.