Skip to content

Commit

Permalink
drm/xe: Promote xe_hw_engine_class_to_str()
Browse files Browse the repository at this point in the history
Move it out of the sysfs compilation unit so it can be re-used in other
places.

Reviewed-by: Nirmoy Das <[email protected]>
Reviewed-by: Oak Zeng <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
Signed-off-by: Lucas De Marchi <[email protected]>
  • Loading branch information
lucasdemarchi committed May 21, 2024
1 parent 844f322 commit ab68951
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
18 changes: 18 additions & 0 deletions drivers/gpu/drm/xe/xe_hw_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1099,3 +1099,21 @@ bool xe_hw_engine_is_reserved(struct xe_hw_engine *hwe)
return xe->info.has_usm && hwe->class == XE_ENGINE_CLASS_COPY &&
hwe->instance == gt->usm.reserved_bcs_instance;
}

const char *xe_hw_engine_class_to_str(enum xe_engine_class class)
{
switch (class) {
case XE_ENGINE_CLASS_RENDER:
return "rcs";
case XE_ENGINE_CLASS_VIDEO_DECODE:
return "vcs";
case XE_ENGINE_CLASS_VIDEO_ENHANCE:
return "vecs";
case XE_ENGINE_CLASS_COPY:
return "bcs";
case XE_ENGINE_CLASS_COMPUTE:
return "ccs";
default:
return NULL;
}
}
2 changes: 2 additions & 0 deletions drivers/gpu/drm/xe/xe_hw_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,6 @@ static inline bool xe_hw_engine_is_valid(struct xe_hw_engine *hwe)
return hwe->name;
}

const char *xe_hw_engine_class_to_str(enum xe_engine_class class);

#endif
18 changes: 0 additions & 18 deletions drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -618,24 +618,6 @@ static void hw_engine_class_sysfs_fini(struct drm_device *drm, void *arg)
kobject_put(kobj);
}

static const char *xe_hw_engine_class_to_str(enum xe_engine_class class)
{
switch (class) {
case XE_ENGINE_CLASS_RENDER:
return "rcs";
case XE_ENGINE_CLASS_VIDEO_DECODE:
return "vcs";
case XE_ENGINE_CLASS_VIDEO_ENHANCE:
return "vecs";
case XE_ENGINE_CLASS_COPY:
return "bcs";
case XE_ENGINE_CLASS_COMPUTE:
return "ccs";
default:
return NULL;
}
}

/**
* xe_hw_engine_class_sysfs_init - Init HW engine classes on GT.
* @gt: Xe GT.
Expand Down

0 comments on commit ab68951

Please sign in to comment.