如何获取v4l2图像
在rv1126平台我编译了新的AHD视频驱动,用的RN6854M芯片。用命令media-ctl -p -d /dev/media查看到以下节点:- entity 31: m01_b_rn6854 1-002c (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev4
pad0: Source
-> "rockchip-mipi-dphy-rx":0
我不太懂应用层怎么获取图像和视频。请大家指教! 转mipi? rkmedia api 是否适用? 板蓝根 发表于 2021-6-22 18:04
转mipi? rkmedia api 是否适用?
对,MIPI的数据差分组用示波器量已经有信号了,但是要用哪一种rkmedia:
anbly@linux:~/working/rk/external/rkmedia/examples$ ls rkmedia_
rkmedia_adec_ao_test.c rkmedia_venc_avbr_test.c rkmedia_vi_md_test.c
rkmedia_ai_aenc_test.c rkmedia_venc_cover_test.c rkmedia_vi_multi_bind_test.c
rkmedia_ai_multi_test.c rkmedia_venc_jpeg_test.c rkmedia_vi_od_test.c
rkmedia_ai_test.c rkmedia_venc_local_file_test.c rkmedia_vi_rga_test.c
rkmedia_ao_test.c rkmedia_venc_mjpeg_test.c rkmedia_vi_rknn_venc_rtsp_test.c
rkmedia_audio_test.c rkmedia_venc_osd_test.c rkmedia_vi_rockx_venc_rtsp_test.c
rkmedia_fake_vi_test.c rkmedia_venc_roi_osd_test.c rkmedia_vi_uvc_test.c
rkmedia_isp_test.c rkmedia_venc_smartp_test.c rkmedia_vi_venc_rtsp_test.c
rkmedia_main_stream_with_jpeg_test.c rkmedia_vi_double_cameras_switch_test.crkmedia_vi_venc_test.c
rkmedia_muxer_test.c rkmedia_vi_double_cameras_test.c rkmedia_vi_vo_test.c
rkmedia_rga_api_test.c rkmedia_vi_electrostatic_protection.c rkmedia_vmix_vo_dvr_test.c
rkmedia_rga_crop_venc_test.c rkmedia_vi_get_frame_test.c rkmedia_vmix_vo_test.c
rkmedia_rga_osd_test.c rkmedia_vi_insert_user_picture_test.c rkmedia_vo_display_test.c
rkmedia_vdec_test.c rkmedia_vi_luma_only_mode_test.c rkmedia_vo_scale_test.c
本帖最后由 板蓝根 于 2021-6-23 09:15 编辑
rkmedia_vi_get_frame_test.c ,没有 用过 AHD 大概是怎么通讯?需要用到内部 isp? 板蓝根 发表于 2021-6-23 09:05
rkmedia_vi_get_frame_test.c ,没有 用过 AHD 大概是怎么通讯?需要用到内部 isp?
rkmedia_vi_get_frame_test获取失败了:
# rkmedia_vi_get_frame_test-a /oem/etc/iqfiles/ -w 1280
-h 720 -d rkispp_scale0 -o /tmp/720p.nv12 -c 10
media get entity by name: rkcif-lvds-subdev is null
media get entity by name: rkcif-lite-lvds-subdev is null
:XCAM ERROR CamHwIsp20.cpp:160: @get_sensor_caps /dev/v4l-subdev4: Enum sensor frame interval failed
media get entity by name: rkisp-mpfbc-subdev is null
media get entity by name: rkisp_dmapath is null
:XCAM ERROR CamHwIsp20.cpp:160: @get_sensor_caps /dev/v4l-subdev8: Enum sensor frame interval failed
media get entity by name: rkisp-mpfbc-subdev is null
media get entity by name: rkisp_dmapath is null
media get entity by name: rockchip-mipi-dphy-rx is null
:XCAM ERROR CamHwIsp20.cpp:928: No free isp&ispp needed by fake camera!
Rga built version:1.04 f4678e1+2021-05-28 12:14:23
#####Device: rkispp_scale0
#####Resolution: 1280x720
#####Frame Count to save: 10
#####Output Path: /tmp/720p.nv12
#CameraIdx: 0
#####Aiq xml dirpath: /oem/etc/iqfiles/
#bMultictx: 0
ID: 0, sensor_name is m00_f_rn6854 1-002d, iqfiles is /oem/etc/iqfiles/
:XCAM ERROR RkAiqCalibDb.cpp:163: calibdb /oem/etc/iqfiles//rn6854_rn6854_rn6854.xml and bin are all not exist!
:XCAM ERROR rk_aiq_user_api_sysctl.cpp:206: _rkAiqManager init error!
:XCAM ERROR CamHwIsp20.cpp:1152: can't find sensor
:XCAM ERROR RkAiqManager.cpp:382: camhw deinit error -7
[ 1099.493725] pgd = c630213a
[ 1099.493760] *pgd=22a78835, *pte=00000000, *ppte=00000000
[ 1099.493778] CPU: 3 PID: 2804 Comm: rkmedia_vi_get_ Not tainted 4.19.111+ #71
[ 1099.493785] Hardware name: Generic DT based system
[ 1099.493796] PC is at 0xa4c42644
[ 1099.493802] LR is at 0xa4f39fe8
[ 1099.493809] pc : [<a4c42644>] lr : [<a4f39fe8>] psr: 60070010
[ 1099.493815] sp : aee987f8ip : a4c4263cfp : 00034dd4
[ 1099.493822] r10: 00034ddcr9 : aee988e0r8 : aee98860
[ 1099.493829] r7 : 00034ddcr6 : 00034dd4r5 : aee98810r4 : 00000000
[ 1099.493836] r3 : a6fbc900r2 : 00000000r1 : 00000000r0 : 00000000
[ 1099.493881] Flags: nZCvIRQs onFIQs onMode USER_32ISA ARMSegment user
[ 1099.493891] Control: 10c5387dTable: 3625c06aDAC: 00000055
[ 1099.493902] CPU: 3 PID: 2804 Comm: rkmedia_vi_get_ Not tainted 4.19.111+ #71
[ 1099.493911] Hardware name: Generic DT based system
[ 1099.493937] [<b010f408>] (unwind_backtrace) from [<b010b96c>] (show_stack+0x10/0x14)
[ 1099.493953] [<b010b96c>] (show_stack) from [<Segmentation fault (cobre d0umped)
8c# 53c4>] (dump_stack+0x90/0xa4)
[ 1099.493971] [<b08c53c4>] (dump_stack) from [<b011373c>] (__do_user_fault+0x130/0x134)
[ 1099.493986] [<b011373c>] (__do_user_fault) from [<b0113980>] (do_page_fault+0x240/0x348)
[ 1099.494002] [<b0113980>] (do_page_fault) from [<b0113c18>] (do_DataAbort+0x4c/0xec)
[ 1099.494017] [<b0113c18>] (do_DataAbort) from [<b0101d7c>] (__dabt_usr+0x3c/0x40)
[ 1099.494027] Exception stack(0xe8ff7fb0 to 0xe8ff7ff8)
[ 1099.494039] 7fa0: 00000000 00000000 00000000 a6fbc900
[ 1099.494051] 7fc0: 00000000 aee98810 00034dd4 00034ddc aee98860 aee988e0 00034ddc 00034dd4
[ 1099.494060] 7fe0: a4c4263c aee987f8 a4f39fe8 a4c42644 60070010 ffffffff
#
****************************************************************
驱动是根据指南Rockchip_Instruction_Linux_DVR_DMS_CN.pdf开发的,用的是双MIPI方案,VICAP+ISP方案。
****************************************************************
media-ctl -p -d /dev/media获取完整的设备节点:
# media-ctl -p -d /dev/media0
Media controller API version 4.19.111
Media device information
------------------------
driver rkcif
model rkcif_mipi_lvds
serial
bus info
hw revision 0x0
driver version4.19.111
Device topology
- entity 1: stream_cif_mipi_id0 (1 pad, 4 links)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "rockchip-mipi-csi2":1
<- "rockchip-mipi-csi2":2 []
<- "rockchip-mipi-csi2":3 []
<- "rockchip-mipi-csi2":4 []
- entity 5: stream_cif_mipi_id1 (1 pad, 4 links)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
<- "rockchip-mipi-csi2":1 []
<- "rockchip-mipi-csi2":2
<- "rockchip-mipi-csi2":3 []
<- "rockchip-mipi-csi2":4 []
- entity 9: stream_cif_mipi_id2 (1 pad, 4 links)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "rockchip-mipi-csi2":1 []
<- "rockchip-mipi-csi2":2 []
<- "rockchip-mipi-csi2":3
<- "rockchip-mipi-csi2":4 []
- entity 13: stream_cif_mipi_id3 (1 pad, 4 links)
type Node subtype V4L flags 0
device node name /dev/video3
pad0: Sink
<- "rockchip-mipi-csi2":1 []
<- "rockchip-mipi-csi2":2 []
<- "rockchip-mipi-csi2":3 []
<- "rockchip-mipi-csi2":4
- entity 17: rockchip-mipi-csi2 (5 pads, 17 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev2
pad0: Sink
[fmt:UYVY8_2X8/1280x720 field:none
crop.bounds:(0,0)/1280x720
crop:(0,0)/1280x720]
<- "rockchip-mipi-dphy-rx":1
pad1: Source
[fmt:UYVY8_2X8/1280x720 field:none
crop.bounds:(0,0)/1280x720
crop:(0,0)/1280x720]
-> "stream_cif_mipi_id0":0
-> "stream_cif_mipi_id1":0 []
-> "stream_cif_mipi_id2":0 []
-> "stream_cif_mipi_id3":0 []
pad2: Source
[fmt:UYVY8_2X8/1280x720 field:none
crop.bounds:(0,0)/1280x720
crop:(0,0)/1280x720]
-> "stream_cif_mipi_id0":0 []
-> "stream_cif_mipi_id1":0
-> "stream_cif_mipi_id2":0 []
-> "stream_cif_mipi_id3":0 []
pad3: Source
[fmt:UYVY8_2X8/1280x720 field:none
crop.bounds:(0,0)/1280x720
crop:(0,0)/1280x720]
-> "stream_cif_mipi_id0":0 []
-> "stream_cif_mipi_id1":0 []
-> "stream_cif_mipi_id2":0
-> "stream_cif_mipi_id3":0 []
pad4: Source
[fmt:UYVY8_2X8/1280x720 field:none
crop.bounds:(0,0)/1280x720
crop:(0,0)/1280x720]
-> "stream_cif_mipi_id0":0 []
-> "stream_cif_mipi_id1":0 []
-> "stream_cif_mipi_id2":0 []
-> "stream_cif_mipi_id3":0
- entity 23: rockchip-mipi-dphy-rx (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0
device node name /dev/v4l-subdev3
pad0: Sink
<- "m01_b_rn6854 1-002c":0
pad1: Source
-> "rockchip-mipi-csi2":0
- entity 28: rkcif-mipi-luma (0 pad, 0 link)
type Node subtype V4L flags 0
device node name /dev/video4
- entity 31: m01_b_rn6854 1-002c (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev4
pad0: Source
-> "rockchip-mipi-dphy-rx":0
#
我的是四路视频芯片,对应的节点是video0~3,用下面命令播放rtsp看实时视频:
rkmedia_vi_venc_rtsp_test -w 1280 -h720 -d /dev/video0
如果是MIPI直连sensor的话,需要指定-a,也就是iqfiles,iqfiles需要经过调试才能用。
楼主有调出图像吗,之前有提问到一位网友,他说MIPI接口输出的是YUV格式数据的话是不需要经过ISP处理,可以直接通过RKMeida库接口拿到数据的,我之前看了RKMedia例程和库的源码,发现例程指定的设备节点默认是rkispp_scale0~2, RKMedia库源码里面处理逻辑是,如果调用接口时,指定的设备节点是rkispp_scaleX,会调用RKAiq库接口初始化ISP通路功能,所以初始化时指定的额设备节点要为/dev/videoX 这样 Lenuxon 发表于 2021-7-27 09:24
我的是四路视频芯片,对应的节点是video0~3,用下面命令播放rtsp看实时视频:
如果是MIPI直连sensor的话 ...
楼主有调试过 RV1126 + HDMI采集芯片的方案吗,一直在研究怎么实现RV1126 通过HDMI采集芯片,不经过RKAiq实现视频数据获取{:4_106:} wx_lemon_w0Qo5 发表于 2021-7-30 09:52
楼主有调出图像吗,之前有提问到一位网友,他说MIPI接口输出的是YUV格式数据的话是不需要经过ISP处理,可以 ...
感觉你是理解错了。首先我用的是rv1126,它有VICAP和ISP两个图像处理IP,调用rkmedia时,如果指定了-a参数(iqfiles)就会是通过isp的。如果你是cif链路的话,是经过VICAP的,拓扑到video0~3,你可以rkmedia_vi_venc_rtsp_test -w 1920 -h 1080 -d/dev/video0这样就可以获取到video0 的实时流了 Lenuxon 发表于 2021-9-4 15:36
感觉你是理解错了。首先我用的是rv1126,它有VICAP和ISP两个图像处理IP,调用rkmedia时,如果指定了-a参 ...
很有用的知识点.
可否请教这个信息来源?
页:
[1]