[PATCH RFC 1/4] drm/panfrost: Provide a dummy show_fdinfo() implementation

Daniel Vetter daniel at ffwll.ch
Thu Jan 5 15:31:49 UTC 2023


On Wed, Jan 04, 2023 at 02:03:05PM +0100, Boris Brezillon wrote:
> Provide a dummy show_fdinfo() implementation exposing drm-driver and
> drm-client-id. More stats will be added soon.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon at collabora.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 2fa5afe21288..6ee43559fc14 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -515,7 +515,22 @@ static const struct drm_ioctl_desc panfrost_drm_driver_ioctls[] = {
>  	PANFROST_IOCTL(MADVISE,		madvise,	DRM_RENDER_ALLOW),
>  };
>  
> -DEFINE_DRM_GEM_FOPS(panfrost_drm_driver_fops);
> +static void panfrost_show_fdinfo(struct seq_file *m, struct file *f)
> +{
> +	struct drm_file *file = f->private_data;
> +	struct panfrost_file_priv *panfrost_priv = file->driver_priv;
> +
> +	seq_printf(m, "drm-driver:\t%s\n", file->minor->dev->driver->name);
> +	seq_printf(m, "drm-client-id:\t%llu\n", panfrost_priv->sched_entity[0].fence_context);

I think at this point we really need to not just have a document that says
what this should look like, but drm infrastructure with shared code.
Drivers all inventing their fdinfo really doesn't seem like a great idea
to me.
-Daniel

> +}
> +
> +static const struct file_operations panfrost_drm_driver_fops = {
> +	.owner = THIS_MODULE,
> +	DRM_GEM_FOPS,
> +#ifdef CONFIG_PROC_FS
> +	.show_fdinfo = panfrost_show_fdinfo,
> +#endif
> +};
>  
>  /*
>   * Panfrost driver version:
> -- 
> 2.38.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the dri-devel mailing list