> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 运行示例应用程序

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

<div className="flex flex-col items-center gap-2">
  <img src="https://mintcdn.com/qualcomm-prod/enm1oarHdggEPW-W/Technologies/Graphics/media/qli-graphics/getting-started-graphics-1.svg?fit=max&auto=format&n=enm1oarHdggEPW-W&q=85&s=92746ae60521aade8377ab9edc581cb5" alt="图：图形应用程序工作流" width="1226" height="136" data-path="Technologies/Graphics/media/qli-graphics/getting-started-graphics-1.svg" />

  <p className="text-sm text-gray-700">
    图：图形应用程序工作流
  </p>
</div>

上面的流程图概述了使用 Platform SDK 运行和分析图形与计算示例应用程序所涉及的步骤：

1. 首先生成针对该平台定制的 SDK。
2. 运行 OpenGL ES、OpenCL 和 Vulkan 示例应用程序以验证功能。
3. 执行调试，以识别并解决示例运行期间的问题。
4. 使用 Snapdragon Profiler 工具分析图形性能问题。

## **编译并运行基于 OpenGL ES 的应用程序**

Platform SDK 提供了一个名为 glmark2 的基于 OpenGL ES 的示例应用程序。该应用程序使用 OpenGL ES API 渲染各种场景。

要编译并运行基于 OpenGL ES 的应用程序，你必须了解 [OpenGL ES API](https://registry.khronos.org/OpenGL/specs/es/3.2/es_spec_3.2.pdf)。

**前提条件**

* 使用以下任一方法安装 Platform SDK：
  * [使用 Qualcomm 发布归档](https://imsdkdocs.qualcomm.com/installation#qimsdk-on-yocto)
  * [手动编译 Qualcomm Linux SDK](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/how-to-perform-common-tasks#generate-an-sdk)
* 建立从 Linux 主机到设备的 SSH 连接。有关说明，请参阅[使用 SSH 登录](https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh)。
* 确保 Weston 应用程序正在运行。如果没有运行，请运行以下命令启动 Weston 应用程序：
  > ```text theme={null}
  > mount -o remount,rw /
  > export XDG_RUNTIME_DIR=/run/user/1000 && mkdir -p $XDG_RUNTIME_DIR
  > weston --idle-time=0 --continue-without-input
  > ```
  >
  > 有关 Weston 应用程序的更多信息，请参阅 [Qualcomm Linux 显示指南](https://dragonwingdocs.qualcomm.com/Technologies/Display/display-documentation)。

有关 Qualcomm Linux 设备支持的 OpenGL ES 扩展的信息，请参阅 [EGL 扩展](https://dragonwingdocs.qualcomm.com/Technologies/Graphics/supported-extensions#egl-extensions)。

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

1. 要在 Linux 主机上设置 SDK 环境，请运行以下命令：
   ```text theme={null}
   source environment-setup-armv8a-qcom-linux
   ```
2. 要编译并生成二进制文件，请运行以下命令：
   ```text theme={null}
   cd glmark2
   meson setup build -Dflavors=wayland-glesv2 --prefix=$PWD/build
   ninja -C build install
   ```
   如果遇到任何 umask 错误，请将 umask 设置为 022。
   编译成功后，你可以在 `<path-to-installed-sdk>/workspace/sources/glmark2/oe-workdir/image/usr/bin` 目录中找到输出文件。
3. 要将二进制文件推送到设备，请运行以下命令：
   ```text theme={null}
   scp -r <path-to-installed-Platform-sdk>/workspace/sources/glmark2/oe-workdir/image/usr/bin/glmark2-es2-wayland root@[IP-address-of-the-device]:/tmp
   ```
   ```text theme={null}
   scp -r <path-to-installed-Platform-sdk>/workspace/sources/glmark2/oe-workdir/image/usr/share/glmark2 root@[IP-address-of-the-device]:/tmp
   ```
4. 要在设备上运行该应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令：
   ```text theme={null}
   export XDG_RUNTIME_DIR=/run/user/1000 && export WAYLAND_DISPLAY=wayland-1
   chmod 777 /tmp/glmark2-es2-wayland
   chmod -R 777 /tmp/glmark2
   cd /tmp
   ./glmark2-es2-wayland --data-path /tmp/glmark2 -b jellyfish
   ```
   **注意**
   要从 UART shell 运行示例应用程序，请使用以下命令重新挂载文件系统：
   ```text theme={null}
   mount -o remount,rw /
   ```
   **注意**
   glmark2 和 X11 应用程序会遇到 X connection to :0 broken 的情况。后续版本将包含针对此问题的修复。

## **编译并运行基于 OpenCL 的应用程序**

[Adreno OpenCL SDK](https://softwarecenter.qualcomm.com/#/catalog/item/Adreno_OpenCL_SDK) 提供了许多示例应用程序。编译和运行它们的步骤是相同的。你可以使用 Adreno OpenCL SDK 开发多种应用程序。但是，在编译和运行应用程序之前，请考虑 GPU 的能力。

运行 hello world 应用程序的步骤如下：

**前提条件**

* 使用以下任一方法安装 Platform SDK：
  * [使用 Qualcomm 发布归档](https://imsdkdocs.qualcomm.com/installation#qimsdk-on-yocto)
  * [手动编译 Qualcomm Linux SDK](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/how-to-perform-common-tasks#generate-an-sdk)
* 建立从 Linux 主机到设备的 SSH 连接。有关说明，请参阅[使用 SSH 登录](https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh)。
* 下载 [Adreno OpenCL SDK](https://softwarecenter.qualcomm.com/#/catalog/item/Adreno_OpenCL_SDK)。
  **注意**
  * 你必须是注册用户才能下载 Adreno OpenCL SDK。
  * 使用 QLI 2.0 时，请确保使用 OpenCL SDK 2.4 或更新版本。

有关 Qualcomm Linux 设备支持的 OpenCL 扩展的信息，请参阅 [OpenCL 扩展](https://dragonwingdocs.qualcomm.com/Technologies/Graphics/supported-extensions#opencl-extensions)。

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

1. 要编译该应用程序，请在 Linux 主机上运行以下命令：
   ```text theme={null}
   cd opencl-sdk
   ```
   ```text theme={null}
   source <path-to-installed-Platform-sdk>/environment-setup-armv8a-qcom-linux
   ```
   ```text theme={null}
   cmake -B build -DCLSDK_OPENCL_LIBRARY=$OECORE_TARGET_SYSROOT/usr/lib/libOpenCL.so -DOPEN_EMBEDDED=1 -DOPEN_EMBEDDED_PATH=$OECORE_TARGET_SYSROOT
   cmake --build build
   ```
   代码编译成功后，系统会在 `/build` 目录中生成二进制文件。
2. 要运行该应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令：
   ```text theme={null}
   mkdir -p /tmp/data
   mkdir -p /tmp/data/opencl
   ```
   **注意**
   要从 UART shell 运行示例应用程序，请使用以下命令重新挂载文件系统：
   ```text theme={null}
   mount -o remount,rw /
   ```
3. 要将二进制文件推送到设备，请运行以下命令：
   ```text theme={null}
   scp -r <opencl-sdk>/build/* root@[IP-address-of-the device]:/tmp/data/opencl/
   ```
   ```text theme={null}
   scp -r <opencl-sdk>/example_images/* root@[IP-address-of-the device]:/tmp/data/opencl/
   ```
4. 要启动该应用程序，请通过 SSH 终端在设备上运行以下命令。对于所有 OpenCL 用例，在使用 overlay 或 `qcom‑multimedia‑proprietary‑image` 时，请确保导出 `export OCL_ICD_FILENAMES=/usr/lib/libOpenCL_adreno.so.1` 命令。
   ```text theme={null}
   cd /tmp/data/opencl/
   mkdir out
   chmod 777 ./*
   echo "run hello world 2.0 opencl sdk" > hello_world_input.txt
   touch out/hello_world_output.txt
   cat out/hello_world_output.txt
   ./cl_sdk_hello_world hello_world_input.txt out/hello_world_output.txt
   cat out/hello_world_output.txt
   ```

## **编译并运行基于 Vulkan 的应用程序**

Adreno SDK 提供了许多基于 Vulkan 的示例应用程序。编译和运行任何基于 Vulkan 的应用程序的步骤是相同的。你可以使用 Adreno SDK 开发基于 Vulkan 的应用程序。要编译并运行这些应用程序，请参阅以下步骤。作为示例，本节介绍运行 Sascha Willems 和 Khronos 基于 Vulkan 的应用程序的步骤。

**注意**

Dragonwing IQ-615 设备不支持依赖 `VK_EXT_debug_utils` 扩展的基于 Vulkan 的应用程序。后续版本将提供对该扩展的支持。

### **编译并运行 Sascha Willems 基于 Vulkan 的应用程序**

你可以在 [https://github.com/SaschaWillems/Vulkan.git](https://github.com/SaschaWillems/Vulkan.git) 找到 Sascha Willems Vulkan 示例应用程序。编译和运行任何 Sascha Willems Vulkan 应用程序的步骤是相同的。

有关 Qualcomm Linux 设备支持的 Vulkan 扩展的信息，请参阅 [Vulkan 扩展](https://dragonwingdocs.qualcomm.com/Technologies/Graphics/supported-extensions#vulkan-extensions)。

**前提条件**

* 使用以下任一方法安装 Platform SDK：
  * [使用 Qualcomm 发布归档](https://imsdkdocs.qualcomm.com/installation#qimsdk-on-yocto)
  * [手动编译 Qualcomm Linux SDK](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/how-to-perform-common-tasks#generate-an-sdk)
* 建立从 Linux 主机到设备的 SSH 连接。有关说明，请参阅[使用 SSH 登录](https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh)。

**编译并运行 triangle bin 示例应用程序的步骤**

1. 要编译该应用程序，请在 Linux 主机上运行以下命令：
   ```text theme={null}
   git clone --recurse-submodules https://github.com/SaschaWillems/Vulkan.git
   cd Vulkan
   ```
   ```text theme={null}
   source <path-to-installed-Platform-sdk>/environment-setup-armv8a-qcom-linux
   ```
   ```text theme={null}
   cmake -G "Unix Makefiles" -Bbuild/linux -DUSE_WAYLAND_WSI=ON -DRESOURCE_INSTALL_DIR="/tmp/"
   cmake --build build/linux --config Release  -j$(nproc)
   ```
   编译成功后，你可以在 `build/linux/bin` 目录中找到二进制文件。
2. 要将二进制文件推送到设备，请运行以下命令：
   ```text theme={null}
   scp -r assets root@[IP-address-of-the-device]:/tmp/
   ```
   ```text theme={null}
   scp -r shaders root@[IP-address-of-the-device]:/tmp/
   ```
   ```text theme={null}
   scp -r build/linux/bin/triangle root@[IP-address-of-the-device]:/tmp/
   ```
3. 要运行该应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令。对于所有基于 Vulkan 的用例，在使用 overlay 或 `qcom‑multimedia‑proprietary‑image` 时，请确保导出 `export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/adrenovk.json` 命令。
   ```text theme={null}
   cd /tmp
   chmod -R 777 assets/
   chmod -R 777 shaders/
   chmod 777 triangle
   export XDG_RUNTIME_DIR=/run/user/1000 && export WAYLAND_DISPLAY=wayland-1
   ./triangle
   ```

### **编译并运行 Khronos 基于 Vulkan 的应用程序**

你可以在 [https://github.com/KhronosGroup/Vulkan-Samples.git](https://github.com/KhronosGroup/Vulkan-Samples.git) 找到 Khronos 基于 Vulkan 的应用程序。编译和运行任何 Khronos 基于 Vulkan 的应用程序的步骤是相同的。

有关 Qualcomm Linux 设备支持的 Vulkan 扩展的信息，请参阅 [Vulkan 扩展](https://dragonwingdocs.qualcomm.com/Technologies/Graphics/supported-extensions#vulkan-extensions)。

**前提条件**

* 使用以下任一方法安装 Platform SDK：
  * [使用 Qualcomm 发布归档](https://imsdkdocs.qualcomm.com/installation#qimsdk-on-yocto)
  * [手动编译 Qualcomm Linux SDK](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/how-to-perform-common-tasks#generate-an-sdk)
* 建立从 Linux 主机到设备的 SSH 连接。有关说明，请参阅[使用 SSH 登录](https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh)。

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

1. 要编译该应用程序，请在 Linux 主机上运行以下命令：
   ```text theme={null}
   sudo apt-get install -y libwayland-dev
   git clone --recurse-submodules https://github.com/KhronosGroup/Vulkan-Samples.git
   cd Vulkan-Samples/
   ```
   ```text theme={null}
   source <path-to-installed-Platform-sdk>/environment-setup-armv8a-qcom-linux
   ```
   ```text theme={null}
   cmake -G "Unix Makefiles" -Bbuild/linux -DCMAKE_BUILD_TYPE=Release -DVKB_WSI_SELECTION=WAYLAND -DGLFW_BUILD_X11=OFF
   ```
   如果编译失败，请执行以下操作：
   1. 打开 `Vulkan-Samples/build/linux/CmakeCache.txt` 文件。
   2. 将 `GLFW_BUILD_X11` 更改为 `OFF`。
   3. 运行以下命令：
      ```text theme={null}
      cmake -G "Unix Makefiles" -Bbuild/linux -DCMAKE_BUILD_TYPE=Release -DVKB_WSI_SELECTION=WAYLAND -DGLFW_BUILD_X11=OFF -DVKB_compute_shaders_with_tensors=OFF -DVKB_simple_tensor_and_data_graph=OFF -DVKB_graph_constants:BOOL=OFF
      ```
2. 要生成二进制文件，请运行以下命令：
   ```text theme={null}
   cmake --build build/linux --config Release --target vulkan_samples -j$(nproc)
   ```
   编译成功后，你可以在 `Vulkan-Samples/build/linux/app/bin/Release/aarch64` 目录中找到二进制文件。
3. 要将二进制文件推送到设备，请运行以下命令：
   ```text theme={null}
   scp -r assets root@[IP-address-of-the-device]:/tmp/
   ```
   ```text theme={null}
   scp -r shaders root@[IP-address-of-the-device]:/tmp/
   ```
   ```text theme={null}
   scp -r build/linux/app/bin/Release/aarch64/vulkan_samples root@[IP-address-of-the-device]:/tmp/
   ```
4. 要运行该应用程序，请使用设备的 IP 地址打开 SSH 终端并运行以下命令。对于所有基于 Vulkan 的用例，在使用 overlay 或 `qcom‑multimedia‑proprietary‑image` 时，请确保导出 `export VK_DRIVER_FILES=/usr/share/vulkan/icd.d/adrenovk.json` 命令。
   ```text theme={null}
   cd /tmp
   chmod -R 777 assets/
   chmod -R 777 shaders/
   chmod 777 vulkan_samples
   export XDG_RUNTIME_DIR=/run/user/1000 && export WAYLAND_DISPLAY=wayland-1
   ./vulkan_samples sample swapchain_images
   ```
   **注意**
   如果你在编译或运行应用程序时遇到问题，请使用以下命令检出特定版本。然后，重复步骤 2 到 4，重新编译应用程序并运行。
   ```text theme={null}
   git checkout b3cb3822e8896ab650c4310f2c5f66a101469e9e
   git submodule sync
   git submodule update
   ```
   如果由于存储问题无法从 `/tmp` 目录运行这些示例应用程序，请尝试其他目录，例如 `/etc`。

## **编译并运行基于 X11 的应用程序**

基于 X11 的应用程序是为 X Window 系统设计的图形程序，X Window 是在 Linux 和其他类 Unix 操作系统上广泛使用的显示协议。

**前提条件**

* 使用以下任一方法安装 Platform SDK：
  * [使用 Qualcomm 发布归档](https://imsdkdocs.qualcomm.com/installation#qimsdk-on-yocto)
  * [手动编译 Qualcomm Linux SDK](https://dragonwingdocs.qualcomm.com/Key-Documents/Yocto-Guide/how-to-perform-common-tasks#generate-an-sdk)
* 建立从 Linux 主机到设备的 SSH 连接。有关说明，请参阅[使用 SSH 登录](https://dragonwingdocs.qualcomm.com/Key-Documents/Flash-Guide/how-to-sign-in-with-ssh)。
* 从 GitLab 安装 X11 相关的二进制文件。
  > * 安装 libXt（X Toolkit Intrinsics）
  >   > ```text theme={null}
  >   > git clone https://gitlab.freedesktop.org/xorg/lib/libxt.git
  >   > cd libxt
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > source <path-to-installed-Platform-sdk>/environment-setup-armv8a-qcom-linux
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > ./autogen.sh --host=aarch64-linux-gnu --prefix=<path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a/usr
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > ./configure --host=aarch64-linux-gnu --prefix=<path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a/usr
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > make
  >   > make install
  >   > cd src/.libs/
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > cp -r libX* <path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a/usr/lib
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > cd ../../..
  >   > ```
  > * 安装 libxmu（X11 的各类实用函数库）
  >   > ```text theme={null}
  >   > git clone https://gitlab.freedesktop.org/xorg/lib/libxmu.git
  >   > cd libxmu
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > source <path-to-installed-Platform-sdk>/environment-setup-armv8a-qcom-linux
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > ./autogen.sh --host=aarch64-linux-gnu --prefix=<path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a/usr
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > ./configure --host=aarch64-linux-gnu --prefix=<path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a/usr
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > make
  >   > make install
  >   > cd src/.libs/
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > cp -r libX* <path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a/usr/lib
  >   > ```
  >   >
  >   > ```text theme={null}
  >   > cd ../../..
  >   > ```
  > * 为主机安装 X 开发库
  >   > ```text theme={null}
  >   > sudo apt-get install xorg-dev
  >   > ```
* 设置 Meson
  > 1. 创建 `aarch64-qcom-linux-meson.cross` 文件。
  >    > ```text theme={null}
  >    > cd <path-to-installed-Platform-sdk>/tmp/sysroot/X86_64/usr/share/meson
  >    > vi aarch64-qcom-linux-meson.cross
  >    > ```
  > 2. 将以下文本添加到 `aarch64-qcom-linux-meson.cross` 文件并保存更改。
  >    > ```text theme={null}
  >    > [binaries]
  >    > c = ['aarch64-qcom-linux-gcc', '-march=armv8.2-a+crypto', '-mbranch-protection=standard', '-fstack-protector-strong', '-O2', '-D_FORTIFY_SOURCE=2', '-Wformat', '-Wformat-security', '-Werror=format-security', '--sysroot=<path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a']
  >    > cpp = ['aarch64-qcom-linux-g++', '-march=armv8.2-a+crypto', '-mbranch-protection=standard', '-fstack-protector-strong', '-O2', '-D_FORTIFY_SOURCE=2', '-Wformat', '-Wformat-security', '-Werror=format-security', '--sysroot=<path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a']
  >    > ar = 'aarch64-qcom-linux-ar'
  >    > nm = 'aarch64-qcom-linux-nm'
  >    > strip = 'aarch64-qcom-linux-strip'
  >    > pkgconfig = 'pkg-config'
  >    >
  >    > [built-in options]
  >    > c_args = ['-O2', '-pipe', '-g', '-feliminate-unused-debug-types']
  >    > c_link_args = ['-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed', '-Wl,-z,relro,-z,now']
  >    > cpp_args = []
  >    > cpp_link_args = ['-Wl,-O1', '-Wl,--hash-style=gnu', '-Wl,--as-needed', '-Wl,-z,relro,-z,now']
  >    >
  >    > [properties]
  >    > needs_exe_wrapper = true
  >    > sys_root = '<path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a'
  >    > [host_machine]
  >    > system = 'linux'
  >    > cpu_family = 'x86_64'
  >    > cpu = 'x86_64'
  >    > endian = 'little'
  >    > ```
  > 3. 创建 `meson.native` 文件。
  >    > ```text theme={null}
  >    > cd <path-to-installed-Platform-sdk>/tmp/sysroot/X86_64/usr/share/meson
  >    > vi meson.native
  >    > ```
  > 4. 将以下文本添加到 `meson.native` 文件并保存更改。
  >    > ```text theme={null}
  >    > [binaries]
  >    > c = 'gcc'
  >    > cpp = 'g++'
  >    > ar = 'ar'
  >    > nm = 'nm'
  >    > strip = 'strip'
  >    > readelf = 'readelf'
  >    > pkgconfig = 'pkg-config-native'
  >    >
  >    > [built-in options]
  >    > c_args = ['-isystem/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/usr/include' , '-O2', '-pipe']
  >    > c_link_args = ['-L/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/usr/lib', '-L/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/lib', '-Wl,-rpath-link,/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/usr/lib', '-Wl,-rpath-link,/<path-to-        installed-Platform-sdk>/tmp/sysroots/x86_64/lib', '-Wl,--allow-shlib-undefined', '-Wl,--dynamic-linker=/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/lib/ld-linux-x86-64.so.2']
  >    > cpp_args = ['-isystem/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/usr/include' , '-O2', '-pipe']
  >    > cpp_link_args = ['-L/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/usr/lib', '-L/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/lib', '-Wl,-rpath-link,/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/usr/lib', '-Wl,-rpath-link,/<path-to-
  >    > installed-Platform-sdk>/tmp/sysroots/x86_64/lib', '-Wl,--allow-shlib-undefined', '-Wl,--dynamic-linker=/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64/lib/ld-linux-x86-64.so.2']
  >    >
  >    > [properties]
  >    > sys_root = '/<path-to-installed-Platform-sdk>/tmp/sysroots/x86_64'
  >    > ```

**编译并运行基于 X11 的 glmark2 应用程序**

1. 要设置 SDK 环境，请在 Linux 终端中运行以下命令：
   > ```text theme={null}
   > source <path-to-installed-Platform-sdk>/environment-setup-armv8a-qcom-linux
   > ```
2. 要克隆 glmark2 源码，请运行以下命令：
   > ```text theme={null}
   > git clone https://github.com/glmark2/glmark2.git
   > cd glmark2
   > ```
3. 要进行配置，请运行以下命令：
   > ```text theme={null}
   > meson setup build -Dflavors=x11-glesv2 --prefix=$PWD/build
   > ```
4. 要编译并生成二进制文件，请运行以下命令：
   > ```text theme={null}
   > ninja -C build install
   > ```
   >
   > 生成的二进制文件位于 `build/bin` 目录。例如 `build/src/es-glmark2`。
   >
   > 数据文件位于 `build/share/glmark2`。例如 `<path-to-installed-Platform-sdk>/glmark2/source/build/share/glmark2`。
5. 要开始该过程，请运行以下命令：
   > ```text theme={null}
   > scp -r build/bin/glmark2-es2 root@[IP-address-of-the-device]:/tmp
   > ```
   >
   > ```text theme={null}
   > scp -r build/share/glmark2 root@[IP-address-of-the-device]:/tmp
   > ```
6. 要运行 Weston，请使用设备的 IP 地址打开新的 SSH 终端并运行以下命令：
   > ```text theme={null}
   > killall weston
   > export XDG_RUNTIME_DIR=/run/user/1000 && mkdir -p $XDG_RUNTIME_DIR && weston --continue-without-input --idle-time=0 --backend=drm-backend.so --xwayland
   > ```
7. 要运行 glmark2 应用程序，请使用设备的 IP 地址打开原先的 SSH 终端并运行以下命令：
   > ```text theme={null}
   > . /etc/profile
   > chmod 777 /tmp/glmark2-es2
   > chmod 777 /tmp/glmark2
   > export XDG_RUNTIME_DIR=/run/user/1000
   > mkdir --parents $XDG_RUNTIME_DIR
   > chmod 0700 $XDG_RUNTIME_DIR
   > export WAYLAND_DISPLAY=wayland-1
   > export DISPLAY=:0
   > cd /tmp/
   > ./glmark2-es2 --data-path /tmp/glmark2
   > ```

**注意**

运行 glmark2 应用程序时，一旦基准测试完成并显示最终分数，即可视为运行成功。此后出现的任何消息都可以忽略。

**编译并运行基于 X11 的 VKCube 应用程序**

1. 要设置 SDK 环境，请在 Linux 终端中运行以下命令：
   > ```text theme={null}
   > source <path-to-installed-Platform-sdk>/environment-setup-armv8a-qcom-linux
   > ```
2. 要克隆 VKCube 源码，请运行以下命令：
   > ```text theme={null}
   > git clone https://github.com/krh/vkcube.git
   > cd vkcube
   > ```
3. 要进行配置，请运行以下命令：
   > ```text theme={null}
   > meson setup build -Dxcb=true
   > ```
4. 要编译并生成二进制文件，请运行以下命令：
   > ```text theme={null}
   > ninja -C build
   > ```
   >
   > 生成的二进制文件位于 `$PWD/build/`。例如 `<path-to-installed-Platform-sdk>/vkcube/build/`。
5. 要开始该过程，请使用设备的 IP 地址打开新的 SSH 终端并运行以下命令：
   > ```text theme={null}
   > mount -o remount,rw /
   > mount -o remount,rw /usr
   > killall weston
   > export XDG_RUNTIME_DIR=/run/user/1000 && mkdir -p $XDG_RUNTIME_DIR && weston --continue-without-input --idle-time=0 --backend=drm-backend.so --xwayland
   > ```
6. 要启动 VKCube 应用程序，请使用设备的 IP 地址打开原先的 SSH 终端并运行以下命令：
   > ```text theme={null}
   > cd <path-to-installed-Platform-sdk>/vkcube/build
   > ```
   >
   > ```text theme={null}
   > mkdir -p /etc/data
   > ```
   >
   > ```text theme={null}
   > scp -r vkcube root@[IP-address-of-the-device]: /etc/data
   > ```
   >
   > ```text theme={null}
   > scp -r <path-to-installed-Platform-sdk>/tmp/sysroots/qcom-armv8a/usr/lib/libxc*/usr/lib/
   > ```
7. 使用设备的 IP 地址打开新的 SSH 终端，并运行以下命令：
   ```text theme={null}
   . /etc/profile
   export XDG_RUNTIME_DIR=/run/user/1000
   mkdir --parents $XDG_RUNTIME_DIR
   chmod 0700 $XDG_RUNTIME_DIR
   export WAYLAND_DISPLAY=wayland-1
   export DISPLAY=:0
   chmod 777 /etc/data/vkcube
   ./etc/data/vkcube
   ```

## **后续步骤**

* [调试图形问题](https://dragonwingdocs.qualcomm.com/Technologies/Graphics/debug-graphics-issues)
* [分析 GPU 性能问题](https://dragonwingdocs.qualcomm.com/Technologies/Graphics/snapdragon-profiler-tool)
* [支持的扩展](https://dragonwingdocs.qualcomm.com/Technologies/Graphics/supported-extensions)
