内核驱动篇
HDMI-IN
Neardi-3588 有一个 HDMI-IN 接口,通过HDMI RX模块 开发实现HDMI IN功能的⽅法。
支持平台:Android、Linux平台
最高支持4K@60fps的分辨率
⽀持HDMI IN热拔插,⽀持录像功能
⽀持EDID可配置,⽀持HDCP1.4/HDCP2.3,⽀持CEC
Android 使用 HDMI-IN
默认版本有HDMI-IN功能,烧录Neardi-3588 最新固件百度网盘 烧录方法请参阅《使用Type-C线升级固件》一章。
烧录完成后打开系统HDMI IN应用,即可验证功能。
HDMIIN APK对应的源码路径:
rkCamera2: SDK/packages/apps/rkCamera2
Linux 使用 HDMI-IN
Neardi-3588 HDMI-IN 默认节点是 /dev/video40。
执行以下命令:
export GST_VIDEO_CONVERT_USE_RGA=1
gst-launch-1.0 v4l2src device=/dev/video40 ! kmssink plane-id=54 -v
plane-id通过以下命令获取:
cat /sys/kernel/debug/dri/0/state | grep plane
执行成功返回结果:
neardi@LPA3588:~$ gst-launch-1.0 v4l2src device=/dev/video40 ! kmssink plane-id=54 -v
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
/GstPipeline:pipeline0/GstKMSSink:kmssink0: display-width = 1920
/GstPipeline:pipeline0/GstKMSSink:kmssink0: display-height = 1080
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0.GstPad:src: caps = video/x-raw, format=(string)NV24, width=(int)1920, height=(int)1080, framerate=(fraction)120/1, interlace-mode=(string)progressive, colorimetry=(string)bt709
/GstPipeline:pipeline0/GstKMSSink:kmssink0.GstPad:sink: caps = video/x-raw, format=(string)NV24, width=(int)1920, height=(int)1080, framerate=(fraction)120/1, interlace-mode=(string)progressive, colorimetry=(string)bt709
Redistribute latency...
^Chandling interrupt.
Interrupt: Stopping pipeline ...
Execution ended after 0:00:18.453012117
Setting pipeline to NULL ...
Freeing pipeline ...
FAQ
如何获取设备信息
neardi@LPA3588:~$ v4l2-ctl -d /dev/video40 -V -D
Driver Info:
Driver name : rk_hdmirx
Card type : rk_hdmirx
Bus info : fdee0000.hdmirx-controller
Driver version : 5.10.110
Capabilities : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Format Video Capture Multiplanar:
Width/Height : 1920/1080
Pixel Format : 'NV24' (Y/CbCr 4:4:4)
Field : None
Number of planes : 1
Flags : premultiplied-alpha, 0x000000fe
Colorspace : SMPTE 170M
Transfer Function : Unknown (0x000000b8)
YCbCr/HSV Encoding: Unknown (0x000000ff)
Quantization : Default
Plane 0 :
Bytes per Line : 1920
Size Image : 6220800
HDMI-IN不显示
通过v4l2-ctl抓图验证
现象一:
v4l2-ctl -d /dev/video40 --set-fmt-video=width=1920,height=1080,pixelformat=BGR3 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/1920x1080-hdmiin.out --stream-count=1 --stream-poll >/dev/null
<<<<
返回<<<<说明硬件、HDMI线缆正常,再查看拓扑结构和Format。
查看Format:
v4l2-ctl -d 40 -V
现象二:
neardi@LPA3588:~$ v4l2-ctl -d /dev/video40 --set-fmt-video=width=1920,height=1080,pixelformat=BGR3 --stream-mmap=3 --stream-skip=3 --stream-to=/tmp/1920x1080-hdmiin.out --stream-count=1 --stream-poll >/dev/null
select timeout
返回select timeout,检查HDMIIN线缆是否插紧或换一根线。
音频如何调试
可以通过tinycap命令去录制输入的音频。
查看声卡设备
neardi@LPA3588:~$ cat /proc/asound/card*
cat: /proc/asound/card0: Is a directory
cat: /proc/asound/card1: Is a directory
cat: /proc/asound/card2: Is a directory
0 [rockchipes8388 ]: rockchip_es8388 - rockchip,es8388
rockchip,es8388
1 [rockchiphdmiin ]: rockchip_hdmiin - rockchip,hdmiin
rockchip,hdmiin
2 [rockchiphdmi0 ]: rockchip-hdmi0 - rockchip-hdmi0
rockchip-hdmi0
hdminrx的声卡号为1,可以在 HDMI-IN 有音频输入的时候运行以下命令来录制和播放音频。
录制音频
neardi@LPA3588:~$ tinycap /sdcard/test.wav