any1 / wayvnc

A VNC server for wlroots based Wayland compositors
ISC License
1.12k stars 69 forks source link

Enabling GPU on NVIDIA drivers causes crashes #258

Open JJ-IsShort opened 1 year ago

JJ-IsShort commented 1 year ago

Useful information:

Please, try to gather as much of useful information as possible and follow these instructions:

any1 commented 1 year ago

Coercing the software rendering pixel format to a 32 bit one instead of 24 will not change the GPU buffer format into a 32 bit one as well. It's still 24 bits, and those are not currently implemented. Besides, if you're using ZRLE encoding, you won't notice any performance improvement from setting the --gpu flag.

JJ-IsShort commented 1 year ago

Oh well, looks like to make this work, I will have to make a lot of changes. I do not guarantee I will be able to even do it, and I don't guarantee it will be good, but if it works, I could try to make some commits.

maztheman commented 1 year ago

On my machine, nvidia proprietary driver, gbm_bo_map() returns ENOSYS which means its not implemented.

biergaizi commented 2 months ago

Besides, if you're using ZRLE encoding, you won't notice any performance improvement from setting the --gpu flag.

You have been misled by the log message. The ZRLE log message was the last words before WayVNC crashed, but the actual crash occurred the H.264 codepath before it was able to print any debug log. I believe I've now debugged the problem, and it should affect both Nvidia and AMD GPUs, see Issue #327 for details.

any1 commented 2 months ago

You have been misled by the log message. The ZRLE log message was the last words before WayVNC crashed,

I don't think so. If the client chooses ZRLE, wayvnc is not going to even try H.264.

biergaizi commented 2 months ago

If the client chooses ZRLE, wayvnc is not going to even try H.264.

WayVNC doesn't try H.264, but TigerVNC does. For the record, TigerVNC appears to always try ZRLE first, before it immediately tries again via H.264 (Even if H.264 is set as the preferred option). WayVNC only logs Choosing open-h264 encoding for client to the console after H.264 availability check succeeds. If the H.264 check itself crashes, the debug log would look misleading, as if the ZRLE encoding causes a H.264 crash.

See the two highlighted lines.

Info: Capturing output HEADLESS-1
Info: >> Headless output 1 1280x720+0x0 Power:UNKNOWN
Info: Listening for connections on 10.3.0.2:5900
Info: New client connection from 10.3.0.1: 0x55aa74ef3bb0 (ref 1)
Info: Starting screen capture
-----> Info: Choosing zrle encoding for client 0x55aa74ef3bb0
Info: Opened DRM device /dev/dri/renderD128: driver amdgpu version 3.57.0.
Info: w:1 h:1 pixfmt:drm_prime tb:1/1 fr:0/1 sar:0/1
Info: libva: VA-API version 1.22.0
Info: libva: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
Info: libva: Found init function __vaDriverInit_1_22
Info: libva: va_openDriver() returns 0
Info: Initialised VAAPI connection: version 1.22
Info: VAAPI driver: Mesa Gallium driver 24.2.0 for AMD Radeon Pro VII (radeonsi, vega20, LLVM 18.1.8, DRM 3.57, 6.10.6-gentoo-dist).
Info: Driver not found in known nonstandard list, using standard behaviour.
Info: Input surface format is nv12.
Info: Using VAAPI profile VAProfileH264ConstrainedBaseline (13).
Info: Using VAAPI entrypoint VAEntrypointEncSlice (6).
Info: Using VAAPI render target format YUV420 (0x1).
Info: RC mode: CQP.
Info: RC quality: 5.
Info: RC framerate: 65535/1 (65535.00 fps).
Info: Driver does not report any additional prediction constraints.
Info: Using intra and P-frames (supported references: 1 / 0).
Warning: libav: 0: Driver does not support some wanted packed headers (wanted 0xd, found 0x1).
Info: Using level 4.
-----> Info: Choosing open-h264 encoding for client 0x55aa74ef3bb0
Info: Opened DRM device /dev/dri/renderD128: driver amdgpu version 3.57.0.
Info: w:1 h:1 pixfmt:drm_prime tb:1/1 fr:0/1 sar:0/1
Info: libva: VA-API version 1.22.0
Info: libva: Trying to open /usr/lib64/va/drivers/radeonsi_drv_video.so
Info: libva: Found init function __vaDriverInit_1_22
Info: libva: va_openDriver() returns 0
Info: Initialised VAAPI connection: version 1.22
Info: VAAPI driver: Mesa Gallium driver 24.2.0 for AMD Radeon Pro VII (radeonsi, vega20, LLVM 18.1.8, DRM 3.57, 6.10.6-gentoo-dist).