hwcodec not working on Ubuntu 22.04 #3022

Closed
opened 2026-02-21 01:03:50 -05:00 by deekerman · 0 comments
Owner

Originally created by @tatokis on GitHub (Sep 30, 2024).

Bug Description

Hardware accelerated decoding/encoding stopped working at some point in the past on Ubuntu 22.04 with a Radeon RX580 (only used h264 in the past). H264 doesn't show up in the list when connecting to this computer, and when connecting from this computer to another one, UVD usage in radeontop shows 0% and the CPU load is high (due to CPU decoding).

$ vainfo
libva info: VA-API version 1.14.0
libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_1_14
libva info: va_openDriver() returns 0
vainfo: VA-API version: 1.14 (libva 2.12.0)
vainfo: Driver version: Mesa Gallium driver 24.2.3 - kisak-mesa PPA for AMD Radeon RX 580 Series (radeonsi, polaris10, LLVM 15.0.7, DRM 3.58, 6.11.0-meh)
vainfo: Supported profile and entrypoints
      VAProfileMPEG2Simple            :	VAEntrypointVLD
      VAProfileMPEG2Main              :	VAEntrypointVLD
      VAProfileVC1Simple              :	VAEntrypointVLD
      VAProfileVC1Main                :	VAEntrypointVLD
      VAProfileVC1Advanced            :	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointVLD
      VAProfileH264ConstrainedBaseline:	VAEntrypointEncSlice
      VAProfileH264Main               :	VAEntrypointVLD
      VAProfileH264Main               :	VAEntrypointEncSlice
      VAProfileH264High               :	VAEntrypointVLD
      VAProfileH264High               :	VAEntrypointEncSlice
      VAProfileHEVCMain               :	VAEntrypointVLD
      VAProfileHEVCMain               :	VAEntrypointEncSlice
      VAProfileHEVCMain10             :	VAEntrypointVLD
      VAProfileJPEGBaseline           :	VAEntrypointVLD
      VAProfileNone                   :	VAEntrypointVideoProc

ffmpeg on the system can still encode and decode video. Tested successfully with the following command, which uses the GPU to both decode and encode video:

ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i input.mp4 -c:v h264_vaapi output.mp4

From check-hwcodec-config/rustdesk_rCURRENT.log:

$ cat check-hwcodec-config/rustdesk_rCURRENT.log 
[2024-10-01 00:57:45.887992 +03:00] INFO [src/core_main.rs:140] main start args: ["--check-hwcodec-config"], env: Args { inner: ["/usr/lib/rustdesk/rustdesk", "--check-hwcodec-config"] }
[2024-10-01 00:57:45.909985 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/encode.rs:322] prepare yuv 985.357µs
[2024-10-01 00:57:45.911148 +03:00] ERROR [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/lib.rs:17] [FFMPEG_RAM_ENC] Codec h264_vaapi not found
[2024-10-01 00:57:45.911261 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/encode.rs:350] h264_vaapi new failed 191.709µs
[2024-10-01 00:57:45.914614 +03:00] ERROR [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/lib.rs:17] [FFMPEG_RAM_DEC] av_hwdevice_ctx_create failed, ret = Cannot allocate memory
[2024-10-01 00:57:45.914708 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/decode.rs:341] name:h264 device:AV_HWDEVICE_TYPE_VAAPI new failed:785.787µs
[2024-10-01 00:57:45.914988 +03:00] ERROR [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/lib.rs:17] [FFMPEG_RAM_DEC] av_hwdevice_ctx_create failed, ret = Cannot allocate memory
[2024-10-01 00:57:45.915040 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/decode.rs:341] name:hevc device:AV_HWDEVICE_TYPE_VAAPI new failed:1.562716ms
[2024-10-01 00:57:45.915377 +03:00] DEBUG [libs/scrap/src/common/hwcodec.rs:706] HwCodecConfig { signature: 0, ram_encode: [], ram_decode: [CodecInfo { name: "h264", mc_name: None, format: H264, priority: 3, hwdevice: AV_HWDEVICE_TYPE_NONE }, CodecInfo { name: "hevc", mc_name: None, format: H265, priority: 3, hwdevice: AV_HWDEVICE_TYPE_NONE }] }
[2024-10-01 00:57:45.915786 +03:00] INFO [src/ipc.rs:1229] send ok

How to Reproduce

Connect to a computer from a machine running Ubuntu 22.04 with latest Mesa and an RX580.

Expected Behavior

The GPU is used to encode and decode supported formats.

Operating system(s) on local side and remote side

Linux -> Linux

RustDesk Version(s) on local side and remote side

1.3.2 -> 1.3.2

Screenshots

Additional Context

No response

Originally created by @tatokis on GitHub (Sep 30, 2024). ### Bug Description Hardware accelerated decoding/encoding stopped working at some point in the past on Ubuntu 22.04 with a Radeon RX580 (only used h264 in the past). H264 doesn't show up in the list when connecting to this computer, and when connecting from this computer to another one, UVD usage in radeontop shows 0% and the CPU load is high (due to CPU decoding). ``` $ vainfo libva info: VA-API version 1.14.0 libva info: Trying to open /usr/lib/x86_64-linux-gnu/dri/radeonsi_drv_video.so libva info: Found init function __vaDriverInit_1_14 libva info: va_openDriver() returns 0 vainfo: VA-API version: 1.14 (libva 2.12.0) vainfo: Driver version: Mesa Gallium driver 24.2.3 - kisak-mesa PPA for AMD Radeon RX 580 Series (radeonsi, polaris10, LLVM 15.0.7, DRM 3.58, 6.11.0-meh) vainfo: Supported profile and entrypoints VAProfileMPEG2Simple : VAEntrypointVLD VAProfileMPEG2Main : VAEntrypointVLD VAProfileVC1Simple : VAEntrypointVLD VAProfileVC1Main : VAEntrypointVLD VAProfileVC1Advanced : VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointVLD VAProfileH264ConstrainedBaseline: VAEntrypointEncSlice VAProfileH264Main : VAEntrypointVLD VAProfileH264Main : VAEntrypointEncSlice VAProfileH264High : VAEntrypointVLD VAProfileH264High : VAEntrypointEncSlice VAProfileHEVCMain : VAEntrypointVLD VAProfileHEVCMain : VAEntrypointEncSlice VAProfileHEVCMain10 : VAEntrypointVLD VAProfileJPEGBaseline : VAEntrypointVLD VAProfileNone : VAEntrypointVideoProc ``` ffmpeg on the system can still encode and decode video. Tested successfully with the following command, which uses the GPU to both decode and encode video: ``` ffmpeg -hwaccel vaapi -hwaccel_output_format vaapi -hwaccel_device /dev/dri/renderD128 -i input.mp4 -c:v h264_vaapi output.mp4 ``` From `check-hwcodec-config/rustdesk_rCURRENT.log`: ``` $ cat check-hwcodec-config/rustdesk_rCURRENT.log [2024-10-01 00:57:45.887992 +03:00] INFO [src/core_main.rs:140] main start args: ["--check-hwcodec-config"], env: Args { inner: ["/usr/lib/rustdesk/rustdesk", "--check-hwcodec-config"] } [2024-10-01 00:57:45.909985 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/encode.rs:322] prepare yuv 985.357µs [2024-10-01 00:57:45.911148 +03:00] ERROR [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/lib.rs:17] [FFMPEG_RAM_ENC] Codec h264_vaapi not found [2024-10-01 00:57:45.911261 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/encode.rs:350] h264_vaapi new failed 191.709µs [2024-10-01 00:57:45.914614 +03:00] ERROR [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/lib.rs:17] [FFMPEG_RAM_DEC] av_hwdevice_ctx_create failed, ret = Cannot allocate memory [2024-10-01 00:57:45.914708 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/decode.rs:341] name:h264 device:AV_HWDEVICE_TYPE_VAAPI new failed:785.787µs [2024-10-01 00:57:45.914988 +03:00] ERROR [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/lib.rs:17] [FFMPEG_RAM_DEC] av_hwdevice_ctx_create failed, ret = Cannot allocate memory [2024-10-01 00:57:45.915040 +03:00] DEBUG [/root/.cargo/git/checkouts/hwcodec-74796a7f8f16bbb9/f74410e/src/ffmpeg_ram/decode.rs:341] name:hevc device:AV_HWDEVICE_TYPE_VAAPI new failed:1.562716ms [2024-10-01 00:57:45.915377 +03:00] DEBUG [libs/scrap/src/common/hwcodec.rs:706] HwCodecConfig { signature: 0, ram_encode: [], ram_decode: [CodecInfo { name: "h264", mc_name: None, format: H264, priority: 3, hwdevice: AV_HWDEVICE_TYPE_NONE }, CodecInfo { name: "hevc", mc_name: None, format: H265, priority: 3, hwdevice: AV_HWDEVICE_TYPE_NONE }] } [2024-10-01 00:57:45.915786 +03:00] INFO [src/ipc.rs:1229] send ok ``` ### How to Reproduce Connect to a computer from a machine running Ubuntu 22.04 with latest Mesa and an RX580. ### Expected Behavior The GPU is used to encode and decode supported formats. ### Operating system(s) on local side and remote side Linux -> Linux ### RustDesk Version(s) on local side and remote side 1.3.2 -> 1.3.2 ### Screenshots - ### Additional Context _No response_
deekerman 2026-02-21 01:03:50 -05:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rustdesk-rustdesk#3022
No description provided.