xref: /aosp_15_r20/external/angle/doc/ExternalBenchmarks.md (revision 8975f5c5ed3d1c378011245431ada316dfb6f244)
1*8975f5c5SAndroid Build Coastguard Worker# Using External Benchmarks with ANGLE
2*8975f5c5SAndroid Build Coastguard Worker
3*8975f5c5SAndroid Build Coastguard WorkerThis document contains instructions on how to run external benchmarks on ANGLE as the GLES renderer.
4*8975f5c5SAndroid Build Coastguard WorkerThere is a section for each benchmark with subsections for each platform.  The general theme is to
5*8975f5c5SAndroid Build Coastguard Workermake the benchmark application pick ANGLE's `libGLESv2.so` and `libEGL.so` files instead of the
6*8975f5c5SAndroid Build Coastguard Workersystem ones.
7*8975f5c5SAndroid Build Coastguard Worker
8*8975f5c5SAndroid Build Coastguard WorkerOn Linux, this is generally achieved with setting `LD_LIBRARY_PATH`.  On Windows, ANGLE dlls may
9*8975f5c5SAndroid Build Coastguard Workerneed to be copied to the benchmark's executable directory.
10*8975f5c5SAndroid Build Coastguard Worker
11*8975f5c5SAndroid Build Coastguard Worker## glmark2
12*8975f5c5SAndroid Build Coastguard Worker
13*8975f5c5SAndroid Build Coastguard WorkerThis benchmark can be found on [github](https://github.com/glmark2/glmark2).  It's written against
14*8975f5c5SAndroid Build Coastguard WorkerGLES 2.0 and supports Linux and Android.  It performs tens of tests and reports the framerate for
15*8975f5c5SAndroid Build Coastguard Workereach test.
16*8975f5c5SAndroid Build Coastguard Worker
17*8975f5c5SAndroid Build Coastguard Worker### glmark2 on Linux
18*8975f5c5SAndroid Build Coastguard Worker
19*8975f5c5SAndroid Build Coastguard WorkerTo build glmark2 on Linux:
20*8975f5c5SAndroid Build Coastguard Worker
21*8975f5c5SAndroid Build Coastguard Worker```
22*8975f5c5SAndroid Build Coastguard Worker$ git clone https://github.com/glmark2/glmark2.git
23*8975f5c5SAndroid Build Coastguard Worker$ cd glmark2
24*8975f5c5SAndroid Build Coastguard Worker$ ./waf configure --with-flavors=x11-glesv2 --data-path=$PWD/data/
25*8975f5c5SAndroid Build Coastguard Worker$ ./waf
26*8975f5c5SAndroid Build Coastguard Worker```
27*8975f5c5SAndroid Build Coastguard Worker
28*8975f5c5SAndroid Build Coastguard WorkerTo run glmark2 using the native implementation of GLES:
29*8975f5c5SAndroid Build Coastguard Worker
30*8975f5c5SAndroid Build Coastguard Worker```
31*8975f5c5SAndroid Build Coastguard Worker$ cd build/src
32*8975f5c5SAndroid Build Coastguard Worker$ ./glmark2-es2
33*8975f5c5SAndroid Build Coastguard Worker```
34*8975f5c5SAndroid Build Coastguard Worker
35*8975f5c5SAndroid Build Coastguard WorkerTo run glmark2 using ANGLE, we need to first create a few links in the build directory of ANGLE:
36*8975f5c5SAndroid Build Coastguard Worker
37*8975f5c5SAndroid Build Coastguard Worker```
38*8975f5c5SAndroid Build Coastguard Worker$ cd /path/to/angle/out/release
39*8975f5c5SAndroid Build Coastguard Worker$ ln -s libEGL.so libEGL.so.1
40*8975f5c5SAndroid Build Coastguard Worker$ ln -s libGLESv2.so libGLESv2.so.2
41*8975f5c5SAndroid Build Coastguard Worker```
42*8975f5c5SAndroid Build Coastguard Worker
43*8975f5c5SAndroid Build Coastguard WorkerBack in glmark2, we need to make sure these shared objects are picked up:
44*8975f5c5SAndroid Build Coastguard Worker
45*8975f5c5SAndroid Build Coastguard Worker```
46*8975f5c5SAndroid Build Coastguard Worker$ cd /path/to/glmark2/build/src
47*8975f5c5SAndroid Build Coastguard Worker$ LD_LIBRARY_PATH=/path/to/angle/out/release/ ldd ./glmark2-es2
48*8975f5c5SAndroid Build Coastguard Worker```
49*8975f5c5SAndroid Build Coastguard Worker
50*8975f5c5SAndroid Build Coastguard WorkerWith `ldd`, you can verify that `libEGL.so.1` and `libGLESv2.so.2` are correctly picked up from
51*8975f5c5SAndroid Build Coastguard WorkerANGLE's build directory.
52*8975f5c5SAndroid Build Coastguard Worker
53*8975f5c5SAndroid Build Coastguard WorkerTo run glmark2 on the default back-end of ANGLE:
54*8975f5c5SAndroid Build Coastguard Worker
55*8975f5c5SAndroid Build Coastguard Worker```
56*8975f5c5SAndroid Build Coastguard Worker$ LD_LIBRARY_PATH=/path/to/angle/out/release/ ./glmark2-es2
57*8975f5c5SAndroid Build Coastguard Worker```
58*8975f5c5SAndroid Build Coastguard Worker
59*8975f5c5SAndroid Build Coastguard WorkerTo run glmark2 on a specific back-end of ANGLE:
60*8975f5c5SAndroid Build Coastguard Worker
61*8975f5c5SAndroid Build Coastguard Worker```
62*8975f5c5SAndroid Build Coastguard Worker$ ANGLE_DEFAULT_PLATFORM=vulkan LD_LIBRARY_PATH=/path/to/angle/out/release/ ./glmark2-es2
63*8975f5c5SAndroid Build Coastguard Worker```
64*8975f5c5SAndroid Build Coastguard Worker
65*8975f5c5SAndroid Build Coastguard Worker### glmark2 on Linux for Android
66*8975f5c5SAndroid Build Coastguard Worker
67*8975f5c5SAndroid Build Coastguard Worker**Prerequisites**
68*8975f5c5SAndroid Build Coastguard Worker
69*8975f5c5SAndroid Build Coastguard WorkerBelow steps are set up to use version 26.0.1 of build-tools, which can be downloaded here:
70*8975f5c5SAndroid Build Coastguard Worker
71*8975f5c5SAndroid Build Coastguard Worker[https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip](https://dl.google.com/android/repository/build-tools_r26.0.1-linux.zip)
72*8975f5c5SAndroid Build Coastguard Worker
73*8975f5c5SAndroid Build Coastguard WorkerTested with r19 of NDK, which can be downloaded here:
74*8975f5c5SAndroid Build Coastguard Worker
75*8975f5c5SAndroid Build Coastguard Worker[https://dl.google.com/android/repository/android-ndk-r19-linux-x86_64.zip](https://dl.google.com/android/repository/android-ndk-r19-linux-x86_64.zip)
76*8975f5c5SAndroid Build Coastguard Worker
77*8975f5c5SAndroid Build Coastguard WorkerTested with OpenJDK 8:
78*8975f5c5SAndroid Build Coastguard Worker
79*8975f5c5SAndroid Build Coastguard Worker```
80*8975f5c5SAndroid Build Coastguard Workersudo apt-get install openjdk-8-jdk
81*8975f5c5SAndroid Build Coastguard Worker```
82*8975f5c5SAndroid Build Coastguard Worker
83*8975f5c5SAndroid Build Coastguard WorkerNote: This is built from a branch that has fixes for Android.  It only supports
84*8975f5c5SAndroid Build Coastguard Worker32-bit ARM (armeabi-v7a).  Supporting other ABIs requires more work, possibly
85*8975f5c5SAndroid Build Coastguard Workerincluding a move to cmake instead of ndk-build.
86*8975f5c5SAndroid Build Coastguard Worker
87*8975f5c5SAndroid Build Coastguard Worker**Setup**
88*8975f5c5SAndroid Build Coastguard Worker
89*8975f5c5SAndroid Build Coastguard Worker```
90*8975f5c5SAndroid Build Coastguard Workerexport ANDROID_SDK=<path_to_Android_SDK>
91*8975f5c5SAndroid Build Coastguard Workerexport ANDROID_NDK=<path_to_Android_NDK>
92*8975f5c5SAndroid Build Coastguard Workerexport JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
93*8975f5c5SAndroid Build Coastguard Worker```
94*8975f5c5SAndroid Build Coastguard Worker
95*8975f5c5SAndroid Build Coastguard Worker**Build**
96*8975f5c5SAndroid Build Coastguard Worker
97*8975f5c5SAndroid Build Coastguard Worker```
98*8975f5c5SAndroid Build Coastguard Workergit clone https://github.com/cnorthrop/glmark2.git
99*8975f5c5SAndroid Build Coastguard Workercd glmark2/android
100*8975f5c5SAndroid Build Coastguard Workergit checkout android_fixes
101*8975f5c5SAndroid Build Coastguard Worker./build.sh
102*8975f5c5SAndroid Build Coastguard Worker```
103*8975f5c5SAndroid Build Coastguard Worker
104*8975f5c5SAndroid Build Coastguard Worker**Install**
105*8975f5c5SAndroid Build Coastguard Worker
106*8975f5c5SAndroid Build Coastguard Worker```
107*8975f5c5SAndroid Build Coastguard Workeradb install --abi armeabi-v7a glmark2.apk
108*8975f5c5SAndroid Build Coastguard Worker```
109*8975f5c5SAndroid Build Coastguard Worker
110*8975f5c5SAndroid Build Coastguard Worker**Run**
111*8975f5c5SAndroid Build Coastguard Worker
112*8975f5c5SAndroid Build Coastguard WorkerTo select ANGLE as the driver on Android (requires Android Q):
113*8975f5c5SAndroid Build Coastguard Worker
114*8975f5c5SAndroid Build Coastguard Worker```
115*8975f5c5SAndroid Build Coastguard Workeradb shell settings put global angle_gl_driver_selection_pkgs org.linaro.glmark2
116*8975f5c5SAndroid Build Coastguard Workeradb shell settings put global angle_gl_driver_selection_values angle
117*8975f5c5SAndroid Build Coastguard Worker```
118*8975f5c5SAndroid Build Coastguard Worker
119*8975f5c5SAndroid Build Coastguard WorkerTo switch back to native GLES driver:
120*8975f5c5SAndroid Build Coastguard Worker
121*8975f5c5SAndroid Build Coastguard Worker```
122*8975f5c5SAndroid Build Coastguard Workeradb shell settings delete global angle_gl_driver_selection_values
123*8975f5c5SAndroid Build Coastguard Workeradb shell settings delete global angle_gl_driver_selection_pkgs
124*8975f5c5SAndroid Build Coastguard Worker```
125