JeffyCN / libv4l-rkmpp

A rockchip-mpp V4L2 wrapper plugin for chromium V4L2 VDA/VEA
GNU Lesser General Public License v2.1
79 stars 26 forks source link

Trouble diagnosing RKMPP not loading when moving from chromium 100 - 114 #17

Closed hollandzac closed 7 months ago

hollandzac commented 7 months ago

I am have trouble diagnosing issues related to the plugin not starting after moving to v114 of chromium with the patches from meta-rockchip/. I had this successfully working on chromium version 100.

With the log level set to 5 I get this repeated attempts to start the plugin with no specific errors on version 114. There are mentions of invalid ioctls but I also get this error when the plugin inits successfully on version 100.


 Using mplane plugin for capture
 [418.629] [RKMPP] [13606] rkmpp_parse_options(712): parsing option: type=enc
 [418.629] [RKMPP] [13606] rkmpp_parse_options(712): parsing option: codecs=VP8:VP9:H.264:H.265:AV1
 [418.629] [RKMPP] [13606] rkmpp_parse_options(712): parsing option: max-height=1080
 [418.629] [RKMPP] [13606] rkmpp_parse_options(712): parsing option: max-width=1920
 [418.629] [RKMPP] [13606] rkmpp_parse_options(742): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] rkmpp_enc_init(1090): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] rkmpp_enc_init(1127): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] plugin_init(837): ctx(0x200035c300): plugin inited
 [418.629] [RKMPP] [13606] plugin_init(839): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] plugin_ioctl(902): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] plugin_ioctl(906): ctx(0x200035c300): VIDIOC_QUERYCAP
 [418.629] [RKMPP] [13606] rkmpp_enc_ioctl(1162): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] rkmpp_querycap(130): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] rkmpp_querycap(146): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] rkmpp_enc_ioctl(1226): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] plugin_ioctl(913): ctx(0x200035c300): VIDIOC_QUERYCAP ret: 0
 [418.629] [RKMPP] [13606] plugin_ioctl(917): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] plugin_ioctl(902): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13658] encoder_thread_fn(229): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13658] encoder_thread_fn(231): ctx(0x200035c300): starting encoder thread
 [418.629] [RKMPP] [13606] plugin_ioctl(906): ctx(0x200035c300): VIDIOC_QUERYCAP
 [418.629] [RKMPP] [13606] rkmpp_enc_ioctl(1162): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] rkmpp_querycap(130): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] rkmpp_querycap(146): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] rkmpp_enc_ioctl(1226): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] plugin_ioctl(913): ctx(0x200035c300): VIDIOC_QUERYCAPret: 0
 [418.629] [RKMPP] [13606] plugin_ioctl(917): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] plugin_close(860): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] plugin_close(862): ctx(0x200035c300): closing plugin
 [418.629] [RKMPP] [13606] rkmpp_enc_deinit(1136): ctx(0x200035c300): ENTER
 [418.629] [RKMPP] [13606] rkmpp_enc_deinit(1153): ctx(0x200035c300): LEAVE
 [418.629] [RKMPP] [13606] plugin_close(891): ctx(0x200035c300): LEAVE
 Failed to query video capabilities: Inappropriate ioctl for device
 Failed to query video capabilities: Inappropriate ioctl for device 

This is the log from version 100 with similar initial output but eventually starts the plugin.

 [665.616] [RKMPP] [16597] plugin_close(862): ctx(0x4c003e4000): closing plugin
 [665.616] [RKMPP] [16597] rkmpp_enc_deinit(1136): ctx(0x4c003e4000): ENTER
 [665.617] [RKMPP] [16597] rkmpp_enc_deinit(1153): ctx(0x4c003e4000): LEAVE
 [665.617] [RKMPP] [16597] plugin_close(891): ctx(0x4c003e4000): LEAVE
 Failed to query video capabilities: Inappropriate ioctl for device
 Failed to query video capabilities: Inappropriate ioctl for device
 [666.612] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: type=enc
 [666.612] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: codecs=VP8:VP9:H.264:H.265:AV1
 [666.612] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: max-height=1080
 [666.612] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: max-width=1920
 [666.612] [RKMPP] [15319] rkmpp_parse_options(742): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] rkmpp_enc_init(1090): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_enc_init(1127): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_init(837): ctx(0x240381dc00): plugin inited
 [666.612] [RKMPP] [15319] plugin_init(839): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_QUERYCAP
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_querycap(130): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_querycap(146): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_QUERYCAP  ret: 0
 [666.612] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [16679] encoder_thread_fn(229): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [16679] encoder_thread_fn(231): ctx(0x240381dc00): starting encoder thread
 [666.612] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_ENUM_FMT
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_enum_fmt(156): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_enum_fmt(188): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_ENUM_FMT  ret: 0
 [666.612] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_ENUM_FMT
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_enum_fmt(156): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_enum_fmt(188): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_ENUM_FMT  ret: 0
 [666.612] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_ENUM_FMT
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_enum_fmt(156): ctx(0x240381dc00): ENTER
 [666.612] [RKMPP] [15319] rkmpp_enum_fmt(195): compressed format(2) not found
 [666.612] [RKMPP] [15319] rkmpp_enum_fmt(197): errno: 22
 [666.612] [RKMPP] [15319] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_ENUM_FMT  ret: -1
 [666.612] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.612] [RKMPP] [15319] plugin_close(860): ctx(0x240381dc00): ENTER
 [666.613] [RKMPP] [15319] plugin_close(862): ctx(0x240381dc00): closing plugin
 [666.613] [RKMPP] [15319] rkmpp_enc_deinit(1136): ctx(0x240381dc00): ENTER
 [666.613] [RKMPP] [15319] rkmpp_enc_deinit(1153): ctx(0x240381dc00): LEAVE
 [666.613] [RKMPP] [15319] plugin_close(891): ctx(0x240381dc00): LEAVE
 Failed to query video capabilities: Inappropriate ioctl for device
 [666.615] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: type=enc
 [666.615] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: codecs=VP8:VP9:H.264:H.265:AV1
 [666.615] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: max-height=1080
 [666.615] [RKMPP] [15319] rkmpp_parse_options(712): parsing option: max-width=1920
 [666.615] [RKMPP] [15319] rkmpp_parse_options(742): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] rkmpp_enc_init(1090): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] rkmpp_enc_init(1127): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_init(837): ctx(0x240381dc00): plugin inited
 [666.615] [RKMPP] [15319] plugin_init(839): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_QUERYCAP
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] rkmpp_querycap(130): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] rkmpp_querycap(146): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_QUERYCAP  ret: 0
 [666.615] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_ENUM_FRAMESIZES
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] rkmpp_enum_framesizes(205): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] rkmpp_enum_framesizes(223): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_ENUM_FRAMESIZES  ret: 0
 [666.615] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_TRY_ENCODER_CMD
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [16680] encoder_thread_fn(229): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [16680] encoder_thread_fn(231): ctx(0x240381dc00): starting encoder thread
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1221): unsupported ioctl cmd: VIDIOC_TRY_ENCODER_CMD(3223869006)!
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1223): errno: 25
 [666.615] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_TRY_ENCODER_CMD  ret: -1
 [666.615] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_QUERYCAP
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] rkmpp_querycap(130): ctx(0x240381dc00): ENTER
 [666.615] [RKMPP] [15319] rkmpp_querycap(146): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.615] [RKMPP] [15319] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_QUERYCAP  ret: 0
 [666.615] [RKMPP] [15319] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_REQBUFS
 [666.616] [RKMPP] [16678] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] rkmpp_reqbufs(373): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] rkmpp_get_queue(259): type = 10
 [666.616] [RKMPP] [16678] rkmpp_reqbufs(385): release buffers
 [666.616] [RKMPP] [16678] rkmpp_reqbufs(473): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_REQBUFS  ret: 0
 [666.616] [RKMPP] [16678] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_REQBUFS
 [666.616] [RKMPP] [16678] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] rkmpp_reqbufs(373): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] rkmpp_get_queue(259): type = 9
 [666.616] [RKMPP] [16678] rkmpp_reqbufs(385): release buffers
 [666.616] [RKMPP] [16678] rkmpp_reqbufs(473): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_REQBUFS  ret: 0
 [666.616] [RKMPP] [16678] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_S_FMT
 [666.616] [RKMPP] [16678] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] rkmpp_s_fmt(313): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] rkmpp_get_queue(259): type = 9
 [666.616] [RKMPP] [16678] rkmpp_try_fmt(253): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] rkmpp_try_fmt(303): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] rkmpp_s_fmt(341): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] rkmpp_enc_ioctl(1226): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] plugin_ioctl(913): ctx(0x240381dc00): VIDIOC_S_FMT  ret: 0
 [666.616] [RKMPP] [16678] plugin_ioctl(917): ctx(0x240381dc00): LEAVE
 [666.616] [RKMPP] [16678] plugin_ioctl(902): ctx(0x240381dc00): ENTER
 [666.616] [RKMPP] [16678] plugin_ioctl(906): ctx(0x240381dc00): VIDIOC_S_FMT
 [666.616] [RKMPP] [16678] rkmpp_enc_ioctl(1162): ctx(0x240381dc00): ENTER

chromium-100.log

Is there some specific logging I can turn on to help find the cause of the issue. So far I have tried updating rockchip-mpp and this plugin to the latest commits.

JeffyCN commented 7 months ago

these logs only contain encoder, so it could be something wrong in the chromium(hardware v4l2 dec not enabled).

maybe related to: missing /dev/video-dec0 missing patches from meta-rockchip missing launch args from meta-rockchip

hollandzac commented 7 months ago

The issue is specific to the encoder, I had the decoding logging off but I have confirmed that part works correctly. I have confirmed that all the patches have applied. Is started with --enable-feature=VaapiVideoEncoder,VaapiVideoDecoder and " --no-sandbox --gpu-sandbox-start-early --ignore-gpu-blacklist --ignore-gpu-blocklist --enable-accelerated-video-decode".

Decode log

[771.055] [RKMPP] [41564] rkmpp_expbuf(540): export buf(12), type: 9, fd: 205(154)
[771.055] [RKMPP] [41564] rkmpp_expbuf(540): export buf(13), type: 9, fd: 207(155)
[771.055] [RKMPP] [41564] rkmpp_expbuf(540): export buf(14), type: 9, fd: 209(156)
[771.056] [RKMPP] [41564] rkmpp_expbuf(540): export buf(15), type: 9, fd: 211(157)
[771.056] [RKMPP] [41564] rkmpp_expbuf(540): export buf(16), type: 9, fd: 215(158)
[771.056] [RKMPP] [41564] rkmpp_expbuf(540): export buf(17), type: 9, fd: 219(159)
[771.056] [RKMPP] [41564] rkmpp_expbuf(540): export buf(18), type: 9, fd: 223(160)
[771.056] [RKMPP] [41564] rkmpp_expbuf(540): export buf(19), type: 9, fd: 227(161)
[771.056] [RKMPP] [41564] rkmpp_dec_streamon(460): queue(9) start streaming
[771.056] [RKMPP] [41564] rkmpp_dec_streamon(465): send info change ready
[771.058] [RKMPP] [41564] plugin_mmap(963): mmap buffer(3): 0x7fa23a3000, fd: 113
[771.058] [RKMPP] [41564] plugin_mmap(963): mmap buffer(4): 0x7f9dc63000, fd: 114
[771.059] [RKMPP] [41564] plugin_mmap(963): mmap buffer(5): 0x7f9db63000, fd: 116
[771.060] [RKMPP] [41564] plugin_mmap(963): mmap buffer(6): 0x7f9da63000, fd: 117
[771.060] [RKMPP] [41564] plugin_mmap(963): mmap buffer(7): 0x7f9d963000, fd: 118
[774.383] [RKMPP] [41566] rkmpp_new_frame(82): DEC FPS:   20.6 || Frames: 120
[778.618] [RKMPP] [41566] rkmpp_new_frame(82): DEC FPS:   28.3 || Frames: 240
[782.602] [RKMPP] [41566] rkmpp_new_frame(82): DEC FPS:   30.1 || Frames: 360
JeffyCN commented 7 months ago

well, i don't have a way to test enc for a long time, so it's possible something changed in new chromium that breaks enc.

how did you test it?

hollandzac commented 7 months ago

I am just taking a webcam stream through MediaDevices API to stream via WebRTC.

JeffyCN commented 7 months ago

is there any website or demo html to repro it? (i dont know much about web, i was using apprtc, but that was down long time ago)

hollandzac commented 7 months ago

https://webrtc.github.io/samples/src/content/getusermedia/gum/

Jitsi meet is a better test as it encodes as vp9 https://meet.jit.si/

JeffyCN commented 7 months ago

patches uploaded in v4l mpp plugin and chromium.

hollandzac commented 7 months ago

Encoder working with patches in 114