intel_gpu_dump: Give a nicer message for missing batchbuffer-dumping code
authorCarl Worth <cworth@cworth.org>
Mon, 13 Apr 2009 21:33:09 +0000 (14:33 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 13 Apr 2009 21:33:09 +0000 (14:33 -0700)
This is the case where debugfs is mounted, the dri/0 directory
exists but there's no i915_ringbuffer_info file. Point the user
toward upgrading the driver.

tools/intel_gpu_dump.c

index 947617e..6304372 100644 (file)
@@ -1974,6 +1974,19 @@ main (int argc, char *argv[])
        uint32_t ring_head, ring_tail, acthd;
 
        sprintf(filename, "%s/i915_ringbuffer_info", path);
+
+       err = stat(filename, &st);
+       if (err != 0) {
+           fprintf (stderr,
+                    "Error opening %s: %s\n\n"
+                    "Perhaps your i915 kernel driver has no support for "
+                    "dumping batchbuffer data?\n"
+                    "(In kernels prior to 2.6.30 this requires "
+                    "manually-applied patches.)\n",
+                    path, strerror (errno));
+           exit (1);
+       }
+
        parse_ringbuffer_info(filename, &ring_head, &ring_tail, &acthd);
 
        sprintf(filename, "%s/i915_batchbuffers", path);