Qualcomm Robotics RB5 平台软件用户指南(2)
3.2 配置图形设置
支持以下功能。
- 概念到设计 (c2d)
- 用于嵌入式系统 (ES) 的 OpenGL
- OpenCL
- Wayland sub driver
有关 OpenGL ES 的更多信息,请参阅https://doc.lagout.org/programmation/OpenGL/OpenGL%20ES%203.0%20Programming%20Guide%20%282nd%20ed.%29%20%5BGinsburg%20%26%20Purnomo %202014-03-10%5D.pdf。
有关 OpenCL 的更多信息,请参阅Qualcomm Snapdragon 移动平台 OpenCL 通用编程和优化(80-NB295-11)。
在终端中启动 Weston EGL 示例客户端
在 Weston 桌面中运行示例 Weston 客户端应用程序,如下图所示:
笔记
设备通电后,Weston 会自动启动。
3.2.1 验证韦斯顿
使用以下命令验证 Weston 是否正在运行。
ps -ef | grep weston
显示以下输出。
根 1159 1 4 12:28 tty2 00:08:38 韦斯顿 --idle-time=0 --log=logcat --config=/etc/xdg/weston/weston.ini 根 1284 1159 0 12:28 tty2 00: 00:00 /usr/libexec/weston-keyboard 根 1286 1159 0 12:28 tty2 00:00:15 /usr/libexec/weston-desktop-shell
如果未显示上述输出,请确保通过 HDMI 连接外接显示器(1080p),并手动启动 Weston。
手动启动 Weston
使用以下命令设置XDG_RUNTIME_DIR.
adb root
adb shell
-
Linux Ubuntu:
export XDG_RUNTIME_DIR=/run/user/root
/usr/bin/weston --tty=1 --idle-time=123456
-
嵌入式Linux:
export WAYLAND_DISPLAY=wayland-1
export XDG_RUNTIME_DIR=/run/user/root
/usr/bin/weston --tty=1 --idle-time=123456
笔记
在手动启动 Weston 实例之前,请终止现有的 Weston 进程(如果存在)。
3.2.2 验证 OpenGL
用于在屏幕上渲染的示例三角形应用程序的源代码位于 <workspace/display/weston/clients/simple-egl.c>。
要运行示例应用程序,请确保启动 Weston,并使用以下命令:
-
Linux Ubuntu:
adb root
adb remount
adb shell mount -o remount,rw /
adb shell export XDG_RUNTIME_DIR=/run/user/root
cd /usr/bin/
./weston-simple-egl
-
嵌入式Linux:
adb root
adb remount
adb shell mount -o remount,rw /
export WAYLAND_DISPLAY=wayland-1
adb shell export XDG_RUNTIME_DIR=/run/user/root
cd /usr/bin/
./weston-simple-egl
3.2.3 验证 GPU 使用情况
使用以下脚本验证 GPU 使用情况。
将繁忙的脚本保存为 Perl 脚本。
#!/usr/bin/perl -w
`adb shell mount -t debugfs none /sys/kernel/debug`;
while(1)
{
$oxili_gfx3d_clk_measure = `adb shell cat "/sys/kernel/debug/clk/
gpu_cc_gx_gmu_clk/clk_rate"`;
chomp $oxili_gfx3d_clk_measure;
$bmc_clk_rate = `adb shell cat "/sys/kernel/debug/clk/bimc_qmp_clk/clk_rate"`;
chomp $bmc_clk_rate;
#$mmfab_clk_rate = `adb shell cat "/sys/kernel/debug/clk/
measure_only_memnoc_clk/clk_measure"`;
#chomp $mmfab_clk_rate;
$afab_clk_rate = `adb shell cat "sys/kernel/debug/clk/
measure_only_snoc_clk/clk_rate"`;
chomp $afab_clk_rate;
$cpu0 = `adb shell "cat /sys/devices/system/cpu/cpu0/cpufreq/
scaling_cur_freq"`;
chomp $cpu0;
$cpu1 = `adb shell "cat /sys/devices/system/cpu/cpu1/cpufreq/
scaling_cur_freq"`;
chomp $cpu1;
$cpu2 = `adb shell "cat /sys/devices/system/cpu/cpu2/cpufreq/
scaling_cur_freq"`;
chomp $cpu2;
$cpu3 = `adb shell "cat /sys/devices/system/cpu/cpu3/cpufreq/
scaling_cur_freq"`;
chomp $cpu3;
$text = sprintf("GPU %u BMIC %u AFAB %u",
$oxili_gfx3d_clk_measure,$bmc_clk_rate, $afab_clk_rate);
print "$text\n";
$text = sprintf("CPU0 %u CPU1 %u CPU2 %u CPU3 %u", $cpu0, $cpu1, $cpu2,
$cpu3);
#$text = sprintf("CPU0 %u CPU1 %u", $cpu0, $cpu1);
print "$text\n";
&busy;
print "\n";
sleep 1 ;
}
sub busy
{
$gpu3d = `adb shell cat /sys/class/kgsl/kgsl-3d0/gpubusy`;
$pct = 0.0;
if( $gpu3d =~ m/\s*(\d+)\s+(\d+)/)
{
if( $1 > 0 && $2 > 0 )
{
$pct = $1 / $2 * 100;
}
printf("3D GPU Busy: %5.2f\n", $pct);
}
}
3.3 使用 Yavta 配置 USB 摄像头
Yavta 是一款相机测试应用程序。要设置 Yavta,请执行以下步骤。
-
运行以下命令。
bitbake yavta
-
插入USB摄像头,找到新添加的设备 /dev/videoX。例如,/dev/video3。
-
使用以下命令检查设备支持的输出格式、分辨率和每秒帧数 (fps)。
yavta --enum-formats (./yavta /dev/video0)
例如:设备 /dev/video0打开:高清网络摄像头C525 (usb-0000:00:14.0-9)。
-
格式0:YUYV(56595559),类型:视频捕获(1)
名称:YUYV 4:2:2Frame size: 640x480 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 160x120 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 176x144 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 320x176 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 320x240 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 432x240 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 352x288 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 544x288 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 640x360 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 752x416 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 800x448 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 864x480 (1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 960x544 (1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1024x576 (1/15, 1/10, 2/15, 1/5) Frame size: 800x600 (1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1184x656 (1/15, 1/10, 2/15, 1/5) Frame size: 960x720 (1/15, 1/10, 2/15, 1/5) Frame size: 1280x720 (1/10, 2/15, 1/5) Frame size: 1392x768 (1/10, 2/15, 1/5) Frame size: 1504x832 (2/15, 1/5) Frame size: 1600x896 (2/15, 1/5) Frame size: 1280x960 (2/15, 1/5) Frame size: 1712x960 (1/5) Frame size: 1792x1008 (1/5) Frame size: 1920x1080 (1/5)
-
格式1:MJPG(47504a4d),类型:视频捕捉(1)
名称:Motion-JPEGFrame size: 640x480 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 160x120 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 176x144 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 320x176 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 320x240 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 432x240 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 352x288 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 544x288 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 640x360 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 752x416 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 800x448 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 864x480 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 960x544 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1024x576 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 800x600 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1184x656 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 960x720 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1280x720 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1392x768 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1504x832 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1600x896 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1280x960 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1712x960 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1792x1008 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5) Frame size: 1920x1080 (1/30, 1/24, 1/20, 1/15, 1/10, 2/15, 1/5)
-
笔记
当选择 YUYV 格式时,仅当输出尺寸小于 800 x 448 时,输出帧率才能达到 30 fps。MJPEG 格式则没有此限制。
-
设置图像格式和图像大小。
- 指定 MJPEG 格式并将 1280 x 960 输出尺寸指定为 30 fps。在/data/下保存 10 个文件 。生成的文件名为testmjpeg-*.bin。
./yavta -f MJPEG -s 1280x960 -t 1/30 -c10 -F/data/testmjpeg /dev/video3 #
- 指定 YUV 格式和 1280 x 960 输出尺寸为 30 fps。在/data/下保存 10 个文件 。生成的文件名为testyuv-*.bin。
./yavta -f YUYV -s 1280x960 -t 1/30 -c10 -F/data/testyuv /dev/video3 #
c. 将*.bin拉到/data/下 ,并将文件扩展名修改为 .yuv或 .jpeg。使用7yuv或jpeg应用程序验证文件。