FAQ - jjm2473/ffmpeg-rk GitHub Wiki

调试相关

MPP客户端输出日志(会打印到syslog)

mpp_log_level=4 ffmpeg ... # info
mpp_log_level=5 ffmpeg ... # debug
mpp_log_level=6 ffmpeg ... # verbose

RGA内核日志输出参数信息(再次执行可关闭)

echo msg > /sys/kernel/debug/rkrga/debug

详情参考官方文档

RGA客户端输出调试信息

ROCKCHIP_RGA_LOG=1 ffmpeg ...

RGA2的4GB内存限制

在内存超过4GB的板子上,RGA2可能出现错误(RK3588平台上对于RGA3不支持的分辨率也会降级到RGA2),内核日志如下:

[ 7280.605045] rga: Blit mode: request id = 18353
[ 7280.605049] rga_debugger: render_mode = 0, bitblit_mode=0, rotate_mode = 1
[ 7280.605051] rga_debugger: src: y = 8 uv = 0 v = 27d800 aw = 1920 ah = 1080 vw = 2400 vh = 1088
[ 7280.605053] rga_debugger: src: xoff = 0, yoff = 0, format = 0x20, rd_mode = 1
[ 7280.605055] rga_debugger: dst: y=2f uv=0 v=47040 aw=718 ah=404 vw=720 vh=404
[ 7280.605057] rga_debugger: dst: xoff = 0, yoff = 0, format = 0xa, rd_mode = 1
[ 7280.605058] rga_debugger: mmu: mmu_flag=80000521 en=1
[ 7280.605059] rga_debugger: alpha: rop_mode = 0
[ 7280.605060] rga_debugger: yuv2rgb mode is 0
[ 7280.605061] rga_debugger: set core = 0, priority = 0, in_fence_fd = 0
[ 7280.605066] rga_policy: start policy on core = 1
[ 7280.605068] rga_policy: unsupported width stride 2400, 0x20 should be 64 aligned!
[ 7280.605069] rga_policy: core = 1, break on rga_check_src0
[ 7280.605070] rga_policy: start policy on core = 2
[ 7280.605072] rga_policy: unsupported width stride 2400, 0x20 should be 64 aligned!
[ 7280.605073] rga_policy: core = 2, break on rga_check_src0
[ 7280.605074] rga_policy: start policy on core = 4
[ 7280.605075] rga_policy: optional_cores = 4
[ 7280.605076] rga_policy: assign core: 4
[ 7280.605984] rga_mm: RGA_MMU unsupported memory larger than 4G!
[ 7280.605993] rga_mm: scheduler core[4] unsupported mm_flag[0x0]!
[ 7280.606677] rga_mm: rga_mm_map_buffer map dma_buf error!
[ 7280.606686] rga_mm: job buffer map failed!
[ 7280.606694] rga_mm: src channel map job buffer failed!
[ 7280.606700] rga_mm: failed to map buffer
[ 7280.606708] rga_job: rga_job_commit: failed to map job info
[ 7280.606721] rga_job: request[18353] finished 0 failed 1
[ 7280.606726] rga_job: request[18353] task[0] job_commit failed.
[ 7280.606734] rga_job: rga request commit failed!
[ 7280.606742] rga: request[18353] submit failed!

其中关键的是“RGA_MMU unsupported memory larger than 4G!”。

为修复此问题,有两个地方需要修改:

  1. 内核需要打补丁,使得MPP输出的数据在4GB地址范围内 1001-drivers-rockchip-drm-force-dma32.patch
  2. 更新到最新的librga(1.9.1以上,如果找不到可以用我的仓库)。

PS:如果是其他项目使用librga,除了需要更新librga外,还需要指定RGA的输出buffer在4GB地址范围内。例如对于使用MPP Buffer作为内存申请的场景,调用方需要修改所有mpp_buffer_group_get_internal的调用,加上MPP_BUFFER_FLAGS_DMA32 标记,例如mpp_buffer_group_get_internal(&ctx->frame_group, MPP_BUFFER_TYPE_DRM)需要修改成mpp_buffer_group_get_internal(&ctx->frame_group, MPP_BUFFER_TYPE_DRM | MPP_BUFFER_FLAGS_DMA32)。本项目已经加上了这个标记。其他内存申请方式就自己查资料吧。