VPU crash after a while playing video on imx8mp and imx8mm

Hi there,

I’ve added cog + wpewebkit to tdx-multimedia-reference-image to have a GUI based on web-app, and that app have a video playing on the screen.

The video is OK for a while, but after a couple of hours (random?) the VPU seems to crash, and the video disappears. If i restart cog, the video shows up again.

Does anyone had the same problem with imx8m? I’ve found a imx-vpuwrap in meta-toradex-nxp backports folder… does any one knows if there’s a reason for not using the one in meta-freescale? or if maybe it’s related?

The problem seems to appear in imx8mm and imx8mp.

Thanks in advance

Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: ====== AIUR: 4.5.7 build on Nov 13 2020 08:36:18. ======
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:         Core: MPEG4PARSER_06.17.17  build on Nov 12 2020 05:13:57
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:  file: /usr/lib/imx-mm/parser/lib_mp4_parser_arm_elinux.so.3.2
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: ------------------------
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:     Track 00 [video_0] Enabled
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:         Duration: 0:00:10.051708000
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:         Language: eng
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:     Mime:
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:         video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)avc, width=(int)800, height=(int)486, framerate=(fraction)24000/1001, codec_data=(buffer)0142c01effe100186742c01ed900c83ff9b01100000303e90000bb800f162e4801000568cb83cb20
Jan 19 17:12:21 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: ------------------------
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: ====== VPUDEC: 4.5.7 build on Nov 13 2020 08:36:18. ======
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:         wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Aug 17 2020 07:03:22)
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:         vpulib: 1.1.1
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]:         firmware: 1.1.1.0
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.228298500 167827 0xfffed45bd6d0 ERROR                default gstallocatorphymem.c:149:base_alloc: Allocate phymem 16777232 failed.
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.228341500 167827 0xfffed45bd6d0 ERROR                default gstvpu.c:90:gst_vpu_allocate_internal_mem: Could not allocate memory using VPU allocator
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.228367125 167827 0xfffed45bd6d0 ERROR         vpu_dec_object gstvpudecobject.c:342:gst_vpu_dec_object_start:<vpudecobject184> gst_vpu_allocate_internal_mem fail
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.228392000 167827 0xfffed45bd6d0 WARN            videodecoder gstvideodecoder.c:2532:gst_video_decoder_change_state:<vpudec184> error: Failed to start decoder
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.228467875 167827 0xfffed45bd6d0 WARN               decodebin gstdecodebin2.c:2526:connect_pad:<decodebin185> Couldn't set vpudec184 to PAUSED
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.228915875 167827 0xfffed45bd6d0 WARN            uridecodebin gsturidecodebin.c:920:unknown_type_cb:<uridecodebin185> warning: No decoder available for type 'video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)avc, width=(int)800, height=(int)486, framerate=(fraction)24000/1001, codec_data=(buffer)0142c01effe100186742c01ed900c83ff9b01100000303e90000bb800f162e4801000568cb83cb20, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, profile=(string)constrained-baseline, level=(string)3'.
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.229192750 167827 0xfffed45bd6d0 WARN               decodebin gstdecodebin2.c:4681:gst_decode_bin_expose:<decodebin185> error: no suitable plugins found:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Couldn't set vpudec184 to PAUSED:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Could not initialize supporting library.
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Could not initialize supporting library.
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: ../git/gst-libs/gst/video/gstvideodecoder.c(2532): gst_video_decoder_change_state (): /GstPlayBin:media-player-185/GstURIDecodeBin:uridecodebin185/GstDecodeBin:decodebin185/GstVpuDec:vpudec184:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Failed to start decoder
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.229275750 167827 0xfffed45bd6d0 WARN            uridecodebin gsturidecodebin.c:987:no_more_pads_full:<uridecodebin185> error: no suitable plugins found:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: ../git/gst/playback/gstdecodebin2.c(4681): gst_decode_bin_expose (): /GstPlayBin:media-player-185/GstURIDecodeBin:uridecodebin185/GstDecodeBin:decodebin185:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: no suitable plugins found:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Couldn't set vpudec184 to PAUSED:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Could not initialize supporting library.
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Could not initialize supporting library.
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: ../git/gst-libs/gst/video/gstvideodecoder.c(2532): gst_video_decoder_change_state (): /GstPlayBin:media-player-185/GstURIDecodeBin:uridecodebin185/GstDecodeBin:decodebin185/GstVpuDec:vpudec184:
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: Failed to start decoder
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.229510000 167827 0xffff68004500 ERROR      webkitmediaplayer MediaPlayerPrivateGStreamer.cpp:1806:handleMessage: Error 12: Your GStreamer installation is missing a plug-in. (url=http://127.0.0.1:8080/web-app-gui/video.mp4)
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.229573625 167827 0xfffed45bd6d0 WARN               aiurdemux aiurdemux.c:3370:aiurdemux_send_stream_newsegment: Pad video: Send newseg 0:00:00.000000000 first buffer 0:00:00.000000000
Jan 19 17:12:22 emotion-imx8mp-06849098 wayland-app-launch.sh[167827]: 0:41:31.232963750 167827 0xfffed45bd6d0 WARN               aiurdemux aiurdemux.c:3508:aiurdemux_push_pad_buffer: Pad video push error type -1

Hi @anonymouse !

Could you please share more information about your issue?

  • Which exact module are you using? (Full name and version)
  • On which BSP your image is based?
  • This log that you shared is related to what? To your Webapp? To COG?
    • There are some failures related to VPU that seems to have occurred just after launching the video playback. When was this log captured: when the video playback started or when the video playback stopped working?

Best regards,

1 Like

Hi @henrique.tx \o,

I’m using Verdin iMX8M Plus Quad 2GB and Dahlia Carrier Board with HDMI Adapter as CB. (I’ve tried and the same problem appears on NXP i.MX 8M Mini / Nano - Verdin System on Module)

i’m using your BSP from your git, on dunfell-5.x.y branch with MACHINE=“verdin-imx8mp”. I’m using tdx-reference-multimedia-image image only with cog/wpewebkit added to it.

The logs are from cog with GST_DEBUG=3. The video plays very well when cog starts, but it stops after a couple of hours playing in loop.

Regards

Hi @anonymouse !

Thanks for the information.

So your application is repeatedly restarting the playback of the video. Is that right?

Best regards,

1 Like

Hi @henrique.tx ,

Thats it!

Regards

Hi @henrique.tx ,

Another clue that might help, in dmesg when the video stops the following message appears:

[306902.615291] cma: cma_alloc: alloc failed, req-size: 4097 pages, ret: -12

Regards

Hi @anonymouse !

Could you please share a minimal webapp that is able to reproduce the issue?

So I can try to reproduce it from my side and investigate.

Best regards,

1 Like

Hi there @henrique.tx ,

I’ll isolate the problem in a single app and send it to you!

Regards

videodemo.zip (2.1 MB)

Hi @henrique.tx ,

attached a simple app with video that triggers this problem.

Regards

Hi @anonymouse !

For the test I am using:

  • Verdin iMX8MP Q 4GB WB IT V1.0B
  • Reference Multimedia from BSP 5.4.0 + Cog

I scp’d the zip to the module and unpacked it there:

Contents of the videodemo folder
root@verdin-imx8mp-06849036:~# ls -la videodemo
total 1152
drwxr-xr-x 5 root root    4096 Feb 10 21:03 .
drwx------ 9 root root    4096 Feb 10 21:03 ..
drwxrwxrwx 2 root root    4096 Feb 10 21:03 css
-rw-r--r-- 1 root root    4286 Feb 10 21:03 favicon.ico
drwxrwxrwx 3 root root    4096 Feb 10 21:03 img
-rw-r--r-- 1 root root    1659 Feb 10 21:03 index.html
drwxrwxrwx 2 root root    4096 Feb 10 21:03 js
-rw-r--r-- 1 root root     553 Feb 10 21:03 manifest.json
-rw-r--r-- 1 root root     767 Feb 10 21:03 precache-manifest.866d8f88a6003279e3b21971020d647c.js
-rw-r--r-- 1 root root      24 Feb 10 21:03 robots.txt
-rw-r--r-- 1 root root    1065 Feb 10 21:03 service-worker.js
-rw-r--r-- 1 root root 1128375 Feb 10 21:03 video.mp4

When I run your index.html:

root@verdin-imx8mp-06849036:~/videodemo#  cog -P fdo index.html 

(cog:3462): Cog-Core-WARNING **: 21:09:56.697: Platform module name 'fdo' is deprecated, please use 'wl' instead.

(cog:3462): GLib-GIO-WARNING **: 21:09:56.746: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal.  It should do one of these.
Cog-Core-Message: 21:09:57.010: <file:///home/root/videodemo/index.html> Load started.
Cog-Core-Message: 21:09:57.021: <file:///home/root/videodemo/index.html> Loading...
Cog-Core-Message: 21:09:57.052: <file:///home/root/videodemo/index.html> Loaded successfully.
^Croot@verdin-imx8mp-06849036:~/videodemo#  cog -P wl index.html 

(cog:3501): GLib-GIO-WARNING **: 21:10:00.731: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal.  It should do one of these.
Cog-Core-Message: 21:10:00.989: <file:///home/root/videodemo/index.html> Load started.
Cog-Core-Message: 21:10:01.001: <file:///home/root/videodemo/index.html> Loading...
Cog-Core-Message: 21:10:01.031: <file:///home/root/videodemo/index.html> Loaded successfully.
^Croot@verdin-imx8mp-06849036:~/videodemo# 

I get a blank screen (from both attempts):

As a sanity check, I loaded google.com, youtube.com (and played a video) and another simplistic local index.html and everyone worked.

Do I need to do something special to use your videodemo?

Best regards,

1 Like

Hi there @henrique.tx ,

This page must be hosted with some type of web-server. I personally use nginx in this case, but any other server should be fine.

Regards

Hi @anonymouse

I finally could start the test.

I am recording the serial output and the HDMI video output of a Verdin iMX8M Plus. The videodemo is hosted on my notebook and the Cog browser is accessing the website via local network.

As soon as possible, I get back to you with the results.

Best regards,

1 Like

Hi @henrique.tx ,

Thanks! fingers-crossed then :stuck_out_tongue:

regards

Hi @anonymouse !

I let the system run for a straight 23h and I had no problem with the video. The browser is still responsible and the video is still running.

As a comparison, this is the memory usage right after booting the system before launching Cog (weston is up and running)

root@verdin-imx8mp-06849036:~# free -m
              total        used        free      shared  buff/cache   available
Mem:           3635         377        3175           6          83        3144
Swap:             0           0           0

This is the memory usage right after launching Cog with videodemo:

root@verdin-imx8mp-06849036:~# free -m
              total        used        free      shared  buff/cache   available
Mem:           3635         542        2922           7         170        2951
Swap:             0           0           0

And this is the memory usage after running for 23h:

root@verdin-imx8mp-06849036:~# free -m
              total        used        free      shared  buff/cache   available
Mem:           3635         788        2663           7         183        2704
Swap:             0           0           0

Supposing that the problem is related to a memory leak, we can see that the free memory is shrinking (and used is growing), but in this 23h I plugged/unplugged the HDMI and plugged/unplugged the mouse. Although it is possible that this behavior could lead to VPU being unable to allocate memory, we are not sure that there indeed is a memory leak.

If you want to further investigate it, you can:

Best regards,


Below I pasted the output from /etc/os-release and from Cog itself on Verdin iMX8M Plus.

/etc/os-release
root@verdin-imx8mp-06849036:~# cat /etc/os-release 
ID=tdx-xwayland
NAME="TDX Wayland with XWayland"
VERSION="5.4.0-devel-20210930172359+build.0 (dunfell)"
VERSION_ID=5.4.0-devel-20210930172359-build.0
PRETTY_NAME="TDX Wayland with XWayland 5.4.0-devel-20210930172359+build.0 (dunfell)"
Cog output
root@verdin-imx8mp-06849036:~# date
Tue Feb 21 12:32:53 UTC 2022
root@verdin-imx8mp-06849036:~#
root@verdin-imx8mp-06849036:~#
root@verdin-imx8mp-06849036:~# cog 192.168.0.20:8080 # this is the notebook where nginx (docker) is hosting the videodemo example shared by the customer

(cog:1163): GLib-GIO-WARNING **: 12:33:16.728: Your application does not implement g_application_activate() and has no handlers connected to the 'activate' signal.  It should do one of these.
Cog-Core-Message: 12:33:16.995: <http://192.168.0.20:8080/> Load started.
Cog-Core-Message: 12:33:17.000: <http://192.168.0.20:8080/> Loading...

====== AIUR: 4.5.7 build on Nov 13 2020 08:36:18. ======
	Core: MPEG4PARSER_06.17.17  build on Nov 12 2020 05:13:57
 file: /usr/lib/imx-mm/parser/lib_mp4_parser_arm_elinux.so.3.2
------------------------
    Track 00 [video_0] Enabled
	Duration: 0:00:05.005000000
	Language: und
    Mime:
	video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)avc, width=(int)960, height=(int)540, framerate=(fraction)30000/1001, codec_data=(buffer)0164001fffe1001d6764001fac56240f0117ef016a0c0c0c800001f480007530078c18c4c001000668e88ecb22c0fdf8f800 
------------------------
====== VPUDEC: 4.5.7 build on Nov 13 2020 08:36:18. ======
	wrapper: 3.0.0 (VPUWRAPPER_ARM64_LINUX Build on Aug 17 2020 07:03:22)
	vpulib: 1.1.1
	firmware: 1.1.1.0
------------------------
    Track 01 [audio_0] Enabled
	Duration: 0:00:05.056000000
	Language: und
    Mime:
	audio/mpeg, mpegversion=(int)4, channels=(int)2, rate=(int)48000, bitrate=(int)0, stream-format=(string)raw, codec_data=(buffer)1190 
------------------------

====== BEEP: 4.5.7 build on Nov 13 2020 08:36:18. ======
	Core: AAC decoder Wrapper  build on Jul 28 2020 10:45:34
 file: /usr/lib/imx-mm/audio-codec/wrap/lib_aacd_wrap_arm_elinux.so.3
CODEC: BLN_MAD-MMCODECS_AACD_ARM_03.09.00_ARMV8  build on Sep 20 2017 15:02:50.
Cog-Core-Message: 12:33:20.070: <http://192.168.0.20:8080/#/> Loaded successfully.
^C
root@verdin-imx8mp-06849036:~#
root@verdin-imx8mp-06849036:~#
root@verdin-imx8mp-06849036:~# date
Tue Feb 22 11:44:38 UTC 2022