Bug 446061 - Buffer for spa_pod_builder can be too small for some setup
Summary: Buffer for spa_pod_builder can be too small for some setup
Status: RESOLVED FIXED
Alias: None
Product: plasmashell
Classification: Plasma
Component: Task Manager and Icons-Only Task Manager (show other bugs)
Version: 5.23.3
Platform: Debian testing Linux
: NOR normal
Target Milestone: 1.0
Assignee: Eike Hein
URL:
Keywords:
: 443719 446553 446709 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-11-25 04:40 UTC by oiiu19
Modified: 2022-01-06 17:39 UTC (History)
8 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.24
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description oiiu19 2021-11-25 04:40:54 UTC
SUMMARY
Libtaskmanager's buffer for spa_builder (see https://invent.kde.org/plasma/plasma-workspace/-/blob/master/libtaskmanager/declarative/pipewiresourcestream.cpp#L187) is too small on certain configurations. Because podBuilder->state.offset is never reset (https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/spa/include/spa/pod/builder.h), the buffer space can run out when EGL returns a long list of dma_buf modifiers, causing PipeWire negotiation to fail.

An example is when EGL returns 20 modifiers. There are 6 formats defined in pipewiresourcestream.cpp, for each format it will construct 2 frames, one with 21*8=168 bytes long of modifiers. The modifier lists for all frames will be 6*168=1008 bytes (only 16 bytes left of 1024 bytes), let alone other frames.

This seems to be the root cause for Bug 445461, but does not resolve Bug 444107 completely.


SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Debian testing
KDE Plasma Version: 5.23.3
KDE Frameworks Version: 5.86.0
Qt Version: 5.15.2
Comment 2 pmargeti34 2021-12-08 12:33:32 UTC
*** Bug 446553 has been marked as a duplicate of this bug. ***
Comment 3 David Edmundson 2021-12-08 12:33:53 UTC
*** Bug 443719 has been marked as a duplicate of this bug. ***
Comment 4 pmargeti34 2021-12-08 12:38:51 UTC
I can confirm oiiu19's findings. My bugreport https://bugs.kde.org/show_bug.cgi?id=446553 states the details. I've modified the source code as suggested by oiiu19 to increase the buffer size from 1024 to 4096 and that restored the ability to view task manager previews in a wayland session. I'm not saying 4096 buffer size is the optimal value here, it was the just first value that I tried and it worked.
Comment 5 Bug Janitor Service 2021-12-08 13:10:32 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1262
Comment 6 David Edmundson 2021-12-08 13:11:00 UTC
oiiu19 if you give me your full name, I'll put you as the commit author.
Comment 7 oiiu19 2021-12-09 01:59:21 UTC
I would like to stay anonymous due to personal reasons.
Comment 8 Nate Graham 2021-12-09 19:29:40 UTC
*** Bug 446709 has been marked as a duplicate of this bug. ***
Comment 9 pmargeti34 2022-01-05 11:46:02 UTC
Guess this didn't get merged in time for 5.23.5?
Comment 10 Nate Graham 2022-01-06 17:39:11 UTC
Git commit 926f864756e5586f38574c166abdb5befa3dc771 by Nate Graham, on behalf of David Edmundson.
Committed on 06/01/2022 at 17:38.
Pushed by ngraham into branch 'master'.

[libtaskmanager] Increase buffer for pipewire format negotiation

Libtaskmanager's buffer for spa_builder  is too small on certain
configurations. Because podBuilder->state.offset is never reset, the
buffer space can run out when EGL returns a long list of dma_buf
modifiers, causing PipeWire negotiation to fail.

An example is when EGL returns 20 modifiers. There are 6 formats defined
in pipewiresourcestream.cpp, for each format it will construct 2 frames,
one with 21*8=168 bytes long of modifiers. The modifier lists for all
frames will be 6*168=1008 bytes (only 16 bytes left of 1024 bytes), let
alone other frames.

M  +1    -1    libtaskmanager/declarative/pipewiresourcestream.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/926f864756e5586f38574c166abdb5befa3dc771