[Intel-xe] [PATCH 2/7] drm/xe: Interface xe drm client with fdinfo interface

Ghimiray, Himal Prasad himal.prasad.ghimiray at intel.com
Wed Sep 6 04:21:52 UTC 2023


On 31-08-2023 14:35, Tejas Upadhyay wrote:
> DRM core driver has introduced recently fdinfo interface to
> show memory stats of individual drm client. Lets interface
> xe drm client to fdinfo interface.
>
> Signed-off-by: Tejas Upadhyay <tejas.upadhyay at intel.com>
> ---
>   drivers/gpu/drm/xe/xe_device.c     |  4 ++++
>   drivers/gpu/drm/xe/xe_drm_client.c | 17 +++++++++++++++++
>   drivers/gpu/drm/xe/xe_drm_client.h |  4 +++-
>   3 files changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
> index cf59c7b74eaf..1aae352a982c 100644
> --- a/drivers/gpu/drm/xe/xe_device.c
> +++ b/drivers/gpu/drm/xe/xe_device.c
> @@ -138,6 +138,9 @@ static const struct file_operations xe_driver_fops = {
>   	.read = drm_read,
>   	.compat_ioctl = drm_compat_ioctl,
>   	.llseek = noop_llseek,
> +#ifdef CONFIG_PROC_FS
> +	.show_fdinfo = drm_show_fdinfo,
> +#endif
>   };
>   
>   static void xe_driver_release(struct drm_device *dev)
> @@ -162,6 +165,7 @@ static struct drm_driver driver = {
>   
>   	.dumb_create = xe_bo_dumb_create,
>   	.dumb_map_offset = drm_gem_ttm_dumb_map_offset,
> +	.show_fdinfo = PTR_IF(IS_ENABLED(CONFIG_PROC_FS), xe_drm_client_fdinfo),
>   	.release = &xe_driver_release,
>   
>   	.ioctls = xe_ioctls,
> diff --git a/drivers/gpu/drm/xe/xe_drm_client.c b/drivers/gpu/drm/xe/xe_drm_client.c
> index ea7993338076..b5dc024b5dd0 100644
> --- a/drivers/gpu/drm/xe/xe_drm_client.c
> +++ b/drivers/gpu/drm/xe/xe_drm_client.c
> @@ -50,3 +50,20 @@ void __xe_drm_client_free(struct kref *kref)
>   
>   	kfree(client);
>   }
> +
> +#ifdef CONFIG_PROC_FS
> +/**
> + * xe_drm_client_fdinfo() - Callback for fdinfo interface
> + * @p: The drm_printer ptr
> + * @file: The drm_file ptr
> + *
> + * This is callabck for drm fdinfo interface. Register this callback
> + * in drm driver ops for show_fdinfo.
> + *
> + * Return: void
> + */
> +void xe_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file)
> +{
> +	/* show_meminfo() will be developed here */
> +}
> +#endif

LGTM.

Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray at intel.com>

> diff --git a/drivers/gpu/drm/xe/xe_drm_client.h b/drivers/gpu/drm/xe/xe_drm_client.h
> index be097cdf5d12..dbe3a083c9df 100644
> --- a/drivers/gpu/drm/xe/xe_drm_client.h
> +++ b/drivers/gpu/drm/xe/xe_drm_client.h
> @@ -39,5 +39,7 @@ struct xe_drm_client *xe_drm_client_alloc(void);
>   static inline struct xe_drm_client *
>   xe_drm_client_get(struct xe_drm_client *client);
>   static inline void xe_drm_client_put(struct xe_drm_client *client);
> -
> +#ifdef CONFIG_PROC_FS
> +void xe_drm_client_fdinfo(struct drm_printer *p, struct drm_file *file);
> +#endif
>   #endif


More information about the Intel-xe mailing list