Description
There seems to be some bugs in the H264 decoder. I am streaming video from another Raspberry Pi, and it was working fine, until I made the video a few pixels taller so I could add the time, date and other info in a bar along the bottom of the video. (The video went from 1296x972 to 1280x1008. I had to reduce the width due to #1608 but I don't think it's related.)
Since then, the playback stops randomly. I am playing two video streams at the same time (only one of which has had its size changed and started this problem), and when this bug is triggered, both streams break. Sometimes part of the picture from one video ends up showing in the other video's window, sometimes the video becomes very badly corrupted (turns green and magenta) but mostly the video just stops updating leaving only the last frame visible.
In order to fix it I have to exit both video players and restart - closing only one player is not enough. Sometimes only restarting one player will show no video, but sometimes it comes up with the last stuck frame still visible. Exiting all players and reloading them all gets this working again, but only for another few minutes until it crashes again.
I get various messages in the logs when this happens. Here is one exerpt:
[ 1645.031404] bcm2835_mmal_vchiq: timed out waiting for sync completion
[ 1648.103401] bcm2835_mmal_vchiq: timed out waiting for sync completion
[ 1648.103439] bcm2835-codec bcm2835-codec: bcm2835_codec_stop_streaming: Failed disabling o/p port, ret -62
[ 1650.119420] bcm2835-codec bcm2835-codec: bcm2835_codec_stop_streaming: Timeout waiting for buffers to be returned - 19 outstanding
[ 1650.119534] ------------[ cut here ]------------
[ 1650.119577] WARNING: CPU: 2 PID: 773 at drivers/media/common/videobuf2/videobuf2-core.c:1945 __vb2_queue_cancel+0x1b0/0x220 [videobuf2_common]
[ 1650.119585] Modules linked in: rpcsec_gss_krb5 option usb_wwan vc4 usbserial btsdio cec bcm2835_codec(C) bcm2835_isp(C) bluetooth bcm2835_v4l2(C) bcm2835_mmal_vchiq(C) drm_kms_helper v4l2_mem2mem ecdh_generic videobuf2_vmalloc ecc videobuf2_dma_contig snd_soc_core videobuf2_memops videobuf2_v4l2 snd_compress videobuf2_common snd_pcm_dmaengine videodev v3d gpu_sched raspberrypi_hwmon iproc_rng200 mc snd_pcm snd_timer snd syscopyarea sysfillrect sysimgblt fb_sys_fops rpivid_mem uio_pdrv_genirq nvmem_rmem uio sch_fq_codel drm fuse drm_panel_orientation_quirks ip_tables x_tables ipv6 sr_mod cdrom brcmfmac cfg80211 brcmutil
[ 1650.119832] CPU: 2 PID: 773 Comm: video_decoder Tainted: G C 5.10.52-4-ARCH #1
[ 1650.119842] Hardware name: Raspberry Pi 4 Model B Rev 1.1 (DT)
[ 1650.119855] pstate: 80000005 (Nzcv daif -PAN -UAO -TCO BTYPE=--)
[ 1650.119874] pc : __vb2_queue_cancel+0x1b0/0x220 [videobuf2_common]
[ 1650.119893] lr : __vb2_queue_cancel+0x34/0x220 [videobuf2_common]
[ 1650.119901] sp : ffffffc01a61baf0
[ 1650.119909] x29: ffffffc01a61baf0 x28: 0000007f94b91750
[ 1650.119925] x27: ffffffc010fdc000 x26: ffffffc01a61be50
[ 1650.119941] x25: ffffff8043dab868 x24: ffffff8069c05f40
[ 1650.119955] x23: ffffff8043d602a0 x22: ffffff8043baa300
[ 1650.119971] x21: ffffff80428d7028 x20: ffffff80428d70d0
[ 1650.119985] x19: ffffff80428d7028 x18: 0000000000000030
[ 1650.120000] x17: 0000000000000000 x16: 0000000000000000
[ 1650.120015] x15: ffffff8069c05e80 x14: 00000000000001d2
[ 1650.120029] x13: ffffff8069c05e80 x12: ffffffc01a61b760
[ 1650.120043] x11: ffffffc01123bae0 x10: 00000000fffff000
[ 1650.120058] x9 : ffffffc01123bae0 x8 : ffffffc0111e3ae0
[ 1650.120072] x7 : ffffffc01123bae0 x6 : 0000000000000000
[ 1650.120086] x5 : 0000000000000000 x4 : ffffff80fb85d6c8
[ 1650.120101] x3 : ffffffc010fdc000 x2 : 6c8354effb15d400
[ 1650.120116] x1 : 00000000000055ac x0 : 0000000000000013
[ 1650.120132] Call trace:
[ 1650.120152] __vb2_queue_cancel+0x1b0/0x220 [videobuf2_common]
[ 1650.120170] vb2_core_queue_release+0x24/0x50 [videobuf2_common]
[ 1650.120188] vb2_queue_release+0x10/0x20 [videobuf2_v4l2]
[ 1650.120210] v4l2_m2m_ctx_release+0x20/0x40 [v4l2_mem2mem]
[ 1650.120225] bcm2835_codec_release+0x5c/0xf4 [bcm2835_codec]
[ 1650.120288] v4l2_release+0xbc/0xf0 [videodev]
[ 1650.120304] __fput+0x78/0x230
[ 1650.120314] ____fput+0x10/0x20
[ 1650.120327] task_work_run+0x80/0x140
[ 1650.120339] do_exit+0x32c/0xa10
[ 1650.120348] do_group_exit+0x38/0xa0
[ 1650.120359] get_signal+0x10c/0x844
[ 1650.120372] do_notify_resume+0x188/0x9d0
[ 1650.120381] work_pending+0xc/0x43c
[ 1650.120390] ---[ end trace 5fd4ec3580a88085 ]---
[ 1650.120406] videobuf2_common: driver bug: stop_streaming operation is leaving buf 00000000ac96b1de in active state
[ 1650.120420] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000003219955b in active state
[ 1650.120432] videobuf2_common: driver bug: stop_streaming operation is leaving buf 00000000e7922934 in active state
[ 1650.120444] videobuf2_common: driver bug: stop_streaming operation is leaving buf 00000000253d780c in active state
[ 1650.120454] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000003380b69f in active state
[ 1650.120463] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000002566c086 in active state
[ 1650.120474] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000005c8d5e2a in active state
[ 1650.120485] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000009293a3da in active state
[ 1650.120494] videobuf2_common: driver bug: stop_streaming operation is leaving buf 00000000f9455a5d in active state
[ 1650.120504] videobuf2_common: driver bug: stop_streaming operation is leaving buf 00000000b31fb82e in active state
[ 1650.120515] videobuf2_common: driver bug: stop_streaming operation is leaving buf 0000000060988941 in active state
[ 1650.120525] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000001d57d7a5 in active state
[ 1650.120535] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000000688a4ea in active state
[ 1650.120544] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000007eb7ac4f in active state
[ 1650.120556] videobuf2_common: driver bug: stop_streaming operation is leaving buf 00000000f938963d in active state
[ 1650.120565] videobuf2_common: driver bug: stop_streaming operation is leaving buf 0000000089ad923c in active state
[ 1650.120576] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000000a274fa8 in active state
[ 1650.120586] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000006ccfd1f0 in active state
[ 1650.120596] videobuf2_common: driver bug: stop_streaming operation is leaving buf 000000000995f2d6 in active state
[ 1650.728701] bcm2835_mmal_vchiq: received invalid message context 25!
[ 1650.728741] bcm2835_mmal_vchiq: drvbuf.client_context(80) is invalid
[ 1650.728755] bcm2835_mmal_vchiq: drvbuf.client_context(81) is invalid
[ 1650.728769] bcm2835_mmal_vchiq: drvbuf.client_context(82) is invalid
[ 1650.728782] bcm2835_mmal_vchiq: drvbuf.client_context(63) is invalid
[ 1650.728796] bcm2835_mmal_vchiq: drvbuf.client_context(64) is invalid
[ 1650.728810] bcm2835_mmal_vchiq: drvbuf.client_context(65) is invalid
[ 1650.728824] bcm2835_mmal_vchiq: drvbuf.client_context(66) is invalid
[ 1650.728837] bcm2835_mmal_vchiq: drvbuf.client_context(67) is invalid
[ 1650.728886] bcm2835_mmal_vchiq: drvbuf.client_context(68) is invalid
[ 1650.728903] bcm2835_mmal_vchiq: drvbuf.client_context(70) is invalid
[ 1650.728917] bcm2835_mmal_vchiq: drvbuf.client_context(69) is invalid
[ 1650.728980] bcm2835_mmal_vchiq: drvbuf.client_context(71) is invalid
[ 1650.728995] bcm2835_mmal_vchiq: drvbuf.client_context(72) is invalid
[ 1650.729010] bcm2835_mmal_vchiq: drvbuf.client_context(73) is invalid
[ 1650.729022] bcm2835_mmal_vchiq: drvbuf.client_context(74) is invalid
[ 1650.729037] bcm2835_mmal_vchiq: drvbuf.client_context(75) is invalid
[ 1650.729051] bcm2835_mmal_vchiq: drvbuf.client_context(76) is invalid
[ 1650.729065] bcm2835_mmal_vchiq: drvbuf.client_context(77) is invalid
[ 1650.729078] bcm2835_mmal_vchiq: drvbuf.client_context(78) is invalid
[ 1650.828863] bcm2835-codec bcm2835-codec: bcm2835_codec_stop_streaming: Failed enabling component, ret -22
[ 1650.828961] bcm2835_mmal_vchiq: received invalid message context 21!
[ 1653.991452] bcm2835_mmal_vchiq: timed out waiting for sync completion
[ 1657.063441] bcm2835_mmal_vchiq: timed out waiting for sync completion
[ 1657.063481] bcm2835_mmal_vchiq: vchiq_mmal_component_init: failed to create component -62 (Not enough GPU mem?)
[ 1657.063495] bcm2835-codec bcm2835-codec: bcm2835_codec_create_component: failed to create component ril.video_decode
[ 1660.139442] bcm2835_mmal_vchiq: timed out waiting for sync completion
[ 1660.139483] bcm2835_mmal_vchiq: vchiq_mmal_component_init: failed to create component -62 (Not enough GPU mem?)
[ 1660.139496] bcm2835-codec bcm2835-codec: bcm2835_codec_create_component: failed to create component ril.video_decode
[ 1663.207476] bcm2835_mmal_vchiq: timed out waiting for sync completion
[ 1663.207516] bcm2835_mmal_vchiq: vchiq_mmal_component_init: failed to create component -62 (Not enough GPU mem?)
[ 1663.207535] bcm2835-codec bcm2835-codec: bcm2835_codec_create_component: failed to create component ril.video_decode
[ 1663.626347] bcm2835_mmal_vchiq: received invalid message context 5!
[ 1663.628625] bcm2835-codec bcm2835-codec: bcm2835_codec_create_component: failed to create component ril.video_decode
[ 1663.629371] bcm2835_mmal_vchiq: received invalid message context 1!
[ 1663.629395] bcm2835_mmal_vchiq: received invalid message context 1!
[ 1663.629626] bcm2835_mmal_vchiq: received invalid message context 1!
[ 1668.839518] bcm2835-codec bcm2835-codec: bcm2835_codec_stop_streaming: Timeout waiting for buffers to be returned - 19 outstanding
I tried increasing the GPU mem as suggested. It was initially gpu_mem=128
which was fine until I enlarged the video, now I get the same messages even if I specify gpu_mem=384
. I can't go large than this or the Pi won't boot. I have cma=300M
but changing this value doesn't seem to do anything.
System
- Which model of Raspberry Pi? Pi 4
- Which OS and version (
cat /etc/rpi-issue
)? Arch Linux ARM 64-bit - Which firmware version (
vcgencmd version
)?
Sep 14 2021 16:51:17
Copyright (c) 2012 Broadcom
version 1f74fc33fa785915fe0d7bd6d1cdfa220bc1ed7b (clean) (release) (start)
- Which kernel version (
uname -a
)?
Linux 5.10.63-8-ARCH #1 SMP PREEMPT Thu Sep 16 14:24:31 UTC 2021 aarch64 GNU/Linux