这一节主要说说rkmedia vo模块的使用。
rkmedia的vo是对DRM接口的封装,提供给用户更方便的使用,rv1126/rv1109支持两个vo图层。
1、首先先介绍一下DRM的测试命令--modetest,用来确认当前屏幕能够正常点亮。
modetest -M rockchip //打印出rk平台的显示层的信息
[root@RV1126_RV1109:/userdata]# modetest -M rockchip
Encoders:
id crtc type possible crtcs possible clones
55 53 DSI 0x00000001 0x00000000
Connectors:
id encoder status name size (mm) modes encoders
56 55 connected DSI-1 68x121 1 55
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
720x1280 60 720 768 776 828 1280 1296 1302 1317 65000 flags: nhsync, nvsync; type: preferred, driver
props:
1 EDID:
flags: immutable blob
blobs:
value:
2 DPMS:
flags: enum
enums: On=0 Standby=1 Suspend=2 Off=3
value: 0
5 link-status:
flags: enum
enums: Good=0 Bad=1
value: 0
6 non-desktop:
flags: immutable range
values: 0 1
value: 0
43 brightness:
flags: range
values: 0 100
value: 50
44 contrast:
flags: range
values: 0 100
value: 50
47 saturation:
flags: range
values: 0 100
value: 50
48 hue:
flags: range
values: 0 100
value: 50
CRTCs:
id fb pos size
53 0 (0,0) (720x1280)
720x1280 60 720 768 776 828 1280 1296 1302 1317 65000 flags: nhsync, nvsync; type: preferred, driver
props:
38 left margin:
flags: range
values: 0 100
value: 100
39 right margin:
flags: range
values: 0 100
value: 100
40 top margin:
flags: range
values: 0 100
value: 100
41 bottom margin:
flags: range
values: 0 100
value: 100
51 FEATURE:
flags: immutable bitmask
values: afbdc=0x1
value: 0
Planes:
id crtc fb CRTC x,y x,y gamma size possible crtcs
52 0 0 0,0 0,0 0 0x00000001
formats: XR24 AR24 XB24 AB24 RG24 BG24 RG16 BG16
props:
8 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
50 FEATURE:
flags: immutable bitmask
values: scale=0x1 alpha=0x2 hdr2sdr=0x4 sdr2hdr=0x8 afbdc=0x10
value: 2
54 0 0 0,0 0,0 0 0x00000001
formats: XR24 AR24 XB24 AB24 RG24 BG24 RG16 BG16 NV12 NV16 NV24
props:
8 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
50 FEATURE:
flags: immutable bitmask
values: scale=0x1 alpha=0x2 hdr2sdr=0x4 sdr2hdr=0x8 afbdc=0x10
value: 3
Frame buffers:
id size pitch
modetest -M rockchip -s 56:720x1280 //正常情况下 在对应屏幕会有彩色条纹显示
-s指定的56 是connectors id号,720x1280 是显示分辨率。rv1126 evb板配上的是此分辨率的屏,所以在正常情况下,屏幕会点亮并出现彩色条纹
效果图:
2、rkmedia的vo图层有两个:
VO_PLANE_OVERLAY :支持RGB888,ARGB8888,RGB565,422,420(nv12),444,
VO_PLANE_PRIMARY :支持RGB888,ARGB8888,RGB565
如果需要叠加ui界面,一般情况是放在primary层,overlay层用来显示视频
// VO[0] for primary plane
stVoAttr.pcDevNode = "/dev/dri/card0";
stVoAttr.emPlaneType = VO_PLANE_PRIMARY;
stVoAttr.enImgType = IMAGE_TYPE_RGB888;
stVoAttr.u16Zpos = 0;
stVoAttr.stDispRect.s32X = 0;
stVoAttr.stDispRect.s32Y = 0;
stVoAttr.stDispRect.u32Width = disp_width;
stVoAttr.stDispRect.u32Height = disp_height;
ret = RK_MPI_VO_CreateChn(0, &stVoAttr);
if (ret) {
printf("Create vo[0] failed! ret=%d\n", ret);
return -1;
}
// VO[0] for overlay plane
stVoAttr.pcDevNode = "/dev/dri/card0";
stVoAttr.emPlaneType = VO_PLANE_OVERLAY;
stVoAttr.enImgType = IMAGE_TYPE_NV12;
stVoAttr.u16Zpos = 0;
stVoAttr.stDispRect.s32X = 0;
stVoAttr.stDispRect.s32Y = 0;
stVoAttr.stDispRect.u32Width = disp_width;
stVoAttr.stDispRect.u32Height = disp_height;
ret = RK_MPI_VO_CreateChn(0, &stVoAttr);
if (ret) {
printf("Create vo[0] failed! ret=%d\n", ret);
return -1;
}
如果设置双层同时显示,记得要配置zpos。zpos的值为0或1,1在上层 0在下层。
查看屏幕信息:
cat /sys/kernel/debug/dri/0/summary
VOP [ffb00000.vop]: ACTIVE
Connector: DSI
bus_format[100a]: RGB888_1X24
overlay_mode[0] output_mode[0] color_space[0]
Display mode: 720x1280p60
clk[65000] real_clk[65000] type[48] flag[a]
H: 720 768 776 828
V: 1280 1296 1302 1317
win0-0: DISABLED
win2-0: DISABLED
post: sdr2hdr[0] hdr2sdr[0]
pre : sdr2hdr[0]
post CSC: r2y[0] y2r[0] CSC mode[1]
vo部分遇到的问题不多,只要可以用modetest点亮屏幕,用rkmedia也可以点亮。
rkmedia提供测试vo demo: rkmedia_vo_display_test
暂时关于VO部分写这么多,有新的建议后续加上来