Skip to content

Instantly share code, notes, and snippets.

@cwabbott0
Last active May 8, 2017 18:01
Show Gist options
  • Save cwabbott0/9e4138d6bf2c6cc18c52968812e93045 to your computer and use it in GitHub Desktop.
Save cwabbott0/9e4138d6bf2c6cc18c52968812e93045 to your computer and use it in GitHub Desktop.
In order to run these experiments, you'll need a laptop running Linux with Intel
integrated graphics. We need access to the underlying graphics device, so you
can't just use a VM. In order to build the OpenGL driver, first you need to
download my Git branch:
$ git clone git://people.freedesktop.org/~cwabbott0/mesa
$ cd mesa
$ git checkout shader-time-hacks
To build Mesa, you need to download the build dependencies first. You should use
your distro's method for this. For example, on Ubuntu, you would do something
like:
$ sudo apt-get build-dep mesa
Next, do the usual autoconf dance. The configure flags are the options I'm using
to build Mesa:
$ ./autogen.sh
$ CFLAGS="-O2" CXXFLAGS="-O2" ./configure --prefix=$HOME/mesa-build --enable-gbm --with-platforms=x11,egl --with-dri-drivers=i965 --with-gallium-drivers=
$ make
$ make install
We need to set the right environment variables in order to use the libraries we
installed to ~/mesa-build rather than the system libraries. I have a small
script to do that which looks like this:
$ cat mesa.sh
#!/bin/bash
LD_LIBRARY_PATH=$HOME/mesa-build/lib LIBGL_DRIVERS_PATH=$HOME/mesa-build/lib/dri "$@"
Use "~/path/to/mesa.sh my-app" instead of "my-app" to run your application using
the version of Mesa we've just built. Now, you can set the "INTEL_DEBUG"
environment variable to "shader_time" in order to enable the tracing. By
default, it will output a file "shader-time-N.csv" in the current working
directory for each OpenGL context N created, but you can change "shader-time" to
whatever you want by supplying the "SHADER_TIME_OUTPUT" environment variable.
For example, you might do something like:
$ INTEL_DEBUG=shader_time SHADER_TIME_OUTPUT="~/path/to/output/shader-time" ~/path/to/mesa.sh my-app
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment