diff mbox series

[i-g-t] intel_error_decode: Handle no decoding context

Message ID 20201118163809.959127-1-tvrtko.ursulin@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [i-g-t] intel_error_decode: Handle no decoding context | expand

Commit Message

Tvrtko Ursulin Nov. 18, 2020, 4:38 p.m. UTC
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

If decoding context couldn't be created, say the local libdrm does not
support the GPU which created the error state, it is much more handy to
at least decode and dump metadata and rings.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
 tools/intel_error_decode.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

Chris Wilson Nov. 18, 2020, 5:05 p.m. UTC | #1
Quoting Tvrtko Ursulin (2020-11-18 16:38:09)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> If decoding context couldn't be created, say the local libdrm does not
> support the GPU which created the error state, it is much more handy to
> at least decode and dump metadata and rings.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/tools/intel_error_decode.c b/tools/intel_error_decode.c
index 356ce37274f9..90a18a07ba17 100644
--- a/tools/intel_error_decode.c
+++ b/tools/intel_error_decode.c
@@ -465,7 +465,7 @@  static void decode(struct drm_intel_decode *ctx,
 		       (unsigned)((head_offset + gtt_offset) & 0xffffffff));
 	printf("\n");
 
-	if (decode) {
+	if (decode && ctx) {
 		drm_intel_decode_set_batch_pointer(ctx, data, gtt_offset,
 						   *count);
 		drm_intel_decode(ctx);
@@ -707,7 +707,10 @@  read_data_file(FILE *file)
 			matched = sscanf(line, "  ACTHD: 0x%08x\n", &reg);
 			if (matched == 1) {
 				print_acthd(reg, ring_length);
-				drm_intel_decode_set_head_tail(decode_ctx, reg, 0xffffffff);
+				if (decode_ctx)
+					drm_intel_decode_set_head_tail(decode_ctx,
+								       reg,
+								       0xffffffff);
 			}
 
 			matched = sscanf(line, "  PGTBL_ER: 0x%08x\n", &reg);