Skip to content

staging: vc04_services: bcm2835-codec: Signal every buffer returned during a flush - #7713

Open
rahmounirabii wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
rahmounirabii:bcm2835-codec-flush-last-buffer
Open

rahmounirabii wants to merge 1 commit into
raspberrypi:rpi-6.18.yfrom
rahmounirabii:bcm2835-codec-flush-last-buffer

Conversation

@rahmounirabii

Copy link
Copy Markdown

buffers_with_vpu is decremented in buffer_work_cb() before the buffer callback runs. With the port disabled, ip_buffer_cb() and op_buffer_cb() only signalled frame_cmplt if the counter was still non-zero, so the callback of the last returned buffer never signalled. When bcm2835_codec_flush_buffers() saw one buffer still with the VPU, it then slept the whole COMPLETE_TIMEOUT (2 s) under dev_mutex and logged "Timeout waiting for buffers to be returned - 0 outstanding", stalling QBUF/DQBUF of every other decoder instance meanwhile (a video playing in another instance freezes for ~2 s).

Signal frame_cmplt for every buffer returned while the port is disabled, including the EOS and error paths that are also counted in buffers_with_vpu, and make the flush wait loop while buffers remain with the VPU, each wait still bounded by COMPLETE_TIMEOUT.

Tested on a Pi 4B (6.18.50+rpt-rpi-v8): no occurrence of the timeout since 22 Oct, over ~45 h of signage playback plus an 8 h stress run (~4,700 decoder reuse cycles while another video plays). Details and reproduction in #7712.

Fixes #7712

…uring a flush

buffers_with_vpu is decremented in buffer_work_cb() before the buffer
callback runs. With the port disabled, ip_buffer_cb() and op_buffer_cb()
only signalled frame_cmplt if the counter was still non-zero, so the
callback of the last returned buffer never signalled. When
bcm2835_codec_flush_buffers() saw one buffer still with the VPU, it then
slept the whole COMPLETE_TIMEOUT (2 s) under dev_mutex and logged
"Timeout waiting for buffers to be returned - 0 outstanding", stalling
QBUF/DQBUF of every other decoder instance meanwhile (a video playing
in another instance freezes for ~2 s).

Signal frame_cmplt for every buffer returned while the port is disabled,
including the EOS and error paths that are also counted in
buffers_with_vpu, and make the flush wait loop while buffers remain with
the VPU, each wait still bounded by COMPLETE_TIMEOUT.

Link: raspberrypi#7712
Signed-off-by: Rabii Rahmouni <rahmounirabii.me@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant