Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1edf6958 authored by Michel Thierry's avatar Michel Thierry Committed by Chris Wilson
Browse files

drm/i915: Use the engine name directly in the error_state file



Instead of using local string names that we will have to keep
maintaining, use the engine->name directly.

v2: Better invalid engine_id handling, capture_bo will not be able know
the engine_id and end up with -1 (Michal).

Suggested-by: default avatarMichal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: default avatarMichel Thierry <michel.thierry@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: default avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180110012151.28261-1-michel.thierry@intel.com


[ickle: minor massaging of function names]
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20180118175228.2830-1-chris@chris-wilson.co.uk
parent 35fe703c
Loading
Loading
Loading
Loading
+23 −13
Original line number Original line Diff line number Diff line
@@ -34,16 +34,25 @@


#include "i915_drv.h"
#include "i915_drv.h"


static const char *engine_str(int engine)
static inline const struct intel_engine_cs *
engine_lookup(const struct drm_i915_private *i915, unsigned int id)
{
{
	switch (engine) {
	if (id >= I915_NUM_ENGINES)
	case RCS: return "render";
		return NULL;
	case VCS: return "bsd";

	case BCS: return "blt";
	return i915->engine[id];
	case VECS: return "vebox";
	case VCS2: return "bsd2";
	default: return "";
}
}

static inline const char *
__engine_name(const struct intel_engine_cs *engine)
{
	return engine ? engine->name : "";
}

static const char *
engine_name(const struct drm_i915_private *i915, unsigned int id)
{
	return __engine_name(engine_lookup(i915, id));
}
}


static const char *tiling_flag(int tiling)
static const char *tiling_flag(int tiling)
@@ -345,7 +354,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
		err_puts(m, purgeable_flag(err->purgeable));
		err_puts(m, purgeable_flag(err->purgeable));
		err_puts(m, err->userptr ? " userptr" : "");
		err_puts(m, err->userptr ? " userptr" : "");
		err_puts(m, err->engine != -1 ? " " : "");
		err_puts(m, err->engine != -1 ? " " : "");
		err_puts(m, engine_str(err->engine));
		err_puts(m, engine_name(m->i915, err->engine));
		err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
		err_puts(m, i915_cache_level_str(m->i915, err->cache_level));


		if (err->name)
		if (err->name)
@@ -415,7 +424,8 @@ static void error_print_engine(struct drm_i915_error_state_buf *m,
{
{
	int n;
	int n;


	err_printf(m, "%s command stream:\n", engine_str(ee->engine_id));
	err_printf(m, "%s command stream:\n",
		   engine_name(m->i915, ee->engine_id));
	err_printf(m, "  IDLE?: %s\n", yesno(ee->idle));
	err_printf(m, "  IDLE?: %s\n", yesno(ee->idle));
	err_printf(m, "  START: 0x%08x\n", ee->start);
	err_printf(m, "  START: 0x%08x\n", ee->start);
	err_printf(m, "  HEAD:  0x%08x [0x%08x]\n", ee->head, ee->rq_head);
	err_printf(m, "  HEAD:  0x%08x [0x%08x]\n", ee->head, ee->rq_head);
@@ -635,7 +645,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
		if (error->engine[i].hangcheck_stalled &&
		if (error->engine[i].hangcheck_stalled &&
		    error->engine[i].context.pid) {
		    error->engine[i].context.pid) {
			err_printf(m, "Active process (on ring %s): %s [%d], score %d\n",
			err_printf(m, "Active process (on ring %s): %s [%d], score %d\n",
				   engine_str(i),
				   engine_name(m->i915, i),
				   error->engine[i].context.comm,
				   error->engine[i].context.comm,
				   error->engine[i].context.pid,
				   error->engine[i].context.pid,
				   error->engine[i].context.ban_score);
				   error->engine[i].context.ban_score);