Files
Gert Wollny e7f47fd3db perf: add scripts to build docker image and run perfetto trace analysis
Most of the work of this MR was done by Tomeu.

Changes:
  - update the Dockerfile to use the new virglrenderer tracing option
  - use command line parsing to pass the parameters when running a trace
  - move some files and rename scripts

v2: - unify gfx-pps build (Tomeu) and use to suggested branch (Fahien)
    - use upstream tagged version for igt-gpu-tools (Tomeu)
    - add parameters to set benchmark loop count (Louis-Francis)
    - add parameter to set perfetto loop count or loopless run

v3: - compile virglrenderer against minigbm (Rohan)
    - compile minigbm with driver i915 (Rohan)

v4: Don't build mesa-gbm (instead of deleting the library and
    header later)

v5: add option to run script whether to wait after each frame

v6: correct gfx-pps version and add gdb

v7: fix tag for gfx-pps

v8: - when building the container use the user ID and group
      id of the user who runs the container build
    - rework passing command line parameters
    - add a command line parameter to record per-frame
      images
    - Use debugoptimized build for gfx-pps (Tomeu)

v9: disable buffer storage, there seems to be a bug in
    context handling triggered by this

v10: move to upstream kernel 5.9.12

v11: - remove writing txt version of host trace
     - add debug flagto enable tracing EGL
     - don't force-remove libgbm1 it is no longer a problem to
       have it

v12: update kernel to 5.20.5

v13: refactor trace merge (Rohan)

v14: - Fix refactoring (Rohan)
     - Add license infro to perfetto merge script

Signed-off-by: Gert Wollny <[email protected]>
Reviewed-By: Rohan Garg <[email protected]>
2021-01-11 14:47:33 +00:00

2.5 KiB

The files in this directory help with testing Virgl on the virtio-gpu winsys by means of Crosvm.

A whole environment will be built in a Docker image, then Mesa and Virglrenderer will be built from local directories to be used both in the host and the guest.

The container image builds on top of other images built by scripts in the crosvm repository.

Instructions for building base images:

$ git clone https://chromium.googlesource.com/chromiumos/platform/crosvm
$ pushd crosvm
$ sh docker/build_crosvm_base.sh
$ sh docker/build_crosvm.sh

Instructions for building target image:

$ cd virglrenderer
$ sh perf-testing/build-dockerimage.sh

Instructions for running the container:

$ cd virglrenderer
$ bash perf-testing/run_trace-in-container.sh \
    --root $PATH_THAT_CONTAINS_MESA_CHECKOUT_VIRGLRENDERER_AND_TRACES_DB_CHECKOUT \
    --trace $API_TRACE_TO_RUN

There are also options for run_trace-in-container.sh that allow specifying the path to mesa, virglrenderer, and the traces db. These override the root path. In addition, the root path defaults to the current working directory.

As a conveniance for shell autocompletion users running the script from the default root that contains the traces db as subdirectory the the trace file name can be also given with this traces db sudirectory name, i.e. if the traces db is located in '$workdir/traces-db', root=$workdir, and the trace is calles 'sometrace.trace', then both commands

  perf-testing/run_trace-in-container.sh -r $rootdir -t traces-db/sometrace.trace

and

  perf-testing/run_trace-in-container.sh -r $rootdir -t sometrace.trace

will work equally.

At the moment of writing, the branch perfetto-tracing is needed for mesa, and the for virglrenderer at least commit 7db2faa354 is needed, so these projects emit the required traces.

The perfetto traces will be saved to the a subdirectory of the traces-db checkout directory with a name based on the api trace passed in with the --trace parameter.

Once the run_trace-in-container.sh script finishes, 3 Perfetto trace files will be written: $(API_TRACE_TO_RUN%.}-host.perfetto, $(API_TRACE_TO_RUN%.}-guest.perfetto and $(API_TRACE_TO_RUN%.*}-summary.perfetto. The last one is the fusion of the two first.

In order to visualize the traces, the Perfetto UI needs to be running in a local service which can be started as follows:

$ perf-testing/perfetto-ui.sh

The Perfetto UI can be loaded then on Chromium on the http://localhost:10000 address.