Re: [PATCH v3 5/7] drm/etnaviv: Switch to fdinfo helper

Daniel Vetter
2023-04-12T08:00:06Z

On Tue, Apr 11, 2023 at 03:56:10PM -0700, Rob Clark wrote:
> From: Rob Clark <robdclark@chromium.org>
>
> Signed-off-by: Rob Clark <robdclark@chromium.org>

You're on an old tree, this got reverted. But I'm kinda wondering whether
another patch on top shouldn't just includ the drm_show_fdinfo in
DRM_GEM_FOPS macro ... There's really no good reasons for drivers to not
have this I think?
-Daniel

> ---
> drivers/gpu/drm/etnaviv/etnaviv_drv.c | 10 ++++------
> 1 file changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index 44ca803237a5..170000d6af94 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -476,9 +476,8 @@ static const struct drm_ioctl_desc etnaviv_ioctls[] = {
> ETNA_IOCTL(PM_QUERY_SIG, pm_query_sig, DRM_RENDER_ALLOW),
> };
>
> -static void etnaviv_fop_show_fdinfo(struct seq_file *m, struct file *f)
> +static void etnaviv_fop_show_fdinfo(struct drm_printer *p, struct drm_file *file)
> {
> - struct drm_file *file = f->private_data;
> struct drm_device *dev = file->minor->dev;
> struct etnaviv_drm_private *priv = dev->dev_private;
> struct etnaviv_file_private *ctx = file->driver_priv;
> @@ -487,8 +486,6 @@ static void etnaviv_fop_show_fdinfo(struct seq_file *m, struct file *f)
> * For a description of the text output format used here, see
> * Documentation/gpu/drm-usage-stats.rst.
> */
> - seq_printf(m, "drm-driver:\t%s\n", dev->driver->name);
> - seq_printf(m, "drm-client-id:\t%u\n", ctx->id);
>
> for (int i = 0; i < ETNA_MAX_PIPES; i++) {
> struct etnaviv_gpu *gpu = priv->gpu[i];
> @@ -507,7 +504,7 @@ static void etnaviv_fop_show_fdinfo(struct seq_file *m, struct file *f)
> cur = snprintf(engine + cur, sizeof(engine) - cur,
> "%sNN", cur ? "/" : "");
>
> - seq_printf(m, "drm-engine-%s:\t%llu ns\n", engine,
> + drm_printf(p, "drm-engine-%s:\t%llu ns\n", engine,
> ctx->sched_entity[i].elapsed_ns);
> }
> }
> @@ -515,7 +512,7 @@ static void etnaviv_fop_show_fdinfo(struct seq_file *m, struct file *f)
> static const struct file_operations fops = {
> .owner = THIS_MODULE,
> DRM_GEM_FOPS,
> - .show_fdinfo = etnaviv_fop_show_fdinfo,
> + .show_fdinfo = drm_fop_show_fdinfo,
> };
>
> static const struct drm_driver etnaviv_drm_driver = {
> @@ -529,6 +526,7 @@ static const struct drm_driver etnaviv_drm_driver = {
> #ifdef CONFIG_DEBUG_FS
> .debugfs_init = etnaviv_debugfs_init,
> #endif
> + .show_fdinfo = etnaviv_fop_show_fdinfo,
> .ioctls = etnaviv_ioctls,
> .num_ioctls = DRM_ETNAVIV_NUM_IOCTLS,
> .fops = &fops,
> --
> 2.39.2
>

--
Daniel Vetter
Software Engineer, Intel Corporation