Open liuguohuan-xiezuo opened 3 years ago
./mpp_platform_test mpp[19186]: mpp_plat_test: kernel version: 4.4 mpp[19186]: mpp_plat_test: ioctl version: vcodec_service mpp[19186]: mpp_plat_test: mpp[19186]: mpp_plat_test: chip name: rockchip,px30-evb-ddr3-v10-linux rockchip,px30 mpp[19186]: mpp_plat_test: mpp[19186]: mpp_plat_test: chip vcodec type 0004010a mpp[19186]: mpp_plat_test: found vpu2 codec mpp[19186]: mpp_plat_test: found rk hevc decoder mpp[19186]: mpp_plat_test: found vpu2 encoder mpp[19186]: mpp_plat_test: mpp[19186]: mpp_plat_test: start probing decoder device name: mpp[19186]: mpp_plat_test: H.264 decoder: /dev/vpu_service mpp[19186]: mpp_plat_test: H.265 decoder: /dev/hevc_service mpp[19186]: mpp_plat_test: MJPEG decoder: /dev/vpu_service mpp[19186]: mpp_plat_test: VP9 decoder: /dev/vpu_service mpp[19186]: mpp_plat_test: avs decoder: /dev/vpu_service mpp[19186]: mpp_plat_test: mpp[19186]: mpp_plat_test: start probing encoder device name: mpp[19186]: mpp_plat_test: H.264 encoder: /dev/vpu_service mpp[19186]: mpp_plat_test: H.265 encoder: /dev/vpu_service mpp[19186]: mpp_plat_test: MJPEG encoder: /dev/vpu_service mpp[19186]: mpp_plat_test: mpp platform test done
vpu_service 这个内核估计是 3.10 的,比较老了,支持有问题……
这个有什么办法可以解决吗,升级内核?因为板子本身可以支持mpp,那如果我把他的库跟头文件,拷贝出来,也可以用吗?
这个有什么办法可以解决吗,升级内核?或者能回退到mpp-develop的什么版本吗?
mpp[19186]: mpp_plat_test: kernel version: 4.4 mpp[19186]: mpp_plat_test: ioctl version: vcodec_service mpp[19186]: mpp_plat_test: mpp[19186]: mpp_plat_test: chip name: rockchip,px30-evb-ddr3-v10-linux rockchip,px30 这里看,内核虽然是 4.4 的,但是设备驱动还是 3.10 的 /dev/vpu_service,这个比较老了
升级 sdk 是比较好的选择,最新环境上的问题会少很多, 回退 mpp 需要回退到很老的版本了,不建议
设备驱动在哪里可以下载升级呢
你先更新下这个github上最新的mpp,再测试下看看
我在用的一直是最新的guthub上的mpp-develop
kmsg看一下报什么
[21570.560156] rk_vcodec: vpu_service_ioctl:2079: error: pid 15813 wait 0 task done timeout [27040.138555] rk_vcodec: vpu_service_ioctl:2138: error: unknown vpu service ioctl cmd 40086c01 [27040.371119] rk_vcodec: reg_init:1487: error: translate reg address failed, dumping regs
[27043.158330] rk_vcodec: vpu_service_ioctl:2079: error: pid 18548 wait 0 task done timeout
合入这个修改测试下看看
diff --git a/build/linux/arm/make-Makefiles.bash b/build/linux/arm/make-Makefiles.bash
index 9dcbc7e8..1e891339 100755
--- a/build/linux/arm/make-Makefiles.bash
+++ b/build/linux/arm/make-Makefiles.bash
@@ -24,5 +24,6 @@ fi
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_TOOLCHAIN_FILE=./arm.linux.cross.cmake \
-DRKPLATFORM=ON \
+ -DHAVE_DRM=ON \
-G "Unix Makefiles" \
${MPP_TOP}
我在build/linux/arm/make-Makefiles.bash里面加了-DHAVE_DRM=ON \ ,还是一样的报错
diff --git a/osal/linux/os_allocator.c b/osal/linux/os_allocator.c
index b7dbfeea..e96d5751 100644
--- a/osal/linux/os_allocator.c
+++ b/osal/linux/os_allocator.c
@@ -41,6 +41,11 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
#endif
allocator_std;
+#if HAVE_DRM
+
+ mpp_log("ion %d drm %d \n", mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION),
+ mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM));
+#endif
} break;
case MPP_BUFFER_TYPE_EXT_DMA: {
*api = allocator_ext_dma;
这是改了的os_allocator.c文件 /*
/*
MPP_RET os_allocator_get(os_allocator api, MppBufferType type) { MPP_RET ret = MPP_OK; switch (type) { case MPP_BUFFER_TYPE_NORMAL : { api = allocator_std; } break; case MPP_BUFFER_TYPE_ION : { *api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
allocator_std;
mpp_log("ion %d drm %d \n", mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION),
mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM));
} break;
case MPP_BUFFER_TYPE_EXT_DMA: {
*api = allocator_ext_dma;
} break;
case MPP_BUFFER_TYPE_DRM : {
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
* api =
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
allocator_std;
} break;
default : {
ret = MPP_NOK;
} break;
}
return ret;
}
这是运行的日志 ./mpi_dec_test -t 7 -i test.h264 -o output.yuv -n 10 mpp[8527]: mpi_dec_utils: cmd parse result: mpp[8527]: mpi_dec_utils: input file name: test.h264 mpp[8527]: mpi_dec_utils: output file name: output.yuv mpp[8527]: mpi_dec_utils: config file name: mpp[8527]: mpi_dec_utils: width : 0 mpp[8527]: mpi_dec_utils: height : 0 mpp[8527]: mpi_dec_utils: type : 7 mpp[8527]: mpi_dec_utils: debug flag : 0 mpp[8527]: mpi_dec_utils: max frames : 10 mpp[8527]: mpi_dec_test: mpi_dec_test start mpp[8527]: mpi_dec_test: input file size 8330818 mpp[8527]: mpp_info: mpp version: unknown mpp version for missing VCS info mpp[8527]: mpi_dec_test: 0x558ac289c0 mpi_dec_test decoder test start w 0 h 0 type 7 mpp[8527]: mpp_rt: NOT found ion allocator mpp[8527]: mpp_rt: found drm allocator mpp[8527]: mpi_dec_test: 0x558ac289c0 decode_get_frame get info changed found mpp[8527]: mpi_dec_test: 0x558ac289c0 decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 3760128 mpp[8527]: vcodec_service: vcodec_service_cmd_send ioctl VPU_IOC_SET_REG failed ret -1 errno 14 Bad address mpp[8527]: hal_h264d_vdpu_reg: vdpu2_h264d_start send cmd failed 14 mpp[8527]: vcodec_service: vcodec_service_cmd_poll ioctl VPU_IOC_GET_REG failed ret -1 errno 110 Connection timed out mpp[8527]: hal_h264d_vdpu_reg: vdpu2_h264d_wait poll cmd failed 110 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 0 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 1 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 2 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 3 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 4 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 5 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 6 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 7 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 8 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 decode get frame 9 err 1 discard 0 mpp[8527]: mpi_dec_test: 0x558ac289c0 reach max frame number 10 mpp[8527]: mpi_dec_test: 0x558ac289c0 input 360 pkt output 11 frm decode 10 frames mpp[8527]: mpi_dec_test: test success max memory 14.34 MB
这是dmesg日志 [ 1104.707315] rk_vcodec: vpu_service_open:2268: enter [ 1104.707334] rk_vcodec: vpu_service_open:2291: leave [ 1104.707422] rk_vcodec: vpu_service_ioctl:1965: enter [ 1104.707432] rk_vcodec: cmd 40086c01, VPU_IOC_SET_CLIENT_TYPE 40046c01 [ 1104.707442] rk_vcodec: vpu_service_ioctl:2138: error: unknown vpu service ioctl cmd 40086c01 [ 1104.716293] rk_vcodec: vpu_service_ioctl:1965: enter [ 1104.716308] rk_vcodec: cmd 40046c01, VPU_IOC_SET_CLIENT_TYPE 40046c01 [ 1104.716318] rk_vcodec: pid 8527 set client type 1, secure mode = 0 [ 1104.716326] rk_vcodec: vpu_service_ioctl:2143: leave [ 1104.941751] rk_vcodec: vpu_service_ioctl:1965: enter [ 1104.941768] rk_vcodec: cmd 40086c03, VPU_IOC_SET_CLIENT_TYPE 40046c01 [ 1104.941777] rk_vcodec: pid 8527 set reg type 1 [ 1104.941788] rk_vcodec: reg_init:1446: enter [ 1104.941802] rk_vcodec: pos 62 fd 2 offset 3133440 i 1 [ 1104.941817] rk_vcodec: reg_init:1487: error: translate reg address failed, dumping regs
[ 1105.730127] rk_vcodec: vpu_service_ioctl:1965: enter [ 1105.730142] rk_vcodec: cmd 40086c04, VPU_IOC_SET_CLIENT_TYPE 40046c01 [ 1105.730149] rk_vcodec: pid 8527 get reg type 1 [ 1107.729809] rk_vcodec: vpu_service_ioctl:2079: error: pid 8527 wait 0 task done timeout [ 1107.874640] rk_vcodec: vpu_service_release:2303: enter [ 1107.874669] rk_vcodec: vpu_service_release:2338: leave
升级设备驱动的话,需要升级到什么版本呢
你加的这句log没打印出来,说明HAVE_DRM这个config没开。
确认下对应的make-Makefiles.bash里是否配置了-DHAVE_DRM=ON
如果已经添加了,那就把当前编译的结果 clean下,直接删除生成的文件后,再重新编译下。
mpp_log("ion %d drm %d \n", mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION), mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM));
这个确实加进去了
set +e
MPP_PWD=pwd
MPP_TOP=${MPP_PWD}/../../..
check_cmd(){ "$@" >> /dev/null 2>&1 } check_system_arm_linux_gcc(){ check_cmd arm-linux-gcc -v }
check_system_arm_linux_gcc if [ $? -eq 127 ];then MPP_TOOLCHAIN=${MPP_TOP}/../prebuilts/toolschain/usr/bin export PATH=$PATH:${MPP_TOOLCHAIN} fi
cmake -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_TOOLCHAIN_FILE=./arm.linux.cross.cmake \ -DRKPLATFORM=ON \ -DHAVE_DRM=ON \ -G "Unix Makefiles" \ ${MPP_TOP}
MPP_RET os_allocator_get(os_allocator api, MppBufferType type) { MPP_RET ret = MPP_OK; switch (type) { case MPP_BUFFER_TYPE_NORMAL : { api = allocator_std; } break; case MPP_BUFFER_TYPE_ION : { *api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
allocator_std;
mpp_log("ion %d drm %d \n", mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION),
mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM));
} break;
case MPP_BUFFER_TYPE_EXT_DMA: {
*api = allocator_ext_dma;
} break;
case MPP_BUFFER_TYPE_DRM : {
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
* api =
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
allocator_std;
} break;
default : {
ret = MPP_NOK;
} break;
}
return ret;
}
我每次修改完都会make clean,再重新make的,你说没打印的那个日志,是应该运行mpi_dec_test的时候应该会打印出来的吗?
1、你可以试一下把build/linux/arm/下除了arm.linux.cross.cmake和arm.linux.cross.cmake两个文件,其他文件都删掉看看。 2、或者直接按如下修改
diff --git a/osal/linux/os_allocator.c b/osal/linux/os_allocator.c
index b7dbfeea..45064f75 100644
--- a/osal/linux/os_allocator.c
+++ b/osal/linux/os_allocator.c
@@ -37,20 +37,16 @@ MPP_RET os_allocator_get(os_allocator *api, MppBufferType type)
} break;
case MPP_BUFFER_TYPE_ION : {
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
-#if HAVE_DRM
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
-#endif
allocator_std;
+ mpp_log("ion %d drm %d \n", mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION),
+ mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM));
} break;
case MPP_BUFFER_TYPE_EXT_DMA: {
*api = allocator_ext_dma;
} break;
case MPP_BUFFER_TYPE_DRM : {
-#if HAVE_DRM
*api = (mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :
-#else
- * api =
-#endif
(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_ION)) ? allocator_ion :
allocator_std;
} break;
build/linux/arm/下本来就只有arm.linux.cross.cmake和arm.linux.cross.cmake两个文件,我刚刚试了,去掉了if HAVE_DRM,直接去执行(mpp_rt_allcator_is_valid(MPP_BUFFER_TYPE_DRM)) ? allocator_drm :的话,编译会报错undefined reference to `allocator_drm'
这个修改也同步加上
diff --git a/osal/CMakeLists.txt b/osal/CMakeLists.txt
index 0df9d1dc..3fe8545c 100644
--- a/osal/CMakeLists.txt
+++ b/osal/CMakeLists.txt
@@ -10,13 +10,9 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_REENTRANT -D_GNU_SOURCE")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
-if (HAVE_DRM)
- add_definitions(-DHAVE_DRM)
- set(DRM_FILES allocator/allocator_drm.c)
- message(STATUS "compile with drm support")
-else()
- message(STATUS "compile without drm support")
-endif()
+
+set(DRM_FILES allocator/allocator_drm.c)
+message(STATUS "compile with drm support")
set(MPP_ALLOCATOR
allocator/allocator_std.c
确实这样做解决了,没有报错了,可以使用
最新的版本,MPP_ENC_GET_EXTRA_INFO接口已经是不能用了是吗,我一调用,就会报错,提示我用MPP_ENC_GET_HDR_SYNC接口
还可以使用,只是个提示log,但不保证将来还能支持,最好切换下接口,原接口有异步问题。
我把编译出来数据存264文件,用分析工具打开,看到里面的I帧跟P帧好像都有点问题,下面的264文件的格式,里面有个数据的重要级别,我用ffmpeg跟其他硬编数来的数据,I帧的数据是0x68,P帧的数据是0x61,但我用mpp编译出来的,I帧的数据是0x25,P帧的数据是0x21,请问这个可以设置他的级别吗
./mpi_dec_test -t 7 -i test.h264 -o output.yuv -n 10 mpp[20329]: mpi_dec_utils: cmd parse result: mpp[20329]: mpi_dec_utils: input file name: test.h264 mpp[20329]: mpi_dec_utils: output file name: output.yuv mpp[20329]: mpi_dec_utils: config file name: mpp[20329]: mpi_dec_utils: width : 0 mpp[20329]: mpi_dec_utils: height : 0 mpp[20329]: mpi_dec_utils: type : 7 mpp[20329]: mpi_dec_utils: debug flag : 0 mpp[20329]: mpi_dec_utils: max frames : 10 mpp[20329]: mpi_dec_test: mpi_dec_test start mpp[20329]: mpi_dec_test: input file size 8330818 mpp[20329]: mpp_info: mpp version: unknown mpp version for missing VCS info mpp[20329]: mpi_dec_test: 0x559c16b9c0 mpi_dec_test decoder test start w 0 h 0 type 7 mpp[20329]: mpp_rt: NOT found ion allocator mpp[20329]: mpp_rt: found drm allocator mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode_get_frame get info changed found mpp[20329]: mpi_dec_test: 0x559c16b9c0 decoder require buffer w:h [1920:1080] stride [1920:1088] buf_size 3760128 mpp[20329]: vcodec_service: vcodec_service_cmd_send ioctl VPU_IOC_SET_REG failed ret -1 errno 14 Bad address mpp[20329]: hal_h264d_vdpu_reg: vdpu2_h264d_start send cmd failed 14 mpp[20329]: vcodec_service: vcodec_service_cmd_poll ioctl VPU_IOC_GET_REG failed ret -1 errno 110 Connection timed out mpp[20329]: hal_h264d_vdpu_reg: vdpu2_h264d_wait poll cmd failed 110 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 0 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 1 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 2 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 3 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 4 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 5 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 6 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 7 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 8 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 decode get frame 9 err 1 discard 0 mpp[20329]: mpi_dec_test: 0x559c16b9c0 reach max frame number 10 mpp[20329]: mpi_dec_test: 0x559c16b9c0 input 360 pkt output 11 frm decode 10 frames mpp[20329]: mpi_dec_test: test success max memory 14.34 MB