@@ -272,6 +272,22 @@ static const struct engine_info engine_infos[] = {
},
};
+const u16 xe_to_user_engine_class[] = {
+ [XE_ENGINE_CLASS_RENDER] = DRM_XE_ENGINE_CLASS_RENDER,
+ [XE_ENGINE_CLASS_COPY] = DRM_XE_ENGINE_CLASS_COPY,
+ [XE_ENGINE_CLASS_VIDEO_DECODE] = DRM_XE_ENGINE_CLASS_VIDEO_DECODE,
+ [XE_ENGINE_CLASS_VIDEO_ENHANCE] = DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE,
+ [XE_ENGINE_CLASS_COMPUTE] = DRM_XE_ENGINE_CLASS_COMPUTE,
+};
+
+const enum xe_engine_class user_to_xe_engine_class[] = {
+ [DRM_XE_ENGINE_CLASS_RENDER] = XE_ENGINE_CLASS_RENDER,
+ [DRM_XE_ENGINE_CLASS_COPY] = XE_ENGINE_CLASS_COPY,
+ [DRM_XE_ENGINE_CLASS_VIDEO_DECODE] = XE_ENGINE_CLASS_VIDEO_DECODE,
+ [DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE] = XE_ENGINE_CLASS_VIDEO_ENHANCE,
+ [DRM_XE_ENGINE_CLASS_COMPUTE] = XE_ENGINE_CLASS_COMPUTE,
+};
+
static void hw_engine_fini(void *arg)
{
struct xe_hw_engine *hwe = arg;
@@ -1022,14 +1038,6 @@ enum xe_force_wake_domains xe_hw_engine_to_fw_domain(struct xe_hw_engine *hwe)
return engine_infos[hwe->engine_id].domain;
}
-static const enum xe_engine_class user_to_xe_engine_class[] = {
- [DRM_XE_ENGINE_CLASS_RENDER] = XE_ENGINE_CLASS_RENDER,
- [DRM_XE_ENGINE_CLASS_COPY] = XE_ENGINE_CLASS_COPY,
- [DRM_XE_ENGINE_CLASS_VIDEO_DECODE] = XE_ENGINE_CLASS_VIDEO_DECODE,
- [DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE] = XE_ENGINE_CLASS_VIDEO_ENHANCE,
- [DRM_XE_ENGINE_CLASS_COMPUTE] = XE_ENGINE_CLASS_COMPUTE,
-};
-
/**
* xe_hw_engine_lookup() - Lookup hardware engine for class:instance
* @xe: xe device
@@ -21,6 +21,9 @@ enum xe_engine_class {
XE_ENGINE_CLASS_MAX = 6,
};
+extern const u16 xe_to_user_engine_class[];
+extern const enum xe_engine_class user_to_xe_engine_class[];
+
enum xe_hw_engine_id {
XE_HW_ENGINE_RCS0,
#define XE_HW_ENGINE_RCS_MASK GENMASK_ULL(XE_HW_ENGINE_RCS0, XE_HW_ENGINE_RCS0)
@@ -29,22 +29,6 @@
#include "xe_ttm_vram_mgr.h"
#include "xe_wa.h"
-static const u16 xe_to_user_engine_class[] = {
- [XE_ENGINE_CLASS_RENDER] = DRM_XE_ENGINE_CLASS_RENDER,
- [XE_ENGINE_CLASS_COPY] = DRM_XE_ENGINE_CLASS_COPY,
- [XE_ENGINE_CLASS_VIDEO_DECODE] = DRM_XE_ENGINE_CLASS_VIDEO_DECODE,
- [XE_ENGINE_CLASS_VIDEO_ENHANCE] = DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE,
- [XE_ENGINE_CLASS_COMPUTE] = DRM_XE_ENGINE_CLASS_COMPUTE,
-};
-
-static const enum xe_engine_class user_to_xe_engine_class[] = {
- [DRM_XE_ENGINE_CLASS_RENDER] = XE_ENGINE_CLASS_RENDER,
- [DRM_XE_ENGINE_CLASS_COPY] = XE_ENGINE_CLASS_COPY,
- [DRM_XE_ENGINE_CLASS_VIDEO_DECODE] = XE_ENGINE_CLASS_VIDEO_DECODE,
- [DRM_XE_ENGINE_CLASS_VIDEO_ENHANCE] = XE_ENGINE_CLASS_VIDEO_ENHANCE,
- [DRM_XE_ENGINE_CLASS_COMPUTE] = XE_ENGINE_CLASS_COMPUTE,
-};
-
static size_t calc_hw_engine_info_size(struct xe_device *xe)
{
struct xe_hw_engine *hwe;
@@ -148,7 +132,7 @@ query_engine_cycles(struct xe_device *xe,
if (!gt)
return -EINVAL;
- if (eci->engine_class >= ARRAY_SIZE(user_to_xe_engine_class))
+ if (eci->engine_class >= XE_ENGINE_CLASS_MAX)
return -EINVAL;
hwe = xe_gt_hw_engine(gt, user_to_xe_engine_class[eci->engine_class],
Move the helper arrays xe_to_user_engine_class and user_to_xe_engine_class to xe_hw_engine_types.h, making them available to more of the xe kernel. This is done for user_to_xe_engine_class to reduce duplication, and xe_to_user_engine_class can and will be used in more than one place in the future. v2: - Remove unnecessary includes (jcavitt) Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com> Suggested-by: John Harrison <john.c.harrison@intel.com> --- drivers/gpu/drm/xe/xe_hw_engine.c | 24 ++++++++++++++++-------- drivers/gpu/drm/xe/xe_hw_engine_types.h | 3 +++ drivers/gpu/drm/xe/xe_query.c | 18 +----------------- 3 files changed, 20 insertions(+), 25 deletions(-)