1The files in this directory help with testing Virgl on the virtio-gpu winsys 2by means of Crosvm. 3 4A whole environment will be built in a Docker image, then Mesa and Virglrenderer 5will be built from local directories to be used both in the host and the guest. 6 7The container image builds on top of other images built by scripts in the crosvm repository. 8 9Instructions for building base images: 10 11```console 12$ git clone https://chromium.googlesource.com/chromiumos/platform/crosvm 13$ pushd crosvm 14$ sh docker/build_crosvm_base.sh 15$ sh docker/build_crosvm.sh 16``` 17 18Instructions for building target image: 19 20```console 21$ cd virglrenderer 22$ sh perf-testing/build-dockerimage.sh 23``` 24 25Instructions for running the container: 26 27```console 28$ cd virglrenderer 29$ bash perf-testing/run_trace-in-container.sh \ 30 --root $PATH_THAT_CONTAINS_MESA_CHECKOUT_VIRGLRENDERER_AND_TRACES_DB_CHECKOUT \ 31 --trace $API_TRACE_TO_RUN 32``` 33 34There are also options for run_trace-in-container.sh that allow specifying the 35path to mesa, virglrenderer, and the traces db. These override the root path. 36In addition, the root path defaults to the current working directory. 37 38As a conveniance for shell autocompletion users running the script from the default 39root that contains the traces db as subdirectory the the trace file name can be 40also given with this traces db sudirectory name, i.e. if the traces db is located 41in '$workdir/traces-db', root=$workdir, and the trace is calles 'sometrace.trace', 42then both commands 43``` 44 perf-testing/run_trace-in-container.sh -r $rootdir -t traces-db/sometrace.trace 45``` 46and 47``` 48 perf-testing/run_trace-in-container.sh -r $rootdir -t sometrace.trace 49``` 50will work equally. 51 52At the moment of writing, the branch perfetto-tracing is needed for mesa at 53commit ec4277aea63cf3, and the for virglrenderer at least commit 54"perf: compile mesa with perfeto support" is needed so that these projects 55emit the required traces. 56 57The perfetto traces will be saved to the a subdirectory of the traces-db checkout 58directory with a name based on the api trace passed in with the --trace parameter. 59 60Once the run_trace-in-container.sh script finishes, 3 Perfetto trace files will be written: 61$(API_TRACE_TO_RUN%.*}-host.perfetto, $(API_TRACE_TO_RUN%.*}-guest.perfetto 62and $(API_TRACE_TO_RUN%.*}-summary.perfetto. The last one is the fusion of the two first. 63 64In order to visualize the traces, the Perfetto UI needs to be running in a local 65service which can be started as follows: 66 67```console 68$ perf-testing/perfetto-ui.sh 69``` 70 71The Perfetto UI can be loaded then on Chromium on the http://localhost:10000 address. 72