# 入门指南

以下工作流程展示了如何在 Qualcomm 设备上开始使用图形应用程序。

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- 由 Microsoft Visio, SVG Export 生成 getting-started-graphics.svg Page-1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="15.5833in" height="2.50694in" viewbox="0 0 1122 180.5" xml:space="preserve" color-interpolation-filters="sRGB" class="st11"><v:documentproperties v:langid="2052">	<v:userdefs>		<v:ud v:nameu="msvNoAutoConnect" v:val="VT0(1):26"></v:ud>	</v:userdefs></v:documentproperties>
<style>.svg-1 .st1 { fill: #f7f8fa; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.49999 }
.svg-1 .st2 { fill: none; stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.49999 }
.svg-1 .st3 { fill: #000000; font-family: SimHei; font-size: 1.16666em }
.svg-1 .st4 { fill: #000000; font-family: Arial; font-size: 1.00001em }
.svg-1 .st5 { font-family: SimHei; font-size: 1em }
.svg-1 .st6 { font-family: Arial; font-size: 1em }
.svg-1 .st7 { baseline-shift: 32.4943%; font-family: Arial; font-size: 0.649886em }
.svg-1 .st8 { font-size: 1em }
.svg-1 .st9 { marker-end: url("#mrkr5-41"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.49999 }
.svg-1 .st10 { fill: #000000; fill-opacity: 1; stroke: #000000; stroke-opacity: 1; stroke-width: 0.49800743337605 }
.svg-1 .st11 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<defs id="Markers">	<g id="lend5">		<path d="M 2 1 L 0 0 L 1.98117 -0.993387 C 1.67173 -0.364515 1.67301 0.372641 1.98465 1.00043 " style="stroke:none"></path>	</g>	<marker id="mrkr5-41" class="st10" v:arrowtype="5" v:arrowsize="2" v:setback="0" refx="-0" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend5" transform="scale(-2.0080021561543,-2.0080021561543) "></use>	</marker></defs><g v:mid="0" v:index="1" v:groupcontext="foregroundPage">	<title>Page-1</title>	<v:pageproperties v:drawingscale="0.0138889" v:pagescale="0.0138889" v:drawingunits="29" v:shadowoffsetx="8.99998" v:shadowoffsety="-8.99998"></v:pageproperties>	<v:layer v:name="Connector" v:index="0"></v:layer>	<g id="shape1-1" v:mid="1" v:groupcontext="shape" transform="translate(19.25,-19.25)">		<title>shape1009-1</title>		<rect x="0" y="38.5" width="1083.5" height="142" class="st1"></rect>	</g>	<g id="shape2-3" v:mid="2" v:groupcontext="shape" transform="translate(248.124,-40.4969)">		<title>shape3-3</title>		<desc>Run sample applications</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(3.99999,3.99999,3.99999,3.99999)" v:verticalalign="0"></v:textblock>		<v:textrect cx="195.75" cy="129.748" width="391.5" height="101.503"></v:textrect>		<path d="M0 171.5 A9.00019 9.00019 -180 0 0 9 180.5 L382.5 180.5 A9.00019 9.00019 -180 0 0 391.5 171.5 L391.5 88 A9.00019					 9.00019 -180 0 0 382.5 79 L9 79 A9.00019 9.00019 -180 0 0 -0 88 L0 171.5 Z" class="st2"></path>		<text x="153.75" y="113.45" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist><v:lf></v:lf>运行示例程序</text>		</g>	<g id="shape3-6" v:mid="3" v:groupcontext="shape" transform="translate(394.186,-47.4997)">		<title>shape7-6</title>		<desc>OpenCL sample application</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(3.99999,3.99999,3.99999,3.99999)"></v:textblock>		<v:textrect cx="55.717" cy="154.946" width="111.44" height="51.1071"></v:textrect>		<path d="M0 171.5 A9.00019 9.00019 -180 0 0 9 180.5 L102.43 180.5 A9.00019 9.00019 -180 0 0 111.43 171.5 L111.43 138.39					 A9.00019 9.00019 -180 0 0 102.43 129.39 L9 129.39 A9.00019 9.00019 -180 0 0 -0 138.39 L0 171.5 Z" class="st2"></path>		<text x="7.7" y="158.85" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>OpenCL <tspan class="st5">示例程序</tspan></text>		</g>	<g id="shape4-10" v:mid="4" v:groupcontext="shape" transform="translate(260.285,-47.4997)">		<title>shape8-10</title>		<desc>OpenGL ES sample application</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(3.99999,3.99999,3.99999,3.99999)"></v:textblock>		<v:textrect cx="62.0889" cy="154.946" width="124.18" height="51.1071"></v:textrect>		<path d="M0 171.5 A9.00019 9.00019 -180 0 0 9 180.5 L115.18 180.5 A9.00019 9.00019 -180 0 0 124.18 171.5 L124.18 138.39					 A9.00019 9.00019 -180 0 0 115.18 129.39 L9 129.39 A9.00019 9.00019 -180 0 0 0 138.39 L0 171.5 Z" class="st2"></path>		<text x="4.07" y="158.85" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>OpenGL ES <tspan class="st5">示例程序</tspan></text>		</g>	<g id="shape5-14" v:mid="5" v:groupcontext="shape" transform="translate(515.874,-47.5)">		<title>shape10-14</title>		<desc>Vulkan sample application</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(3.99999,3.99999,3.99999,3.99999)"></v:textblock>		<v:textrect cx="55.717" cy="153.38" width="111.44" height="54.2408"></v:textrect>		<path d="M0 171.5 A9.00019 9.00019 -180 0 0 9 180.5 L102.43 180.5 A9.00019 9.00019 -180 0 0 111.43 171.5 L111.43 135.26					 A9.00019 9.00019 -180 0 0 102.43 126.26 L9 126.26 A9.00019 9.00019 -180 0 0 -0 135.26 L0 171.5 Z" class="st2"></path>		<text x="11.7" y="157.28" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Vulkan <tspan class="st5">示例程序</tspan></text>		</g>	<g id="shape6-18" v:mid="6" v:groupcontext="shape" transform="translate(29.8749,-40.4969)">		<title>shape1016-18</title>		<desc>Generate Platform eSDK</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(3.99999,3.99999,3.99999,3.99999)"></v:textblock>		<v:textrect cx="80.1983" cy="129.748" width="160.4" height="101.503"></v:textrect>		<path d="M0 171.5 A9.00019 9.00019 -180 0 0 9 180.5 L151.4 180.5 A9.00019 9.00019 -180 0 0 160.4 171.5 L160.4 88 A9.00019					 9.00019 -180 0 0 151.4 79 L9 79 A9.00019 9.00019 -180 0 0 0 88 L0 171.5 Z" class="st2"></path>		<text x="31.97" y="134.3" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>生成平台<tspan class="st6"> </tspan><tspan class="st6">eSDK</tspan></text>		</g>	<g id="shape7-23" v:mid="7" v:groupcontext="shape" transform="translate(697.977,-41.7484)">		<title>shape1017-22</title>		<desc>Debug sample applications</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(3.99999,3.99999,3.99999,3.99999)"></v:textblock>		<v:textrect cx="80.1983" cy="129.748" width="160.4" height="101.503"></v:textrect>		<path d="M0 171.5 A9.00019 9.00019 -180 0 0 9 180.5 L151.4 180.5 A9.00019 9.00019 -180 0 0 160.4 171.5 L160.4 88 A9.00019					 9.00019 -180 0 0 151.4 79 L9 79 A9.00019 9.00019 -180 0 0 0 88 L0 171.5 Z" class="st2"></path>		<text x="38.2" y="134.3" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>调试示例程序</text>		</g>	<g id="shape8-26" v:mid="8" v:groupcontext="shape" transform="translate(912.373,-41.7484)">		<title>shape1018-26</title>		<desc>Run the Snapdragon Profiler tool for profiling sample applica...</desc>		<v:userdefs></v:userdefs>		<v:textblock v:margins="rect(3.99999,3.99999,3.99999,3.99999)"></v:textblock>		<v:textrect cx="89.9373" cy="129.748" width="179.88" height="101.503"></v:textrect>		<path d="M0 171.5 A9.00019 9.00019 -180 0 0 9 180.5 L170.87 180.5 A9.00019 9.00019 -180 0 0 179.87 171.5 L179.87 88 A9.00019					 9.00019 -180 0 0 170.87 79 L9 79 A9.00019 9.00019 -180 0 0 -0 88 L0 171.5 Z" class="st2"></path>		<text x="8.38" y="116.09" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>运行<tspan class="st6"> </tspan><tspan class="st6">Snapdragon</tspan><tspan dy="-0.235em" class="st7" v:basefontsize="13.9999">®</tspan><tspan dy="0.153em" class="st6"> </tspan><tspan class="st6">Profiler </tspan><tspan x="33.94" dy="1.3em" class="st8">工具以对示例程序<v:lf></v:lf></tspan><tspan x="47.94" dy="1.3em" class="st8">进行性能分析</tspan></text>		</g>	<g id="shape9-36" v:mid="9" v:groupcontext="shape" v:layermember="0" transform="translate(190.272,-91.2482)">		<title>shape1022-31</title>		<path d="M0 180.5 L49.07 180.5 L57.85 180.5" class="st9"></path>	</g>	<g id="shape10-42" v:mid="10" v:groupcontext="shape" v:layermember="0" transform="translate(639.624,-91.874)">		<title>shape1024-37</title>		<path d="M0 180.5 L49.57 180.5 L58.35 180.5" class="st9"></path>	</g>	<g id="shape11-47" v:mid="11" v:groupcontext="shape" v:layermember="0" transform="translate(858.373,-92.4998)">		<title>shape1025-42</title>		<path d="M0 180.5 L45.21 180.5 L53.99 180.5" class="st9"></path>	</g></g>
</svg>

**图：图形应用程序的工作流**

## 基于 OpenGL ES 的应用程序

`glmark2` 是 Platform eSDK 中提供的基于 OpenGL ES 的示例应用程序。

**前提条件**

- 使用以下任一方法安装 Platform eSDK：

    - [使用 Qualcomm 发布存档](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-51/install-sdk.html#download-qim-platform-esdk)
    - [手动编译 Qualcomm Linux SDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#generate-an-esdk)
- 建立从 Linux 主机到设备的 SSH 连接。相关说明，可参见 [SSH 使用指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
- 确保 Weston 应用程序正在运行。否则，请通过运行以下命令启动 Weston 应用程序：

> 
> 
> . /etc/profile
>         Copy to clipboard
> 
> 
> export XDG_RUNTIME_DIR=/dev/socket/weston
>         Copy to clipboard
> 
> 
> mkdir --parents $XDG_RUNTIME_DIR
>         Copy to clipboard
> 
> 
> chmod 0700 $XDG_RUNTIME_DIR
>         Copy to clipboard
> 
> 
> cd /usr/bin/
>         Copy to clipboard
> 
> 
> killall weston
>         Copy to clipboard
> 
> 
> ./weston --tty=2 --continue-without-input
>         Copy to clipboard
> 
> 
> 关于 Weston 应用程序的更多信息，请参阅 [Qualcomm Linux 显示指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-18)。

关于 Qualcomm Linux 设备上支持的 OpenGL ES 扩展信息，请参阅 [EGL 扩展](https://docs.qualcomm.com/doc/80-70017-19SC/topic/supported_extensions.html#supported-egl-client-extensions)。

**编译并运行glmark2 应用程序**

1. 要在 Linux 主机上设置 SDK 环境，请运行以下命令：

source environment-setup-armv8-2a-qcom-linux
        Copy to clipboard
2. 要编译并生成二进制文件，请运行以下命令：

devtool modify glmark2
        Copy to clipboard

devtool build glmark2
        Copy to clipboard

    如果遇到任何 umask 错误，请将 umask 设置为 022。

    编译成功后，在 `<path-to-installed-eSDK>/workspace/sources/glmark2/oe-workdir/image/usr/bin` 目录下生成输出文件。
3. 要将二进制文件推送到设备，请运行以下命令：

scp -r <path-to-installed-Platform-eSDK>/workspace/sources/glmark2/oe-workdir/image/usr/bin/glmark2-es2-wayland root@[IP-address-of-device]:/tmp
        Copy to clipboard

scp -r <path-to-installed-Platform-eSDK>/workspace/sources/glmark2/oe-workdir/image/usr/share/glmark2 root@[IP-address-of-device]:/tmp
        Copy to clipboard
4. 要在设备上运行应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令：

export XDG_RUNTIME_DIR=/dev/socket/weston export WAYLAND_DISPLAY=wayland-1
        Copy to clipboard

chmod 777 /tmp/glmark2-es2-wayland
        Copy to clipboard

chmod -R 777 /tmp/glmark2
        Copy to clipboard

cd /tmp
        Copy to clipboard

./glmark2-es2-wayland --data-path /tmp/glmark2 -b jellyfish
        Copy to clipboard

Note

请使用以下命令重新挂载文件系统，以便从 UART shell 运行示例应用程序：

mount -o remount,rw /
        Copy to clipboard

## 基于 OpenCL 的应用程序

Adreno OpenCL SDK 提供多个示例程序。编译和运行任何示例应用程序的步骤均相同。

Note

目前，Qualcomm Linux 支持 OpenCL v2.1。

**前提条件**

- 使用以下任一方法安装 Platform eSDK：

    - [使用 Qualcomm 发布存档](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-51/install-sdk.html#download-qim-platform-esdk)
    - [手动编译 Qualcomm Linux SDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#generate-an-esdk)
- 建立从 Linux 主机到设备的 SSH 连接。相关说明，可参见 [SSH 使用指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。
- 下载 [Adreno OpenCL SDK](https://softwarecenter.qualcomm.com/#/catalog/item/Adreno_OpenCL_SDK)。

Note

只允许注册用户下载 Adreno OpenCL SDK。

关于 Qualcomm Linux 设备上支持的 OpenCL 扩展信息，请参阅 [OpenCL 扩展](https://docs.qualcomm.com/doc/80-70017-19SC/topic/supported_extensions.html#supported-opencl-extensions)。

**编译并运行 hello world 示例应用程序**

1. 要编译应用程序，请在 Linux 主机上运行以下命令：

cd opencl-sdk
        Copy to clipboard

source <path-to-installed-Platform-eSDK>/environment-setup-armv8-2a-qcom-linux
        Copy to clipboard

cmake -B build -DCLSDK_OPENCL_LIBRARY=$OECORE_TARGET_SYSROOT/usr/lib/libOpenCL.so -DCLSDK_DMABUFHEAP_LIBRARY=$OECORE_TARGET_SYSROOT/usr/lib/libdmabufheap.so -DOPEN_EMBEDDED=1
        Copy to clipboard

cmake --build build
        Copy to clipboard

    编译成功后，在 `/build` 目录下生成二进制文件。
2. 要运行应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令：

mkdir -p /opt/data
        Copy to clipboard

mkdir -p /opt/data/opencl
        Copy to clipboard

Note

如果您想从 UART shell 运行示例应用程序，请使用以下命令重新挂载文件系统：

mount -o remount,rw /
        Copy to clipboard
3. 要将二进制文件推送到设备，请运行以下命令：

scp -r <opencl-sdk>/build/* root@[IP-address-of-the device]:/opt/data/opencl/
        Copy to clipboard

scp -r <opencl-sdk>/example_images/* root@[IP-address-of-the device]:/opt/data/opencl/
        Copy to clipboard
4. 请使用 SSH 终端在设备上运行以下命令，以便启动应用程序：

cd /opt/data/opencl/
        Copy to clipboard

mkdir out
        Copy to clipboard

chmod 777 ./*
        Copy to clipboard

echo "run hello world 2.0 opencl sdk" > hello_world_input.txt
        Copy to clipboard

touch out/hello_world_output.txt
        Copy to clipboard

cat out/hello_world_output.txt
        Copy to clipboard

./cl_sdk_hello_world hello_world_input.txt out/hello_world_output.txt
        Copy to clipboard

cat out/hello_world_output.txt
        Copy to clipboard

## 基于 Vulkan 的应用程序

Adreno SDK 中提供了多个 Vulkan 示例程序。编译和运行任何示例应用程序的步骤均相同。本指南以运行 Sascha Willems 和 Khronos Vulkan 示例程序的步骤为例进行了说明。

**前提条件**

- 使用以下任一方法安装 Platform eSDK：

    - [使用 Qualcomm 发布存档](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-51/install-sdk.html#download-qim-platform-esdk)
    - [手动编译 Qualcomm Linux SDK](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#generate-an-esdk)
- 建立从 Linux 主机到设备的 SSH 连接。相关说明，可参见 [SSH 使用指南](https://docs.qualcomm.com/bundle/publicresource/topics/80-70017-254/how_to.html#use-ssh)。

关于 Qualcomm Linux 设备上支持的 Vulkan 扩展的信息，请参阅 [Vulkan 扩展](https://docs.qualcomm.com/doc/80-70017-19SC/topic/supported_extensions.html#supported-vulkan-extensions)。

### 基于 Vulkan 的 Sascha Willems 应用程序

Sascha Willems Vulkan 示例程序位于 [https://github.com/SaschaWillems/Vulkan.git](https://github.com/SaschaWillems/Vulkan.git)。 编译和运行任何 Sascha Willems Vulkan 应用程序的步骤均相同。

**编译并运行三角形 bin 示例应用程序**

1. 要编译应用程序，请在 Linux 主机上运行以下命令：

git clone --recurse-submodules https://github.com/SaschaWillems/Vulkan.git
        Copy to clipboard

cd Vulkan
        Copy to clipboard

source <path-to-installed-Platform-eSDK>/environment-setup-armv8-2a-qcom-linux
        Copy to clipboard

cmake -G "Unix Makefiles" -Bbuild/linux -DUSE_WAYLAND_WSI=ON -DRESOURCE_INSTALL_DIR="/tmp/"
        Copy to clipboard

cmake --build build/linux --config Release  -j$(nproc)
        Copy to clipboard

    编译成功后，在 `build/linux/bin` 目录下生成二进制文件。
2. 要将二进制文件推送到设备，请运行以下命令：

cd Vulkan
        Copy to clipboard

scp -r assets root@[IP-address-of-device]:/tmp/
        Copy to clipboard

scp -r shaders root@[IP-address-of-device]:/tmp/
        Copy to clipboard

scp -r build/linux/bin/triangle root@[IP-address-of-device]:/tmp/
        Copy to clipboard
3. 要运行应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令：

cd /tmp
        Copy to clipboard

chmod -R 777 assets/
        Copy to clipboard

chmod -R 777 shaders/
        Copy to clipboard

chmod 777 triangle
        Copy to clipboard

export XDG_RUNTIME_DIR=/dev/socket/weston export WAYLAND_DISPLAY=wayland-1
        Copy to clipboard

./triangle
        Copy to clipboard

### 基于 Khronos Vulkan 的应用程序

Khronos Vulkan 示例程序位于 [https://github.com/KhronosGroup/Vulkan-Samples.git](https://github.com/KhronosGroup/Vulkan-Samples.git)。编译和运行任何 Khronos Vulkan 应用程序的步骤均相同。

**编译并运行 vulkan\_samples 应用程序**

1. 要编译应用程序，请在 Linux 主机上运行以下命令：

sudo apt-get install -y libwayland-dev
        Copy to clipboard

git clone --recurse-submodules https://github.com/KhronosGroup/Vulkan-Samples.git
        Copy to clipboard

cd Vulkan-Samples/
        Copy to clipboard

source <path-to-installed-Platform-eSDK>/environment-setup-armv8-2a-qcom-linux
        Copy to clipboard

cmake -G "Unix Makefiles" -Bbuild/linux -DCMAKE_BUILD_TYPE=Release -DVKB_WSI_SELECTION=WAYLAND -DGLFW_BUILD_X11=OFF
        Copy to clipboard

    如果编译失败，则执行以下操作：

    a.打开 `Vulkan-Samples/build/linux/CmakeCache.txt` 文件。
b.将 `GLFW_BUILD_X11` 更改为 `OFF`。
2. 要生成二进制文件，请运行以下命令：

cmake --build build/linux --config Release --target vulkan_samples -j$(nproc)
        Copy to clipboard

    编译成功后，在 `Vulkan-Samples/build/linux/app/bin/Release/aarch64` 目录下生成二进制文件。
3. 要将二进制文件推送到设备，请运行以下命令：

cd Vulkan-Samples
        Copy to clipboard

scp -r assets root@[IP-address-of-device]:/tmp/
        Copy to clipboard

scp -r shaders root@[IP-address-of-device]:/tmp/
        Copy to clipboard

scp -r build/linux/app/bin/Release/aarch64/vulkan_samples root@[IP-address-of-device]:/tmp/
        Copy to clipboard
4. 要运行应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令：

cd /tmp
        Copy to clipboard

chmod -R 777 assets/
        Copy to clipboard

chmod -R 777 shaders/
        Copy to clipboard

chmod 777 vulkan_samples
        Copy to clipboard

export XDG_RUNTIME_DIR=/dev/socket/weston export WAYLAND_DISPLAY=wayland-1
        Copy to clipboard

./vulkan_samples sample swapchain_images
        Copy to clipboard

Note

如果由于存储问题而无法从 `/tmp` 目录运行这些示例应用程序，请尝试其他目录，例如 `/etc`。

Last Published: Jan 23, 2025

[Previous Topic
概述](https://docs.qualcomm.com/bundle/publicresource/80-70017-19SC/topics/graphics-overview.md) [Next Topic
工具](https://docs.qualcomm.com/bundle/publicresource/80-70017-19SC/topics/graphics_developer_tools.md)