Joshua-Riek / ubuntu-rockchip

Ubuntu for Rockchip RK35XX Devices
https://joshua-riek.github.io/ubuntu-rockchip-download/
GNU General Public License v3.0
2.39k stars 257 forks source link

Bug Report: DMA buffer - mpp_rkvenc2 fdbd0000.rkvenc-core: no memory region mapped #1002

Closed moo-the-cow closed 2 months ago

moo-the-cow commented 2 months ago

What happened?

trying to stream a v4l2 device (usb-webcam): ffmpeg -thread_queue_size 512 -i /dev/video1 -thread_queue_size 512 -f alsa -i plughw:CARD='Webcam' -c:v h264_rkmpp -profile:v baseline -tune zerolatency -c:a libopus -b:a 128k -ac 2 -f rtsp rtsp://localhost:8554/mystream

it's working fine on other boards like the orangepi5 (normal). from the logs it seems to me theres a problem with the DMA buffer not getting properly loaded?

Kernel version

6.1.0-1021-rockchip

SBC model

Orange Pi 5 Plus

What operating system are you seeing this problem on?

Ubuntu 24.04 LTS (Noble Nombat)

Relevant logs

dmesg

[   78.990804] dma-pl330 fed10000.dma-controller: pl330_submit_req:1722 Try increasing mcbufsz (440/256)
[   78.990812] dma-pl330 fed10000.dma-controller: fill_queue:2248 Bad Desc(2)

[  174.541361] rk_vcodec: mpp_task_dump_mem_region:2019: --- dump task 0 mem region ---
[  174.541368] mpp_rkvenc2 fdbd0000.rkvenc-core: no memory region mapped
[  174.541376] rk_vcodec: mpp_process_task_default:587: alloc_task failed.
[  174.541385] rkvenc2_wait_result:2340: session 00000000b9ad9b65 pending list is empty!
[  174.541392] rk_vcodec: mpp_msgs_wait:1628: session 3 wait result ret -5
[  174.662472] rk_vcodec: mpp_process_request:1369: can not import fd 113
[  174.662489] rk_vcodec: mpp_collect_msgs:1557: session 3 process cmd 401 ret -22
[  174.662496] rk_vcodec: mpp_dev_ioctl:1667: collect msgs failed -22
[  174.662557] rk_vcodec: mpp_task_attach_fd:1776: can't import dma-buf 122
[  174.662564] rk_vcodec: mpp_translate_reg_address:1832: reg[  0]: 0x0000007a fd 122 failed
[  174.662570] rk_vcodec: mpp_task_dump_mem_region:2019: --- dump task 0 mem region ---

dtc -I fs -O dts /proc/device-tree > device-tree.dts grep -i dma device-tree.dts

dmas = <0xf0 0x09 0xf0 0x0a>;
                dma-names = "tx\0rx";
                dmas = <0xef 0x02 0xef 0x03>;
                dmas = <0x79 0x08 0x79 0x09>;
                dma-names = "tx";
                dmas = <0xf0 0x02>;
        dma-controller@fea10000 {
                #dma-cells = <0x01>;
                dmas = <0xef 0x0b 0xef 0x0c>;
                dma-names = "rx";
                dmas = <0xef 0x04>;
                dmas = <0x79 0x06 0x79 0x07>;
                dma-names = "tx\0rx";
                dmas = <0x79 0x0e 0x79 0x0f>;
                dma-names = "tx\0rx";
                dmas = <0x79 0x00 0x79 0x01>;
                dma-names = "rx";
                dmas = <0x79 0x17>;
                dmas = <0xf0 0x0b 0xf0 0x0c>;
                dma-names = "tx";
                dmas = <0xf0 0x00>;
                dmas = <0x79 0x0a 0x79 0x0b>;
                dmas = <0xef 0x0d 0xef 0x0e>;
                dma-names = "rx";
                dmas = <0xf0 0x15>;
                dma-names = "tx";
                dmas = <0xef 0x07>;
                dma-names = "tx\0rx";
                dmas = <0x79 0x10 0x79 0x11>;
                dma-names = "tx\0rx";
                dmas = <0x79 0x02 0x79 0x03>;
                interrupt-names = "cec\0hdmi\0dma";
                dmas = <0x79 0x0c 0x79 0x0d>;
                dma-names = "tx";
                dmas = <0xf0 0x16>;
        dma-controller@fea30000 {
                #dma-cells = <0x01>;
                dma-names = "tx";
                dmas = <0xef 0x06>;
        dma-controller@fed10000 {
                #dma-cells = <0x01>;
                dma-names = "tx";
                dmas = <0x79 0x05>;
                dma-names = "tx\0rx";
                dmas = <0xef 0x0f 0xef 0x10>;
                dma-names = "tx";
                dmas = <0xef 0x08>;
                dma-names = "tx\0rx";
                dmas = <0xef 0x00 0xef 0x01>;
                dma-names = "tx";
                dmas = <0xf0 0x04>;
                dmas = <0xf0 0x07 0xf0 0x08>;
                dmas = <0xef 0x09 0xef 0x0a>;
                dma-names = "rx";
                dmas = <0x79 0x04>;
                dmac2 = "/dma-controller@fed10000";
                dmac0 = "/dma-controller@fea10000";
                dmac1 = "/dma-controller@fea30000";
                        compatible = "shared-dma-pool";
                dma-names = "tx";
                dmas = <0xef 0x16>;
                dma-names = "tx";
                dmas = <0xef 0x05>;
                dma-names = "tx\0rx";
                dmas = <0xef 0x11 0xef 0x12>;
                dma-names = "rx";
                dmas = <0xf0 0x18>;
                dma-names = "rx";
                dmas = <0xf0 0x17>;
                dma-names = "rx";
                dmas = <0x79 0x16>;
                dma-names = "tx\0rx";
                dmas = <0xf0 0x0d 0xf0 0x0e>;
                dma-names = "rx";
                dmas = <0x79 0x15>;

ls -als /dev/dma_heap/

total 0
0 drwxr-xr-x  2 root root      80 Jan  1  1970 .
0 drwxr-xr-x 19 root root    3840 Aug 22 20:58 ..
0 crw-rw----  1 root video 251, 1 Aug 22 20:58 cma
0 crw-rw----  1 root video 251, 0 Aug 22 20:58 system
moo-the-cow commented 2 months ago

any thoughts at least? is there any information I'm missing? should I post this to the mpp github or is it something thats related to those custom kernels?

moo-the-cow commented 2 months ago

hi this seems to be fixed with 6.1.0-1025-rockchip