Skip to content

fix: produce decodable H.264 on radeonsi (AMD) VA-API encoders#22

Open
stevenwcarter wants to merge 1 commit into
MuNeNiCK:mainfrom
stevenwcarter:fix/radeonsi-slice-nal-header
Open

fix: produce decodable H.264 on radeonsi (AMD) VA-API encoders#22
stevenwcarter wants to merge 1 commit into
MuNeNiCK:mainfrom
stevenwcarter:fix/radeonsi-slice-nal-header

Conversation

@stevenwcarter

Copy link
Copy Markdown

On AMD GPUs the VA-API hardware path produced a stream every decoder rejects, showing a black or white screen while input, clipboard and audio kept working (#21). Two causes, both rooted in radeonsi expecting packed headers that hypr-rdp does not submit:

  • The slice NAL unit header byte comes back as 0x00 (invalid) because the driver only fills it from packed slice headers. Repair it from frame state; a valid stream never contains type-0 NALs, so this is a no-op on drivers that fill the byte (e.g. Intel iHD).

  • The synthesized PPS declared transform_8x8_mode_flag=1, but VCN hardware before 5.0 cannot emit that syntax, so decoders parsed phantom bits. Disable it, and align POC type and deblocking signaling with what the driver actually writes.

The parameter changes are gated on the driver vendor string (radeonsi): all other drivers keep byte-identical legacy behavior. The NAL repair is unconditional but only rewrites invalid NALs.

Verified on RX 6800 XT (VCN 3.0, Mesa 26.1.5), Hyprland 0.55.4, macOS Windows App client at 3456x2160: hardware encoding now works.

Fixes #21

On AMD GPUs the VA-API hardware path produced a stream every decoder
rejects, showing a black or white screen while input, clipboard and
audio kept working (MuNeNiCK#21). Two causes, both rooted in radeonsi
expecting packed headers that hypr-rdp does not submit:

- The slice NAL unit header byte comes back as 0x00 (invalid) because
  the driver only fills it from packed slice headers. Repair it from
  frame state; a valid stream never contains type-0 NALs, so this is
  a no-op on drivers that fill the byte (e.g. Intel iHD).

- The synthesized PPS declared transform_8x8_mode_flag=1, but VCN
  hardware before 5.0 cannot emit that syntax, so decoders parsed
  phantom bits. Disable it, and align POC type and deblocking
  signaling with what the driver actually writes.

The parameter changes are gated on the driver vendor string
(radeonsi): all other drivers keep byte-identical legacy behavior.
The NAL repair is unconditional but only rewrites invalid NALs.

Verified on RX 6800 XT (VCN 3.0, Mesa 26.1.5), Hyprland 0.55.4,
macOS Windows App client at 3456x2160: hardware encoding now works.

Fixes MuNeNiCK#21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Whitescreen during connection but session otherwise works

1 participant