diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-29 14:46:54 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2013-11-29 14:47:29 +0000 |
commit | 3dae8b97151f1d08942ec690dac5a5008901d7d0 (patch) | |
tree | 607fe8d838210091b7fd5a311cd2dd914e3df5c3 | |
parent | 2497fc332eafe31a0156ac5f66ec98f77ce0f647 (diff) |
sna: Dump GTT info if we fail to execute a batch due to ENOSPC
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | src/sna/kgem.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/sna/kgem.c b/src/sna/kgem.c index f68f5f41..35b76d9c 100644 --- a/src/sna/kgem.c +++ b/src/sna/kgem.c @@ -2872,6 +2872,31 @@ out_16384: return kgem_create_linear(kgem, size, CREATE_NO_THROTTLE); } +#if !NDEBUG +static void dump_gtt_info(void) +{ + int i; + + for (i = 0; i < DRM_MAX_MINOR; i++) { + char path[80]; + FILE *file; + + sprintf(path, "/sys/kernel/debug/dri%d/i915_gem_gtt", i); + file = fopen(path, "r"); + if (file) { + size_t len = 0; + char *line = NULL; + + while (getline(&line, &len, file) != -1) + ErrorF("%s", line); + free(line); + fclose(file); + return; + } + } +} +#endif + void _kgem_submit(struct kgem *kgem) { struct kgem_request *rq; @@ -3024,6 +3049,9 @@ void _kgem_submit(struct kgem *kgem) (long long)aperture.aper_available_size); } + if (ret == ENOSPC) + dump_gtt_info(); + if (DEBUG_SYNC) { int fd = open("/tmp/batchbuffer", O_WRONLY | O_CREAT | O_APPEND, 0666); if (fd != -1) { |