Skip to content

DMA-BUF size may not match size from handleRemoteDesktopStarted()

I upgraded my laptop to Fedora Rawhide this weekend and found that Krfb immediately crashed with a segfault upon opening, after accepting the request from xdg-desktop-portal.

Upon some troubleshooting I determined the root cause was that the PWFrameBuffer::videoSize did not match my screen resolution (or more importantly the DMA-BUF size). This led to an undersized buffer being passed to DmaBufHandler::downloadFrame() from kPipewire. The resulting behavior ranged from EGL errors, to segfaults, to a kwin compositor crash (which recovered all QT-based clients automatically).

I'm not sure why https://invent.kde.org/network/krfb/-/blob/master/framebuffers/pipewire/pw_framebuffer.cpp?ref_type=heads#L337 isn't returning a valid size. It may be worth determining that before accepting this patch.

setVideoSize(qdbus_cast<QSize>(streams.first().map[QStringLiteral("size")].value<QDBusArgument>()));

This merge request was tested on Fedora Rawhide 2024-03-03 nightly build on an AMD Framework 13. They are using kPipewire 6.0 and Krfb 24.02. I confirmed there were no downstream patches.

This merge request is for 24.02 but the patch should apply cleanly to master. This will also resolve the related bug post on Mesa's side: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10395

Edited by Jordan Pryde

Merge request reports