1. Xilinx backend
Xilinx为MPSoC支持4种libMali的backend: X11, Wayland/GBM, Fbdev, Headless-EGL.
2. QT
QT支持4种plugin(插件)或者backend,FB,X11,Wayland,eglfs。对不同的plugin(插件)或者backend,QT应用层是一样的。
其中的FB,不能利用GPU做渲染。
EGLFS可以让QT应用直接运行在EGL和OpenGL ES 2.0上。也就是,可以在没有窗口管理器(windowing system like X11 or Wayland)的情况下,运行QT软件。对于有GPU的嵌入式Linux系统,建议使用eglfs。
当使用KMS/DRM时,EGLFS的Backend是eglfs_kms。
更多信息,可以参考QT文档,https://doc.qt.io/qt-5/embedded-linux.html
3. Xilinx支持情况
Xilinx支持eglfs_kms。 本文的命令可以在Xilinx的ZCU102和ZCU106单板上运行。所有测试基于PetaLinux 2020.2的ZCU102和ZCU106 BSP的工程。
3.1. rootfs
在Linux的rootfs里,增加qt相关的软件。使用命令petalinux-config -c rootfs配置Linux的rootfs,使能packagegroup-petalinux-qt。
3.2. libMali
使用eglfs_kms时,libMali.so.9.0使用对应的wayland版本,指向到/usr/lib/wayland/libMali.so.9.0。
在文件project-spec/meta-user/conf/petalinuxbsp.conf里,增加下列行,可以使libMali.so.9.0指向到/usr/lib/wayland/libMali.so.9.0。
代码语言:javascript复制MALI_BACKEND_DEFAULT = "wayland"
也可以在Linux运行的时侯,执行下列命令,使libMali.so.9.0指向到/usr/lib/wayland/libMali.so.9.0。
代码语言:javascript复制update-alternatives --install /usr/lib/libMali.so.9.0 libmali /usr/lib/wayland/libMali.so.9.0 90
3.3. QT环境设置
为了让QT使用eglfs_kms,需要设置下列两个环境变量。
代码语言:javascript复制export QT_QPA_PLATFORM=eglfs
export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
QT还可以通过JSON文件设置有更多参数可以设置。通过导出 系统变量QT_QPA_EGLFS_KMS_CONFIG,可以指定JSON文件名,比如
代码语言:javascript复制export QT_QPA_EGLFS_KMS_CONFIG="/home/root/kms.conf"
kms.conf的内容如下:
代码语言:javascript复制{
"device": "/dev/dri/card0",
"hwcursor": false,
"pbuffers": true,
"outputs": [
{
"name": "DP",
"mode": "3840x2160"
}
]
}
3.4. 检测显示器
通过下列命令检查显示器,并设置它的分辨率。
代码语言:javascript复制ls /dev/dri/by-path/
modetest -D fd4a0000.zynqmp-display
modetest -D fd4a0000.zynqmp-display -s 43:1920x1080-60@BG24
modetest -D fd4a0000.zynqmp-display -s 43:3840x2160-29.98@BG24
3.5. QT测试程序
3.5.1. 默认测试程序
PetaLinux编译出的文件系统,在目录/usr/share/examples/opengl下,有很多opengl的测试程序,比如cube和textures。
代码语言:javascript复制/usr/share/examples/opengl/cube/cube
/usr/share/examples/opengl/textures/textures
3.5.2. qt5everywheredemo
更复杂的opengl的测试程序,QtDemo可以通过qt5everywheredemo编译。
下面的命令,直接编译qt5everywheredemo。
代码语言:javascript复制petalinux-build -c qt5everywheredemo -x compile
在文件petalinuxbsp.conf里添加下列行后,PetaLinux编译时会包含qt5everywheredemo。
代码语言:javascript复制MALI_BACKEND_DEFAULT = "wayland"
IMAGE_INSTALL_append = " qt5everywheredemo"
之后在目录/usr/share/qt5everywheredemo-1.0/里能找到
代码语言:javascript复制root@xilinx-zcu106-2020_2:/# find -name "QtDemo"
./usr/share/qt5everywheredemo-1.0/qml/QtDemo
./usr/share/qt5everywheredemo-1.0/QtDemo
4. 参考文章
Xilinx Arm Mali-400 Driver
5. 常见错误
5.1. 没接DP显示器
如果没接DP显示器,会报告错误,“Cannot create window: no screens available”。
代码语言:javascript复制Cannot create window: no screens available
6. 更多记录
6.1. ZCU106 BSP 2020.2 Log
下面log中的“^C”,表示图像软件正常运行,用户使用Ctrl C, 也就是“^C”,终止了图像软件。
代码语言:javascript复制xilinx-zcu106-2020_2 login: root
Password:
root@xilinx-zcu106-2020_2:~# uname -a
Linux xilinx-zcu106-2020_2 5.4.0-xilinx-v2020.2 #1 SMP Wed Dec 2 07:02:26 UTC 2020 aarch64 GNU/Linux
root@xilinx-zcu106-2020_2:~# ps -A
PID USER TIME COMMAND
1 root 0:07 init
2 root 0:00 [kthreadd]
3 root 0:00 [rcu_gp]
4 root 0:00 [rcu_par_gp]
5 root 0:00 [kworker/0:0-mm_]
6 root 0:00 [kworker/0:0H-mm]
7 root 0:00 [kworker/u8:0-ev]
8 root 0:00 [mm_percpu_wq]
9 root 0:00 [ksoftirqd/0]
10 root 0:00 [rcu_sched]
11 root 0:00 [migration/0]
12 root 0:00 [cpuhp/0]
13 root 0:00 [cpuhp/1]
14 root 0:00 [migration/1]
15 root 0:00 [ksoftirqd/1]
16 root 0:00 [kworker/1:0-eve]
17 root 0:00 [kworker/1:0H-kb]
18 root 0:00 [cpuhp/2]
19 root 0:00 [migration/2]
20 root 0:00 [ksoftirqd/2]
21 root 0:00 [kworker/2:0-eve]
22 root 0:00 [kworker/2:0H-kb]
23 root 0:00 [cpuhp/3]
24 root 0:00 [migration/3]
25 root 0:00 [ksoftirqd/3]
26 root 0:00 [kworker/3:0-eve]
27 root 0:00 [kworker/3:0H-kb]
28 root 0:00 [kdevtmpfs]
29 root 0:00 [netns]
30 root 0:00 [kauditd]
31 root 0:00 [kworker/3:1-mm_]
32 root 0:00 [oom_reaper]
33 root 0:00 [writeback]
34 root 0:00 [kcompactd0]
35 root 0:00 [khugepaged]
37 root 0:00 [kworker/2:1-eve]
38 root 0:00 [kworker/0:1-eve]
39 root 0:00 [kworker/u8:1-ev]
67 root 0:00 [cryptd]
127 root 0:00 [kblockd]
128 root 0:00 [blkcg_punt_bio]
129 root 0:00 [kworker/1:1-eve]
130 root 0:00 [edac-poller]
131 root 0:00 [watchdogd]
132 root 0:00 [rpciod]
133 root 0:00 [kworker/u9:0]
134 root 0:00 [xprtiod]
135 root 0:00 [cfg80211]
296 root 0:00 [kswapd0]
297 root 0:00 [ecryptfs-kthrea]
298 root 0:00 [nfsiod]
307 root 0:00 [ion_system_heap]
308 root 0:00 [kpktgend_0]
309 root 0:00 [kpktgend_1]
310 root 0:00 [kpktgend_2]
311 root 0:00 [kpktgend_3]
312 root 0:00 [ipv6_addrconf]
313 root 0:00 [krfcommd]
314 root 0:00 [kworker/3:2-eve]
315 root 0:09 [irq/48-fd4a0000]
316 root 0:00 [kworker/3:3-eve]
317 root 0:00 [scsi_eh_0]
318 root 0:00 [scsi_tmf_0]
319 root 0:00 [scsi_eh_1]
320 root 0:00 [scsi_tmf_1]
321 root 0:00 [spi0]
322 root 0:00 [kworker/u8:2-ev]
323 root 0:00 [kworker/u8:3]
325 root 0:00 [sdhci]
326 root 0:00 [irq/41-mmc0]
331 root 0:00 [mmc_complete]
332 root 0:00 [kworker/3:1H-kb]
333 root 0:00 [kworker/0:1H-mm]
366 root 0:00 /sbin/udevd -d
578 root 0:00 [kworker/3:2H]
579 root 0:00 [kworker/1:1H]
580 root 0:00 [kworker/1:2H]
588 root 0:00 [kworker/2:1H]
633 root 0:00 [kworker/1:2-mm_]
804 root 0:00 [irq/54-a0100000]
805 root 0:00 [irq/54-a0120000]
970 root 0:00 udhcpc -R -b -p /var/run/udhcpc.eth0.pid -i eth0
977 messageb 0:00 /usr/bin/dbus-daemon --system
980 root 0:00 /usr/sbin/haveged -w 1024 -v 1
989 root 0:00 xinit /etc/X11/Xsession -- /usr/bin/Xorg :0 -br -pn
994 root 0:00 /usr/bin/Xorg :0 -br -pn
1008 root 0:00 matchbox-window-manager -theme Sato -use_cursor yes
1016 root 0:00 dbus-launch --sh-syntax --exit-with-session
1017 root 0:00 /usr/bin/dbus-daemon --syslog --fork --print-pid 5 --print-address 7 --session
1036 root 0:00 /usr/libexec/at-spi-bus-launcher --launch-immediately
1048 root 0:00 /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-a
1062 root 0:00 matchbox-desktop
1063 root 0:00 matchbox-panel --start-applets showdesktop,windowselector --end-applets clock,,systray,startup-notif
1066 root 0:00 /usr/libexec/gconfd-2
1070 root 0:00 /usr/bin/settings-daemon
1072 root 0:00 /usr/libexec/at-spi2-registryd --use-gnome-session
1075 root 0:00 /usr/sbin/console-kit-daemon --no-daemon
1142 root 0:00 /usr/sbin/dropbear -r /etc/dropbear/dropbear_rsa_host_key -p 22 -B
1149 root 0:00 /usr/sbin/inetd
1153 root 0:00 /sbin/syslogd -n -O /var/log/messages
1156 root 0:00 /sbin/klogd -n
1167 root 0:00 /usr/sbin/tcf-agent -d -L- -l0
1172 root 0:00 {start_getty} /bin/sh /bin/start_getty 115200 ttyPS0 vt102
1173 root 0:00 /sbin/getty 38400 tty1
1187 root 0:00 /bin/login --
1195 root 0:00 -sh
1200 root 0:00 ps -A
root@xilinx-zcu106-2020_2:~# ps -A | grep -i xorg
989 root 0:00 xinit /etc/X11/Xsession -- /usr/bin/Xorg :0 -br -pn
994 root 0:00 /usr/bin/Xorg :0 -br -pn
1202 root 0:00 grep -i xorg
root@xilinx-zcu106-2020_2:~# kill 994
root@xilinx-zcu106-2020_2:~# XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
after 308 requests (308 known processed) with 0 events remaining.
Gdk-Message: 02:39:54.875: matchbox-panel: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
Gdk-Message: 02:39:54.877: settings-daemon: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
Gdk-Message: 02:39:54.880: matchbox-desktop: Fatal IO error 11 (Resource temporarily unavailable) on X server :0.
xinit: connection to X server lost
waiting for X server to shut down (II) Server terminated successfully (0). Closing log file.
root@xilinx-zcu106-2020_2:~# export QT_QPA_PLATFORM="eglfs"
root@xilinx-zcu106-2020_2:~# export QT_QPA_EGLFS_INTEGRATION="eglfs_kms"
root@xilinx-zcu106-2020_2:~# ls -l /usr/lib/libMali.so.9.0
lrwxrwxrwx 1 root root 31 Dec 11 02:36 /usr/lib/libMali.so.9.0 -> /usr/lib/wayland/libMali.so.9.0
root@xilinx-zcu106-2020_2:~# cd /usr/share/examples/opengl/textures
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# ls /dev/dri/by-path/
platform-fd4a0000.zynqmp-display-card
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# modetest -D fd4a0000.zynqmp-display
trying to open device 'i915'...done
Encoders:
id crtc type possible crtcs possible clones
42 41 TMDS 0x00000001 0x00000000
Connectors:
id encoder status name size (mm) modes encoders
43 42 connected DP-1 610x350 34 42
modes:
name refresh (Hz) hdisp hss hse htot vdisp vss vse vtot)
3840x2160 29.98 3840 3888 3920 4000 2160 2163 2168 2191 262750 flags: phsync, nvsync; type: driver
2560x1440 59.95 2560 2608 2640 2720 1440 1443 1448 1481 241500 flags: phsync, nvsync; type: driver
2048x1280 59.99 2048 2192 2416 2784 1280 1281 1284 1325 221277 flags: nhsync, pvsync; type:
1920x1200 59.88 1920 2056 2256 2592 1200 1203 1209 1245 193250 flags: nhsync, pvsync; type: driver
2048x1080 24.00 2048 2096 2128 2208 1080 1083 1093 1099 58230 flags: phsync, nvsync; type: driver
1920x1080 60.00 1920 2008 2052 2200 1080 1082 1087 1125 148500 flags: phsync, pvsync; type: driver
1920x1080 60.00 1920 2008 2052 2200 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver
1920x1080 59.94 1920 2008 2052 2200 1080 1084 1089 1125 148352 flags: phsync, pvsync; type: driver
1920x1080 50.00 1920 2448 2492 2640 1080 1084 1089 1125 148500 flags: phsync, pvsync; type: driver
1920x1080 24.00 1920 2558 2602 2750 1080 1084 1089 1125 74250 flags: phsync, pvsync; type: driver
1920x1080 23.98 1920 2558 2602 2750 1080 1084 1089 1125 74176 flags: phsync, pvsync; type: driver
1600x1200 60.00 1600 1664 1856 2160 1200 1201 1204 1250 162000 flags: phsync, pvsync; type: driver
1600x900 60.00 1600 1624 1704 1800 900 901 904 1000 108000 flags: phsync, pvsync; type: driver
1280x1024 75.02 1280 1296 1440 1688 1024 1025 1028 1066 135000 flags: phsync, pvsync; type: driver
1280x1024 60.02 1280 1328 1440 1688 1024 1025 1028 1066 108000 flags: phsync, pvsync; type: driver
1152x864 75.00 1152 1216 1344 1600 864 865 868 900 108000 flags: phsync, pvsync; type: driver
1280x720 60.00 1280 1390 1430 1650 720 725 730 750 74250 flags: phsync, pvsync; type: driver
1280x720 59.94 1280 1390 1430 1650 720 725 730 750 74176 flags: phsync, pvsync; type: driver
1280x720 50.00 1280 1720 1760 1980 720 725 730 750 74250 flags: phsync, pvsync; type: driver
1024x768 75.03 1024 1040 1136 1312 768 769 772 800 78750 flags: phsync, pvsync; type: driver
1024x768 60.00 1024 1048 1184 1344 768 771 777 806 65000 flags: nhsync, nvsync; type: driver
800x600 75.00 800 816 896 1056 600 601 604 625 49500 flags: phsync, pvsync; type: driver
800x600 60.32 800 840 968 1056 600 601 605 628 40000 flags: phsync, pvsync; type: driver
720x576 50.00 720 732 796 864 576 581 586 625 27000 flags: nhsync, nvsync; type: driver
720x576 50.00 720 732 796 864 576 581 586 625 27000 flags: nhsync, nvsync; type: driver
720x480 60.00 720 736 798 858 480 489 495 525 27027 flags: nhsync, nvsync; type: driver
720x480 60.00 720 736 798 858 480 489 495 525 27027 flags: nhsync, nvsync; type: driver
720x480 59.94 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver
720x480 59.94 720 736 798 858 480 489 495 525 27000 flags: nhsync, nvsync; type: driver
640x480 75.00 640 656 720 840 480 481 484 500 31500 flags: nhsync, nvsync; type: driver
640x480 60.00 640 656 752 800 480 490 492 525 25200 flags: nhsync, nvsync; type: driver
640x480 59.94 640 656 752 800 480 490 492 525 25175 flags: nhsync, nvsync; type: driver
640x480 59.94 640 656 752 800 480 490 492 525 25175 flags: nhsync, nvsync; type: driver
720x400 70.08 720 738 846 900 400 412 414 449 28320 flags: nhsync, pvsync; type: driver
props:
1 EDID:
flags: immutable blob
blobs:
value:
00ffffffffffff0010ac2aa14c543830
171d0104b53d23783eee95a3544c9926
0f5054a54b00714f8180a9c0a940d1c0
e100d10001014dd000a0f0703e803020
3500615d2100001a000000ff004d5950
464b3936323038544c0a000000fc0044
454c4c205532373138514d0a000000fd
0031560a8936000a202020202020013d
02031df150101f200514041312110302
161507060123091f0783010000565e00
a0a0a0295030203500615d2100001aa3
6600a0f0701f8030203500615d210000
1a4dd000a0f0703e8030203500615d21
00001a023a801871382d40582c250061
5d2100001ebf1600a08038134030203a
00615d2100001a00000000000000004a
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
4 TILE:
flags: immutable blob
blobs:
value:
21 CRTC_ID:
flags: object
value: 41
44 sync:
flags: range
values: 0 1
value: 0
45 bpc:
flags: enum
enums: 6BPC=6 8BPC=8 10BPC=10 12BPC=12
value: 8
CRTCs:
id fb pos size
41 46 (0,0) (3840x2160)
3840x2160 29.98 3840 3888 3920 4000 2160 2163 2168 2191 262750 flags: phsync, nvsync; type: driver
props:
23 ACTIVE:
flags: range
values: 0 1
value: 1
24 MODE_ID:
flags: blob
blobs:
value:
5e020400000f300f500fa00f00007008
730878088f0800001e00000009000000
40000000333834307832313630000000
00000000000000000000000000000000
00000000
20 OUT_FENCE_PTR:
flags: range
values: 0 18446744073709551615
value: 0
25 VRR_ENABLED:
flags: range
values: 0 1
value: 0
34 output_color:
flags: enum
enums: rgb=0 ycrcb444=1 ycrcb422=2 yonly=3
value: 0
35 bg_c0:
flags: range
values: 0 4095
value: 0
36 bg_c1:
flags: range
values: 0 4095
value: 0
37 bg_c2:
flags: range
values: 0 4095
value: 0
Planes:
id crtc fb CRTC x,y x,y gamma size possible crtcs
39 0 0 0,0 0,0 0 0x00000001
formats: VYUY UYVY YUYV YVYU YU16 YV16 YU24 YV24 NV16 NV61 GREY Y10 BG24 RG24 XB24 XR24 XB30 XR30 YU12 YV12 NV12 NV21 XV15 XV20
props:
9 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 0
18 FB_ID:
flags: object
value: 0
19 IN_FENCE_FD:
flags: signed range
values: -1 2147483647
value: -1
21 CRTC_ID:
flags: object
value: 0
14 CRTC_X:
flags: signed range
values: -2147483648 2147483647
value: 0
15 CRTC_Y:
flags: signed range
values: -2147483648 2147483647
value: 0
16 CRTC_W:
flags: range
values: 0 2147483647
value: 0
17 CRTC_H:
flags: range
values: 0 2147483647
value: 0
10 SRC_X:
flags: range
values: 0 4294967295
value: 0
11 SRC_Y:
flags: range
values: 0 4294967295
value: 0
12 SRC_W:
flags: range
values: 0 4294967295
value: 0
13 SRC_H:
flags: range
values: 0 4294967295
value: 0
38 tpg:
flags: range
values: 0 1
value: 0
40 41 46 0,0 0,0 0 0x00000001
formats: AB24 AR24 RA24 BA24 BG24 RG24 RA15 BA15 RA12 BA12 RG16 BG16
props:
9 type:
flags: immutable enum
enums: Overlay=0 Primary=1 Cursor=2
value: 1
18 FB_ID:
flags: object
value: 46
19 IN_FENCE_FD:
flags: signed range
values: -1 2147483647
value: -1
21 CRTC_ID:
flags: object
value: 41
14 CRTC_X:
flags: signed range
values: -2147483648 2147483647
value: 0
15 CRTC_Y:
flags: signed range
values: -2147483648 2147483647
value: 0
16 CRTC_W:
flags: range
values: 0 2147483647
value: 3840
17 CRTC_H:
flags: range
values: 0 2147483647
value: 2160
10 SRC_X:
flags: range
values: 0 4294967295
value: 0
11 SRC_Y:
flags: range
values: 0 4294967295
value: 0
12 SRC_W:
flags: range
values: 0 4294967295
value: 251658240
13 SRC_H:
flags: range
values: 0 4294967295
value: 141557760
32 alpha:
flags: range
values: 0 255
value: 255
33 g_alpha_en:
flags: range
values: 0 1
value: 1
Frame buffers:
id size pitch
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# modetest -D fd4a0000.zynqmp-display -s 43:1920x1080-60@BG24
trying to open device 'i915'...done
setting mode 1920x1080-60.00Hz@BG24 on connectors 43, crtc 41
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# ./textures
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
Setting framebuffer size is only available with DRM atomic API
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
^C
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# modetest -D fd4a0000.zynqmp-display -s 43:3840x2160-29.98@BG24
trying to open device 'i915'...done
setting mode 3840x2160-29.98Hz@BG24 on connectors 43, crtc 41
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# ./textures
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
Setting framebuffer size is only available with DRM atomic API
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
^C
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# modetest -D fd4a0000.zynqmp-display -s 43:1280x1024-60.02@BG24
trying to open device 'i915'...done
setting mode 1280x1024-60.02Hz@BG24 on connectors 43, crtc 41
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# ./textures
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
Setting framebuffer size is only available with DRM atomic API
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
^C
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# modetest -D fd4a0000.zynqmp-display -s 43:1280x720-60@BG24
trying to open device 'i915'...done
setting mode 1280x720-60.00Hz@BG24 on connectors 43, crtc 41
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# ./textures
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
Setting framebuffer size is only available with DRM atomic API
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
^C
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# modetest -D fd4a0000.zynqmp-display -s 43:800x600-60.32@BG24
trying to open device 'i915'...done
setting mode 800x600-60.32Hz@BG24 on connectors 43, crtc 41
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# ./textures
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
Setting framebuffer size is only available with DRM atomic API
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
^C
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# modetest -D fd4a0000.zynqmp-display -s 43:640x480-59.94@BG24
trying to open device 'i915'...done
setting mode 640x480-59.94Hz@BG24 on connectors 43, crtc 41
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# ./textures
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
Setting framebuffer size is only available with DRM atomic API
Attribute Qt::AA_ShareOpenGLContexts must be set before QCoreApplication is created.
^C
root@xilinx-zcu106-2020_2:/usr/share/examples/opengl/textures# uname -a
Linux xilinx-zcu106-2020_2 5.4.0-xilinx-v2020.2 #1 SMP Wed Dec 2 07:02:26 UTC 2020 aarch64 GNU/Linux
root@xilinx-zcu106-2020_2:/# cd ~
root@xilinx-zcu106-2020_2:~# export QT_QPA_PLATFORM="eglfs"
root@xilinx-zcu106-2020_2:~# export QT_QPA_EGLFS_KMS_ATOMIC=1
root@xilinx-zcu106-2020_2:~# export QT_QPA_EGLFS_INTEGRATION="eglfs_kms"
root@xilinx-zcu106-2020_2:~# export QT_QPA_EGLFS_KMS_CONFIG="/home/root/kms.conf"
root@xilinx-zcu106-2020_2:~# export QT_QPA_EGLFS_DEBUG="1"
root@xilinx-zcu106-2020_2:~# export QT_QPA_EGLFS_FORCE888=1
root@xilinx-zcu106-2020_2:/# cd /usr/share/qt5everywheredemo-1.0/
root@xilinx-zcu106-2020_2:/usr/share/qt5everywheredemo-1.0# ./QtDemo
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/var/volatile/tmp/runtime-root'
qt.qpa.eglfs.kms: Could not open config file "/home/root/kms.conf" for reading
Framebuffer size format is invalid.
Created context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize 8, greenBufferSize 8, blueBufferSize 8, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile) with config:
EGL_BUFFER_SIZE: 32
EGL_ALPHA_SIZE: 8
EGL_BLUE_SIZE: 8
EGL_GREEN_SIZE: 8
EGL_RED_SIZE: 8
EGL_DEPTH_SIZE: 24
EGL_STENCIL_SIZE: 8
EGL_CONFIG_CAVEAT: 12344
EGL_CONFIG_ID: 9
EGL_LEVEL: 0
EGL_MAX_PBUFFER_HEIGHT: 4096
EGL_MAX_PBUFFER_PIXELS: 16777216
EGL_MAX_PBUFFER_WIDTH: 4096
EGL_NATIVE_RENDERABLE: 1
EGL_NATIVE_VISUAL_ID: 875713089
EGL_NATIVE_VISUAL_TYPE: 0
EGL_SAMPLES: 0
EGL_SAMPLE_BUFFERS: 0
EGL_SURFACE_TYPE: 1031
EGL_TRANSPARENT_TYPE: 12344
EGL_TRANSPARENT_BLUE_VALUE: 0
EGL_TRANSPARENT_GREEN_VALUE: 0
EGL_TRANSPARENT_RED_VALUE: 0
EGL_BIND_TO_TEXTURE_RGB: 1
EGL_BIND_TO_TEXTURE_RGBA: 1
EGL_MIN_SWAP_INTERVAL: 0
EGL_MAX_SWAP_INTERVAL: 10
^C
7. 其它
通过修改DP驱动,可以在没有接DP显示器时,运行的QT程序,并拿到framebuffer,再做其它处理。