https://bugs.kde.org/show_bug.cgi?id=478868

            Bug ID: 478868
           Summary: KPipeWire's H.264 encoding outputs broken video on an
                    integrated + discrete AMD GPU system
    Classification: Frameworks and Libraries
           Product: KPipeWire
           Version: unspecified
          Platform: Compiled Sources
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: plasma-b...@kde.org
          Reporter: putr...@gmail.com
                CC: aleix...@kde.org
  Target Milestone: ---

Created attachment 164356
  --> https://bugs.kde.org/attachment.cgi?id=164356&action=edit
Recording output if H264 is selected in Spectacle

SUMMARY
My laptop has both an integrated AMD GPU as well as a discrete AMD GPU, and the
display is connected to the integrated GPU. Both GPUs support VAAPI, and use
the same driver, however the discrete GPU is listed first in lspci, and the
discrete GPU is both /dev/dri/card1 and /dev/dri/renderD128, while the
integrated/primary GPU is /dev/dri/card2 as well as /dev/dri/renderD129.

This means that KPipeWire will see the discrete GPU first and use that for
hardware encoding, and not only does that result in higher power usage as well
as slowing down startup of apps using KPipeWire to record video (like
Spectacle, see bug 476866), it also seems to cause the video output to be
corrupt, with nothing from the original source visible in the recording.

If I modify KPipeWire's code to instead select the integrated GPU, the output
recording is slightly better in that I can make out some bits of the original
source, but it is still unusably corrupt.

I am filing this under KPipeWire since krdp is also affected when I tried it
(the video on the client looks the same as the Spectacle recordings), and in
that case it is a bigger problem since krdp only supports H.264.

STEPS TO REPRODUCE
1.  Have a laptop with both an AMD integrated GPU and an AMD discrete GPU
2. Open Spectacle
3. Change its output format to H.264
4. Try to record the screen/region

OBSERVED RESULT
The output recording appears corrupt.

EXPECTED RESULT
The output recording matches what was recorded.

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.91.90
KDE Frameworks Version: 5.248.0
Qt Version: 6.6.1
Kernel Version: 6.6.7-arch1-1 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 6800H with Radeon Graphics
Memory: 30.6 GiB of RAM
Graphics Processor: AMD Radeon 680M + AMD Radeon RX 6650M
Graphics Driver: Mesa 23.3.1

ADDITIONAL INFORMATION
When recording with either GPU, Spectacle shows this message in its terminal
output: [h264_vaapi @ 0x7fc31824cac0] Driver does not support some wanted
packed headers (wanted 0xd, found 0x1).

When recording with the integrated GPU, additional messages like these appear:
EE ../mesa-23.3.1/src/gallium/drivers/radeonsi/radeon_vcn_enc_1_2.c:1224
radeon_enc_encode_params UVD - DCC surfaces not supported.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to