[Intel-gfx] [PATCH] drm/i915: Use the engine name directly in the error_state file
Michel Thierry
michel.thierry at intel.com
Tue Jan 9 19:33:55 UTC 2018
Instead of using local string names that we will have to keep
maintaining, use the engine->name directly.
Suggested-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Signed-off-by: Michel Thierry <michel.thierry at intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko at intel.com>
---
drivers/gpu/drm/i915/i915_gpu_error.c | 23 ++++++++++-------------
1 file changed, 10 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index 94499c24f279..db95ecacdace 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -34,16 +34,12 @@
#include "i915_drv.h"
-static const char *engine_str(int engine)
-{
- switch (engine) {
- case RCS: return "render";
- case VCS: return "bsd";
- case BCS: return "blt";
- case VECS: return "vebox";
- case VCS2: return "bsd2";
- default: return "";
- }
+static const char *engine_str(struct drm_i915_private *i915, int engine_id)
+{
+ if (!i915->engine[engine_id])
+ return "";
+ else
+ return i915->engine[engine_id]->name;
}
static const char *tiling_flag(int tiling)
@@ -345,7 +341,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
err_puts(m, purgeable_flag(err->purgeable));
err_puts(m, err->userptr ? " userptr" : "");
err_puts(m, err->engine != -1 ? " " : "");
- err_puts(m, engine_str(err->engine));
+ err_puts(m, engine_str(m->i915, err->engine));
err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
if (err->name)
@@ -417,7 +413,8 @@ static void error_print_engine(struct drm_i915_error_state_buf *m,
{
int n;
- err_printf(m, "%s command stream:\n", engine_str(ee->engine_id));
+ err_printf(m, "%s command stream:\n", engine_str(m->i915,
+ ee->engine_id));
err_printf(m, " IDLE?: %s\n", yesno(ee->idle));
err_printf(m, " START: 0x%08x\n", ee->start);
err_printf(m, " HEAD: 0x%08x [0x%08x]\n", ee->head, ee->rq_head);
@@ -633,7 +630,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
if (error->engine[i].hangcheck_stalled &&
error->engine[i].context.pid) {
err_printf(m, "Active process (on ring %s): %s [%d], score %d\n",
- engine_str(i),
+ engine_str(m->i915, i),
error->engine[i].context.comm,
error->engine[i].context.pid,
error->engine[i].context.ban_score);
--
2.15.1
More information about the Intel-gfx
mailing list