How to get the GPU error state
For all GPU-hang bugs, the most usefull information is on error state.
After a hang is detected all related and helpful information gets recorded in a error state that can be grab as instructed below.
It must be done after the hang, but before rebooting the machine.
Recent kernel version
On recent kernel you can grab this information from your sysfs:
$ cat /sys/class/drm/card0/error | gzip > error.gz
# Please note that depending you your environment it can be a different card number. But it is probably 0.
Old kernel
On old kernel but not older than 2.6.34 you need to get it from debugfs:
/sys/kernel/debug/dri/0/i915_error_state [2]
Anything from that file, other than "no error state collected", is very interesting and very helpful for bug reports.
[1] If you don't have a /sys/kernel/debug/dri directory, then make sure that debugfs is mounted like this:
sudo mount -t debugfs debugfs /sys/kernel/debug
[2] If you have n gpus, the directory could be also be:
/sys/kernel/debug/dri/<n>/i915_error_state
Compress instead of Crop
All information on this file is useful, so please never crop the file when attatching it to a bug report, please compress it instead.