xref: /aosp_15_r20/frameworks/native/cmds/flatland/README.txt (revision 38e8c45f13ce32b0dcecb25141ffecaf386fa17f)
1*38e8c45fSAndroid Build Coastguard WorkerFlatland is a benchmark for measuring GPU performance in various 2D UI
2*38e8c45fSAndroid Build Coastguard Workerrendering and window compositing scenarios.  It is designed to be used early
3*38e8c45fSAndroid Build Coastguard Workerin the device development process to evaluate GPU hardware (e.g. for SoC
4*38e8c45fSAndroid Build Coastguard Workerselection).  It uses OpenGL ES 2.0, gralloc, and the Android explicit
5*38e8c45fSAndroid Build Coastguard Workersynchronization framework, so it can only be run on devices with drivers
6*38e8c45fSAndroid Build Coastguard Workersupporting those HALs.
7*38e8c45fSAndroid Build Coastguard Worker
8*38e8c45fSAndroid Build Coastguard Worker
9*38e8c45fSAndroid Build Coastguard WorkerPreparing a Device
10*38e8c45fSAndroid Build Coastguard Worker
11*38e8c45fSAndroid Build Coastguard WorkerBecause it's measuring hardware performance, flatland should be run in as
12*38e8c45fSAndroid Build Coastguard Workerconsistent and static an environment as possible.  The display should be
13*38e8c45fSAndroid Build Coastguard Workerturned off and background services should be stopped before running the
14*38e8c45fSAndroid Build Coastguard Workerbenchmark.  Running 'adb shell stop' after turning off the display is probably
15*38e8c45fSAndroid Build Coastguard Workersufficient for this, but if there are device- specific background services
16*38e8c45fSAndroid Build Coastguard Workerthat consume much CPU cycles, memory bandwidth, or might otherwise interfere
17*38e8c45fSAndroid Build Coastguard Workerwith GPU rendering, those should be stopped as well (and ideally they'd be
18*38e8c45fSAndroid Build Coastguard Workerfixed or eliminated for production devices).
19*38e8c45fSAndroid Build Coastguard Worker
20*38e8c45fSAndroid Build Coastguard WorkerAdditionally, all relevant hardware clocks should be locked at a particular
21*38e8c45fSAndroid Build Coastguard Workerfrequency when running flatland.  At a minimum this includes the CPU, GPU, and
22*38e8c45fSAndroid Build Coastguard Workermemory bus clocks.  Running flatland with dynamic clocking essentially
23*38e8c45fSAndroid Build Coastguard Workermeasures the behavior of the dynamic clocking algorithm under a fairly
24*38e8c45fSAndroid Build Coastguard Workerunrealistic workload, and will likely result in unstable and useless results.
25*38e8c45fSAndroid Build Coastguard Worker
26*38e8c45fSAndroid Build Coastguard WorkerIf running the benchmark with the clocks locked causes thermal issues, the -s
27*38e8c45fSAndroid Build Coastguard Workercommand line option can be used to insert a sleep (specified in milliseconds)
28*38e8c45fSAndroid Build Coastguard Workerin between each benchmark sample run.  Regardless of the scenario being
29*38e8c45fSAndroid Build Coastguard Workermeasured, each sample measurement runs for between 50 and 200 ms, so a sleep
30*38e8c45fSAndroid Build Coastguard Workertime between 10 and 50 ms should address most thermal problems.
31*38e8c45fSAndroid Build Coastguard Worker
32*38e8c45fSAndroid Build Coastguard Worker
33*38e8c45fSAndroid Build Coastguard WorkerInterpreting the Output
34*38e8c45fSAndroid Build Coastguard Worker
35*38e8c45fSAndroid Build Coastguard WorkerThe output of flatland should look something like this:
36*38e8c45fSAndroid Build Coastguard Worker
37*38e8c45fSAndroid Build Coastguard Worker cmdline: flatland
38*38e8c45fSAndroid Build Coastguard Worker               Scenario               | Resolution  | Time (ms)
39*38e8c45fSAndroid Build Coastguard Worker 16:10 Single Static Window           | 1280 x  800 |   fast
40*38e8c45fSAndroid Build Coastguard Worker 16:10 Single Static Window           | 2560 x 1600 |  5.368
41*38e8c45fSAndroid Build Coastguard Worker 16:10 Single Static Window           | 3840 x 2400 | 11.979
42*38e8c45fSAndroid Build Coastguard Worker 16:10 App -> Home Transition         | 1280 x  800 |  4.069
43*38e8c45fSAndroid Build Coastguard Worker 16:10 App -> Home Transition         | 2560 x 1600 | 15.911
44*38e8c45fSAndroid Build Coastguard Worker 16:10 App -> Home Transition         | 3840 x 2400 | 38.795
45*38e8c45fSAndroid Build Coastguard Worker 16:10 SurfaceView -> Home Transition | 1280 x  800 |  5.387
46*38e8c45fSAndroid Build Coastguard Worker 16:10 SurfaceView -> Home Transition | 2560 x 1600 | 21.147
47*38e8c45fSAndroid Build Coastguard Worker 16:10 SurfaceView -> Home Transition | 3840 x 2400 |   slow
48*38e8c45fSAndroid Build Coastguard Worker
49*38e8c45fSAndroid Build Coastguard WorkerThe first column is simply a description of the scenario that's being
50*38e8c45fSAndroid Build Coastguard Workersimulated.  The second column indicates the resolution at which the scenario
51*38e8c45fSAndroid Build Coastguard Workerwas measured.  The third column is the measured benchmark result.  It
52*38e8c45fSAndroid Build Coastguard Workerindicates the expected time in milliseconds that a single frame of the
53*38e8c45fSAndroid Build Coastguard Workerscenario takes to complete.
54*38e8c45fSAndroid Build Coastguard Worker
55*38e8c45fSAndroid Build Coastguard WorkerThe third column may also contain one of three other values:
56*38e8c45fSAndroid Build Coastguard Worker
57*38e8c45fSAndroid Build Coastguard Worker    fast - This indicates that frames of the scenario completed too fast to be
58*38e8c45fSAndroid Build Coastguard Worker    reliably benchmarked.  This corresponds to a frame time less than 3 ms.
59*38e8c45fSAndroid Build Coastguard Worker    Rather than spending time trying (and likely failing) to get a stable
60*38e8c45fSAndroid Build Coastguard Worker    result, the scenario was skipped.
61*38e8c45fSAndroid Build Coastguard Worker
62*38e8c45fSAndroid Build Coastguard Worker    slow - This indicates that frames of the scenario took too long to
63*38e8c45fSAndroid Build Coastguard Worker    complete.  This corresponds to a frame time over 50 ms.  Rather than
64*38e8c45fSAndroid Build Coastguard Worker    simulating a scenario that is obviously impractical on this device, the
65*38e8c45fSAndroid Build Coastguard Worker    scenario was skipped.
66*38e8c45fSAndroid Build Coastguard Worker
67*38e8c45fSAndroid Build Coastguard Worker    varies - This indicates that the scenario was measured, but it did not
68*38e8c45fSAndroid Build Coastguard Worker    yield a stable result.  Occasionally this happens with an otherwise stable
69*38e8c45fSAndroid Build Coastguard Worker    scenario.  In this case, simply rerunning flatland should yield a valid
70*38e8c45fSAndroid Build Coastguard Worker    result.  If a scenario repeatedly results in a 'varies' output, that
71*38e8c45fSAndroid Build Coastguard Worker    probably indicates that something is wrong with the environment in which
72*38e8c45fSAndroid Build Coastguard Worker    flatland is being run.  Check that the hardware clock frequencies are
73*38e8c45fSAndroid Build Coastguard Worker    locked and that no heavy-weight services / daemons are running in the
74*38e8c45fSAndroid Build Coastguard Worker    background.
75