From: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
To: Eric Anholt <eric@anholt.net>, dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, Maxime Ripard <maxime.ripard@bootlin.com>
Subject: Re: [PATCH 4/7] drm/vc4: Use drm_printer for the debugfs and runtime bo stats output.
Date: Fri, 22 Mar 2019 11:41:23 +0100 [thread overview]
Message-ID: <56fc5712f080b7e9dbf933acab8870811d4443c9.camel@bootlin.com> (raw)
In-Reply-To: <20190220210343.28157-4-eric@anholt.net>
Hi,
Le mercredi 20 février 2019 à 13:03 -0800, Eric Anholt a écrit :
> Now I can extend the stats without more copy and pasting between the
> two.
Reviewed-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Cheers,
Paul
> Signed-off-by: Eric Anholt <eric@anholt.net>
> ---
> drivers/gpu/drm/vc4/vc4_bo.c | 48 +++++++++++-------------------------
> 1 file changed, 14 insertions(+), 34 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
> index 8c509d560bf0..88ebd681d7eb 100644
> --- a/drivers/gpu/drm/vc4/vc4_bo.c
> +++ b/drivers/gpu/drm/vc4/vc4_bo.c
> @@ -40,7 +40,7 @@ static bool is_user_label(int label)
> return label >= VC4_BO_TYPE_COUNT;
> }
>
> -static void vc4_bo_stats_dump(struct vc4_dev *vc4)
> +static void vc4_bo_stats_print(struct drm_printer *p, struct vc4_dev *vc4)
> {
> int i;
>
> @@ -48,21 +48,21 @@ static void vc4_bo_stats_dump(struct vc4_dev *vc4)
> if (!vc4->bo_labels[i].num_allocated)
> continue;
>
> - DRM_INFO("%30s: %6dkb BOs (%d)\n",
> - vc4->bo_labels[i].name,
> - vc4->bo_labels[i].size_allocated / 1024,
> - vc4->bo_labels[i].num_allocated);
> + drm_printf(p, "%30s: %6dkb BOs (%d)\n",
> + vc4->bo_labels[i].name,
> + vc4->bo_labels[i].size_allocated / 1024,
> + vc4->bo_labels[i].num_allocated);
> }
>
> mutex_lock(&vc4->purgeable.lock);
> if (vc4->purgeable.num)
> - DRM_INFO("%30s: %6zdkb BOs (%d)\n", "userspace BO cache",
> - vc4->purgeable.size / 1024, vc4->purgeable.num);
> + drm_printf(p, "%30s: %6zdkb BOs (%d)\n", "userspace BO cache",
> + vc4->purgeable.size / 1024, vc4->purgeable.num);
>
> if (vc4->purgeable.purged_num)
> - DRM_INFO("%30s: %6zdkb BOs (%d)\n", "total purged BO",
> - vc4->purgeable.purged_size / 1024,
> - vc4->purgeable.purged_num);
> + drm_printf(p, "%30s: %6zdkb BOs (%d)\n", "total purged BO",
> + vc4->purgeable.purged_size / 1024,
> + vc4->purgeable.purged_num);
> mutex_unlock(&vc4->purgeable.lock);
> }
>
> @@ -71,30 +71,9 @@ static int vc4_bo_stats_debugfs(struct seq_file *m, void *unused)
> struct drm_info_node *node = (struct drm_info_node *)m->private;
> struct drm_device *dev = node->minor->dev;
> struct vc4_dev *vc4 = to_vc4_dev(dev);
> - int i;
> -
> - mutex_lock(&vc4->bo_lock);
> - for (i = 0; i < vc4->num_labels; i++) {
> - if (!vc4->bo_labels[i].num_allocated)
> - continue;
> -
> - seq_printf(m, "%30s: %6dkb BOs (%d)\n",
> - vc4->bo_labels[i].name,
> - vc4->bo_labels[i].size_allocated / 1024,
> - vc4->bo_labels[i].num_allocated);
> - }
> - mutex_unlock(&vc4->bo_lock);
> + struct drm_printer p = drm_seq_file_printer(m);
>
> - mutex_lock(&vc4->purgeable.lock);
> - if (vc4->purgeable.num)
> - seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "userspace BO cache",
> - vc4->purgeable.size / 1024, vc4->purgeable.num);
> -
> - if (vc4->purgeable.purged_num)
> - seq_printf(m, "%30s: %6zdkb BOs (%d)\n", "total purged BO",
> - vc4->purgeable.purged_size / 1024,
> - vc4->purgeable.purged_num);
> - mutex_unlock(&vc4->purgeable.lock);
> + vc4_bo_stats_print(&p, vc4);
>
> return 0;
> }
> @@ -473,8 +452,9 @@ struct vc4_bo *vc4_bo_create(struct drm_device *dev, size_t unaligned_size,
> }
>
> if (IS_ERR(cma_obj)) {
> + struct drm_printer p = drm_info_printer(vc4->dev->dev);
> DRM_ERROR("Failed to allocate from CMA:\n");
> - vc4_bo_stats_dump(vc4);
> + vc4_bo_stats_print(&p, vc4);
> return ERR_PTR(-ENOMEM);
> }
> bo = to_vc4_bo(&cma_obj->base);
--
Paul Kocialkowski, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com
next prev parent reply other threads:[~2019-03-22 10:41 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-20 21:03 [PATCH 1/7] drm: Add a helper function for printing a debugfs_regset32 Eric Anholt
2019-02-20 21:03 ` [PATCH 2/7] drm/vc4: Use drm_print_regset32() for our debug register dumping Eric Anholt
2019-03-22 10:32 ` Paul Kocialkowski
2019-02-20 21:03 ` [PATCH 3/7] drm/vc4: Use common helpers for debugfs setup by the driver components Eric Anholt
2019-02-20 21:03 ` [PATCH 4/7] drm/vc4: Use drm_printer for the debugfs and runtime bo stats output Eric Anholt
2019-03-22 10:41 ` Paul Kocialkowski [this message]
2019-02-20 21:03 ` [PATCH 5/7] drm/vc4: Disable V3D interactions if the v3d component didn't probe Eric Anholt
2019-03-25 13:30 ` Paul Kocialkowski
2019-02-20 21:03 ` [PATCH 6/7] drm/vc4: Add helpers for pm get/put Eric Anholt
2019-03-22 10:48 ` Paul Kocialkowski
2019-02-20 21:03 ` [PATCH 7/7] drm/vc4: Make sure that the v3d ident debugfs has vc4's power on Eric Anholt
2019-03-22 10:43 ` Paul Kocialkowski
2019-02-21 9:37 ` [PATCH 1/7] drm: Add a helper function for printing a debugfs_regset32 Daniel Vetter
2019-03-25 16:43 ` Eric Anholt
2019-03-22 10:30 ` Paul Kocialkowski
2019-04-01 17:52 ` Eric Anholt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56fc5712f080b7e9dbf933acab8870811d4443c9.camel@bootlin.com \
--to=paul.kocialkowski@bootlin.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=eric@anholt.net \
--cc=linux-kernel@vger.kernel.org \
--cc=maxime.ripard@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome