[PATCH 3/7] drm/xe: Promote xe_hw_engine_class_to_str()

Nirmoy Das nirmoy.das at linux.intel.com
Tue Apr 16 09:36:03 UTC 2024


On 4/16/2024 5:04 AM, Lucas De Marchi wrote:
> Move it out of the sysfs compilation unit so it can be re-used in other
> places.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_hw_engine.c             | 18 ++++++++++++++++++
>   drivers/gpu/drm/xe/xe_hw_engine.h             |  2 ++
>   drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c | 18 ------------------
>   3 files changed, 20 insertions(+), 18 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.c b/drivers/gpu/drm/xe/xe_hw_engine.c
> index a688bb2d96ce..8f72f324eee7 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.c
> @@ -959,3 +959,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;
> +	}
> +}
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine.h b/drivers/gpu/drm/xe/xe_hw_engine.h
> index 71968ee2f600..843de159e47c 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine.h
> +++ b/drivers/gpu/drm/xe/xe_hw_engine.h
> @@ -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
> diff --git a/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c b/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
> index c5084d94c442..4e9db6299c7c 100644
> --- a/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
> +++ b/drivers/gpu/drm/xe/xe_hw_engine_class_sysfs.c
> @@ -624,24 +624,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.


More information about the Intel-xe mailing list