drm/xe: common function to assign queue name
authorDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Thu, 17 Aug 2023 20:18:25 +0000 (13:18 -0700)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 21 Dec 2023 16:40:20 +0000 (11:40 -0500)
The queue name assignment is identical in both GuC and execlists
backends, so we can move it to a common function. This will make adding
a new entry in the next patch slightly cleaner.

Signed-off-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20230817201831.1583172-2-daniele.ceraolospurio@intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_exec_queue.c
drivers/gpu/drm/xe/xe_exec_queue.h
drivers/gpu/drm/xe/xe_execlist.c
drivers/gpu/drm/xe/xe_guc_submit.c

index 901c609a657e61f994962e8d8648325ab44b325e..c2adff770614270763ed64ef7ad01f581e52e546 100644 (file)
@@ -177,6 +177,29 @@ void xe_exec_queue_fini(struct xe_exec_queue *q)
        kfree(q);
 }
 
+void xe_exec_queue_assign_name(struct xe_exec_queue *q, u32 instance)
+{
+       switch (q->class) {
+       case XE_ENGINE_CLASS_RENDER:
+               sprintf(q->name, "rcs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_VIDEO_DECODE:
+               sprintf(q->name, "vcs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_VIDEO_ENHANCE:
+               sprintf(q->name, "vecs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_COPY:
+               sprintf(q->name, "bcs%d", instance);
+               break;
+       case XE_ENGINE_CLASS_COMPUTE:
+               sprintf(q->name, "ccs%d", instance);
+               break;
+       default:
+               XE_WARN_ON(q->class);
+       }
+}
+
 struct xe_exec_queue *xe_exec_queue_lookup(struct xe_file *xef, u32 id)
 {
        struct xe_exec_queue *q;
index 94a6abee38a6069d73f6a38a8776aaa7b627557f..22499a2f522b4445373fed10572e4610e78ec03c 100644 (file)
@@ -23,6 +23,7 @@ struct xe_exec_queue *xe_exec_queue_create_class(struct xe_device *xe, struct xe
 
 void xe_exec_queue_fini(struct xe_exec_queue *q);
 void xe_exec_queue_destroy(struct kref *ref);
+void xe_exec_queue_assign_name(struct xe_exec_queue *q, u32 instance);
 
 struct xe_exec_queue *xe_exec_queue_lookup(struct xe_file *xef, u32 id);
 
index 3b8be55fe19c95d8368b0247385b58766b372e8b..df91780d8b9f9aefbd311615929c762e225b3390 100644 (file)
@@ -350,25 +350,7 @@ static int execlist_exec_queue_init(struct xe_exec_queue *q)
        q->execlist = exl;
        q->entity = &exl->entity;
 
-       switch (q->class) {
-       case XE_ENGINE_CLASS_RENDER:
-               sprintf(q->name, "rcs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_DECODE:
-               sprintf(q->name, "vcs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_ENHANCE:
-               sprintf(q->name, "vecs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_COPY:
-               sprintf(q->name, "bcs%d", ffs(q->logical_mask) - 1);
-               break;
-       case XE_ENGINE_CLASS_COMPUTE:
-               sprintf(q->name, "ccs%d", ffs(q->logical_mask) - 1);
-               break;
-       default:
-               XE_WARN_ON(q->class);
-       }
+       xe_exec_queue_assign_name(q, ffs(q->logical_mask) - 1);
 
        return 0;
 
index 8ecfe2b15e28489ba29649f334269f18c285ed02..55c7b13d15ecc4dec17677f6be6fee1dd88d59b6 100644 (file)
@@ -1167,25 +1167,7 @@ static int guc_exec_queue_init(struct xe_exec_queue *q)
 
        mutex_unlock(&guc->submission_state.lock);
 
-       switch (q->class) {
-       case XE_ENGINE_CLASS_RENDER:
-               sprintf(q->name, "rcs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_DECODE:
-               sprintf(q->name, "vcs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_VIDEO_ENHANCE:
-               sprintf(q->name, "vecs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_COPY:
-               sprintf(q->name, "bcs%d", q->guc->id);
-               break;
-       case XE_ENGINE_CLASS_COMPUTE:
-               sprintf(q->name, "ccs%d", q->guc->id);
-               break;
-       default:
-               XE_WARN_ON(q->class);
-       }
+       xe_exec_queue_assign_name(q, q->guc->id);
 
        trace_xe_exec_queue_create(q);