This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM67A: Gstreamer element v4l2h265dec uses absurd amount of CPU %

Part Number: AM67A
Other Parts Discussed in Thread: BEAGLEY-AI

Tool/software:

Hi,

We are evaluating AM67A SoC using BeagleY-AI board.

We tried below gstreamer pipeline to evaluate hardware accelerated encoder and decoder.

gst-launch-1.0 rtspsrc name=rtspsrc1 add-reference-timestamp-meta=true location=rtsp://admin:123456@10.36.3.13:554/cam1/mpeg4 do-retransmission=true drop-on-latency=false latency=10  protocols=tcp \
! rtph265depay name=depay1 ! h265parse \
! v4l2h265dec capture-io-mode=4 output-io-mode=4 
! tiovxmemalloc ! video/x-raw,format=NV12 ! queue max-size-buffers=0 name=decoder1 
! tiovxdlcolorconvert ! video/x-raw,format=RGB 
! autovideosink 
 

While running the pipeline we observed that a lot of CPU is being used by decoder.

Is there any particular reason for this behavior? It looks like this element is using CPU for decoding,

Best Regards,

Srimal

  • Hi Srimal,

    Can you set the capture-io-mode property to 5?

    Best,
    Jared

  • Hi Jared.

    Thanks for your reply. I modified the pipeline as you mentioned.

    Now I see below error

    ERROR: from element /GstPipeline:pipeline0/v4l2h265dec:v4l2h265dec0: Failed to allocate required memory

    What could be the issue here?

  • Hi Srimal,

    Looks like there's an issue with the interaction between the tiovx plugins and the decoder. Can you try one of the patches given here: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1517031/processor-sdk-j722s-purpose-of-stride-y-align-and-stride-x-align-in-gst_tiovx_get_exemplar_from_caps 

    Best,
    Jared

  • Hi Jared,

    Thanks a lot for the information. This resolved my issue. However I am not able to run 4 pipelines at the same time. Only two h265 pipelines are possible. Otherwise Device freezes. 
    Have you experienced a similar situation before?

    Best Regards.

    Srimal

  • Hi Srimal,

    What are the pipelines' resolutions and framerates?

    Best,
    Jared

  • We are running h265 1080p at 25fps 700k bitrate

  • Hi Srimal,

    That should be fine. Can you test the following pipeline:

    $ gst-launch-1.0 \
    filesrc location=test0.h265 ! h265parse ! v4l2h265dec ! fakesink \
    filesrc location=test1.h265 ! h265parse ! v4l2h265dec ! fakesink \
    filesrc location=test2.h265 ! h265parse ! v4l2h265dec ! fakesink \
    filesrc location=test3.h265 ! h265parse ! v4l2h265dec ! fakesink

    Best,
    Jared

  • Hi Jared,

    Whenever 3rd pipeline is started, device freezes. I can run 2 pipelines safely.

    Best Regards,

    Srimal

  • Hi Jared,

    When the device freezes, below kernal panic happens

    dec 30210000.video-codec: wave5_vpu_firmware_command_queue_error_check: result not ready: 0x800
    [Jun11 11:37] Unable to handle kernel paging request at virtual address 7984798479847980
    [  +0.008284] Mem abort info:
    [  +0.003018]   ESR = 0x0000000096000004
    [  +0.000046] Unable to handle kernel paging request at virtual address 0060626465656560
    [  +0.003979]   EC = 0x25: DABT (current EL), IL = 32 bits
    [  +0.008081] Mem abort info:
    [  +0.005552]   SET = 0, FnV = 0
    [  +0.002681]   ESR = 0x0000000096000004
    [  +0.003034]   EA = 0, S1PTW = 0
    [  +0.003733]   EC = 0x25: DABT (current EL), IL = 32 bits
    [  +0.003180]   FSC = 0x04: level 0 translation fault
    [  +0.005257]   SET = 0, FnV = 0
    [  +0.000005]   EA = 0, S1PTW = 0
    [  +0.000003]   FSC = 0x04: level 0 translation fault
    [  +0.000004] Data abort info:
    [  +0.000002]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [  +0.000003]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [  +0.000004]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [  +0.000005] [0060626465656560] address between user and kernel address ranges
    [  +0.000005] Internal error: Oops: 0000000096000004 [#1] PREEMPT SMP
    [  +0.000006] Modules linked in: onboard_usb_hub cdns3 cdns_usb_common rpmsg_ctrl rpmsg_char
    [  +0.004959] Data abort info:
    [  +0.002962]  overlay cfg80211 crct10dif_ce pvrsrvkm(O) cc33xx_sdio e5010_jpeg_enc pci_endpoint_test at24 v4l2_jpeg cdns3_ti pwm_fan tps65219_pwrbutton rtc_ds1307 wave5 bluetooth videobuf2_dma_contig ecdh_generic ecc videobuf2_memops k3_j72xx_bandgap v4l2_mem2mem rfkill videobuf2_v4l2 videobuf2_common rti_wdt rtc_ti_k3 videodev ti_k3_r5_remoteproc mcrc64 snd_soc_hdmi_codec ti_k3_dsp_remoteproc mc sa2ul omap_mailbox cdns_dphy omap_hwspinlock
    [  +0.003233]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [  +0.004840]  pwm_tiehrpwm pwm_tiecap cryptodev(O) fuse ipv6
    [  +0.000018] CPU: 0 PID: 135 Comm: systemd-journal Tainted: G           O       6.6.44-ti-01478-g541c20281af7-dirty #1
    [  +0.000009] Hardware name: BeagleBoard.org BeagleY-AI (DT)
    [  +0.000006] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [  +0.000007] pc : __d_lookup_rcu+0x4c/0xf8
    [  +0.000021] lr : lookup_fast+0x34/0x140
    [  +0.000010] sp : ffff800081b7bb00
    [  +0.000002] x29: ffff800081b7bb00 x28: ffff000822c28e40 x27: 0000000000000000
    [  +0.000011] x26: 2f2f2f2f2f2f2f2f x25: d0d0d0d0d0d0d0d0
    [  +0.002937]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [  +0.005399]  x24: ffff800081b7bc20
    [  +0.000005] x23: fefefefefefefeff x22: ffff00082291e025 x21: ffff00082194f540
    [  +0.000009] x20: ffff800081b7bc20 x19: ffff800081b7bc20 x18: 0000000000000000
    [  +0.000010] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
    [  +0.000010] x14: 0000000000000000 x13: ffff00082291e021 x12: ffff800081b7bc64
    [  +0.000009] x11: 0000000335125a0d x10: 0000fffffffffff8 x9 : 0000000000000003
    [  +0.000010] x8 : ffff00082194f540 x7 : a4a3a9a3ffbea5a2 x6 : 0000000000200000
    [  +0.000009] x5 : ffff8000813ec000 x4 : 000000000001a892 x3 : ffff000843400000
    [  +0.000011] x2 : 0000000000000003 x1 : 5f60626465656564 x0 : 5f60626465656564
    [  +0.000010] Call trace:
    [  +0.000003]  __d_lookup_rcu+0x4c/0xf8
    [  +0.000011]  walk_component+0x28/0x190
    [  +0.000009]  link_path_walk.part.0.constprop.0+0x25c/0x384
    [  +0.000012]  path_lookupat+0x3c/0x1a8
    [  +0.000008]  filename_lookup+0xb0/0x1ac
    [  +0.005189]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [  +0.005148]  user_path_at_empty+0x4c/0x74
    [  +0.000013]  do_faccessat+0x120/0x324
    [  +0.000009]  __arm64_sys_faccessat+0x24/0x30
    [  +0.000008]  invoke_syscall+0x48/0x114
    [  +0.000010]  el0_svc_common.constprop.0+0xc0/0xe0
    [  +0.000008]  do_el0_svc+0x1c/0x28
    [  +0.000007]  el0_svc+0x2c/0x84
    [  +0.007281] [7984798479847980] address between user and kernel address ranges
    [  +0.006085]  el0t_64_sync_handler+0x120/0x12c
    [  +0.000015]  el0t_64_sync+0x190/0x194
    [  +0.000012] Code: d360fd62 14000003 f9400021 b4000461 (b85fc02a) 
    [  +0.000007] ---[ end trace 0000000000000000 ]---
    [  +0.001445] Unable to handle kernel paging request at virtual address 002a2a2a292a2940
    [  +0.007002] Internal error: Oops: 0000000096000004 [#2] PREEMPT SMP
    [  +0.002788] Mem abort info:
    [  +0.000003]   ESR = 0x0000000096000004
    [  +0.009102] Unable to handle kernel paging request at virtual address 007473727372726e
    [  +0.000007] Mem abort info:
    [  +0.000002]   ESR = 0x0000000096000004
    [  +0.000003]   EC = 0x25: DABT (current EL), IL = 32 bits
    [  +0.000005]   SET = 0, FnV = 0
    [  +0.000003]   EA = 0, S1PTW = 0
    [  +0.000003]   FSC = 0x04: level 0 translation fault
    [  +0.000003] Data abort info:
    [  +0.000002]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [  +0.000003]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [  +0.000004]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [  +0.000005] [007473727372726e] address between user and kernel address ranges
    [  +0.029694] Modules linked in: onboard_usb_hub cdns3 cdns_usb_common rpmsg_ctrl rpmsg_char overlay cfg80211
    [  +0.005506]   EC = 0x25: DABT (current EL), IL = 32 bits
    [  +0.005535]  crct10dif_ce pvrsrvkm(O) cc33xx_sdio e5010_jpeg_enc pci_endpoint_test at24
    [  +0.010614]   SET = 0, FnV = 0
    [  +0.005448]  v4l2_jpeg cdns3_ti pwm_fan tps65219_pwrbutton rtc_ds1307 wave5
    [  +0.006962]   EA = 0, S1PTW = 0
    [  +0.003984]  bluetooth videobuf2_dma_contig ecdh_generic ecc
    [  +0.003836]   FSC = 0x04: level 0 translation fault
    [  +0.003291]  videobuf2_memops
    [  +0.007124] Data abort info:
    [  +0.005196]  k3_j72xx_bandgap v4l2_mem2mem rfkill videobuf2_v4l2 videobuf2_common
    [  +0.005050]   ISV = 0, ISS = 0x00000004, ISS2 = 0x00000000
    [  +0.003379]  rti_wdt rtc_ti_k3 videodev ti_k3_r5_remoteproc mcrc64
    [  +0.007131]   CM = 0, WnR = 0, TnD = 0, TagAccess = 0
    [  +0.007105]  snd_soc_hdmi_codec ti_k3_dsp_remoteproc mc sa2ul omap_mailbox
    [  +0.007133]   GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
    [  +0.007105]  cdns_dphy omap_hwspinlock pwm_tiehrpwm pwm_tiecap cryptodev(O) fuse
    [  +0.007132] [002a2a2a292a2940] address between user and kernel address ranges
    [  +0.007105]  ipv6
    [  +0.000008] CPU: 3 PID: 2193 Comm: decode:src Tainted: G      D    O       6.6.44-ti-01478-g541c20281af7-dirty #1
    [  +0.287113] Hardware name: BeagleBoard.org BeagleY-AI (DT)
    [  +0.005474] pstate: 20000005 (nzCv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
    [  +0.006950] pc : __d_lookup_rcu+0x4c/0xf8
    [  +0.004013] lr : lookup_fast+0x34/0x140
    [  +0.003830] sp : ffff800084283a80
    [  +0.003302] x29: ffff800084283a80 x28: ffff800084283c40 x27: 0000000000000000
    [  +0.007126] x26: 2f2f2f2f2f2f2f2f x25: d0d0d0d0d0d0d0d0 x24: ffff800084283c40
    [  +0.007126] x23: fefefefefefefeff x22: ffff00082362a025 x21: ffff00082194f540
    [  +0.007125] x20: ffff800084283c40 x19: ffff800084283c40 x18: 0000000000000000
    [  +0.007125] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
    [  +0.007125] x14: 0000000000000000 x13: ffff00082362a021 x12: ffff800084283c84
    [  +0.007125] x11: 000000035d51fe8a x10: 0000fffffffffff8 x9 : 0000000000000003
    [  +0.007124] x8 : ffff00082194f540 x7 : bfbdb5a2ffa6b5b4 x6 : 0000000000200000
    [  +0.007125] x5 : ffff8000813ec000 x4 : 000000000002ea8f x3 : ffff000843400000
    [  +0.007125] x2 : 0000000000000003 x1 : 7984798479847984 x0 : 7984798479847984
    [  +0.007126] Call trace:
    [  +0.002437]  __d_lookup_rcu+0x4c/0xf8
    [  +0.003655]  walk_component+0x28/0x190
    [  +0.003743]  link_path_walk.part.0.constprop.0+0x25c/0x384
    [  +0.005478]  path_openat+0xac/0xf7c
    [  +0.003483]  do_filp_open+0x9c/0x14c
    [  +0.003569]  do_sys_openat2+0xc4/0x104
    [  +0.003743]  __arm64_sys_openat+0x64/0xac
    [  +0.004000]  invoke_syscall+0x48/0x114
    [  +0.003744]  el0_svc_common.constprop.0+0xc0/0xe0
    [  +0.004694]  do_el0_svc+0x1c/0x28
    [  +0.003307]  el0_svc+0x2c/0x84
    [  +0.003050]  el0t_64_sync_handler+0x120/0x12c
    [  +0.004348]  el0t_64_sync+0x190/0x194
    [  +0.003657] Code: d360fd62 14000003 f9400021 b4000461 (b85fc02a) 
    [  +0.006078] ---[ end trace 0000000000000000 ]---

  • Hi Srimal,

    I do not see the issue on my setup (capture-io-mode=4 because the sink is fake).

    $ gst-launch-1.0 \
    filesrc location=test0.h265 ! h265parse ! v4l2h265dec capture-io-mode=4 ! fakesink \
    filesrc location=test1.h265 ! h265parse ! v4l2h265dec capture-io-mode=4 ! fakesink \
    filesrc location=test2.h265 ! h265parse ! v4l2h265dec capture-io-mode=4 ! fakesink \
    filesrc location=test3.h265 ! h265parse ! v4l2h265dec capture-io-mode=4 ! fakesink

    It seems your issue is due to something else in the pipeline. The test videos I am using are all 1080x2160@30fps.

    Additionally, can you open a new ticket as this is no longer relevant to the original question?

    Best,
    Jared