From: Jani Nikula <jani.nikula@intel.com>
To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
intel-xe@lists.freedesktop.org,
Thomas Zimmermann <tzimmermann@suse.de>,
Maxime Ripard <mripard@kernel.org>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Subject: Re: [PATCH 1/3] drm/print: add drm_print_hex_dump()
Date: Mon, 09 Dec 2024 13:02:49 +0200 [thread overview]
Message-ID: <87y10pyv8m.fsf@intel.com> (raw)
In-Reply-To: <f650fe1ed3e3bb74760426fa7461c3b028d661fb.1733392101.git.jani.nikula@intel.com>
On Thu, 05 Dec 2024, Jani Nikula <jani.nikula@intel.com> wrote:
> Add a helper to print a hex dump to a struct drm_printer. There's no
> fancy formatting stuff, just 16 space-separated bytes per line, with an
> optional prefix.
drm-misc maintainers, ack for merging this via drm-intel-next?
BR,
Jani.
>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
> drivers/gpu/drm/drm_print.c | 23 +++++++++++++++++++++++
> include/drm/drm_print.h | 2 ++
> 2 files changed, 25 insertions(+)
>
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 08cfea04e22b..79517bd4418f 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -390,3 +390,26 @@ void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset)
> }
> }
> EXPORT_SYMBOL(drm_print_regset32);
> +
> +/**
> + * drm_print_hex_dump - print a hex dump to a &drm_printer stream
> + * @p: The &drm_printer
> + * @prefix: Prefix for each line, may be NULL for no prefix
> + * @buf: Buffer to dump
> + * @len: Length of buffer
> + *
> + * Print hex dump to &drm_printer, with 16 space-separated hex bytes per line,
> + * optionally with a prefix on each line. No separator is added after prefix.
> + */
> +void drm_print_hex_dump(struct drm_printer *p, const char *prefix,
> + const u8 *buf, size_t len)
> +{
> + int i;
> +
> + for (i = 0; i < len; i += 16) {
> + int bytes_per_line = min(16, len - i);
> +
> + drm_printf(p, "%s%*ph\n", prefix ?: "", bytes_per_line, buf + i);
> + }
> +}
> +EXPORT_SYMBOL(drm_print_hex_dump);
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index b3906dc04388..f77fe1531cf8 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -199,6 +199,8 @@ void drm_puts(struct drm_printer *p, const char *str);
> void drm_print_regset32(struct drm_printer *p, struct debugfs_regset32 *regset);
> void drm_print_bits(struct drm_printer *p, unsigned long value,
> const char * const bits[], unsigned int nbits);
> +void drm_print_hex_dump(struct drm_printer *p, const char *prefix,
> + const u8 *buf, size_t len);
>
> __printf(2, 0)
> /**
--
Jani Nikula, Intel
next prev parent reply other threads:[~2024-12-09 11:02 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1733392101.git.jani.nikula@intel.com>
2024-12-05 9:49 ` [PATCH 2/3] drm/i915/display: use drm_print_hex_dump() for crtc state dump Jani Nikula
2024-12-05 13:16 ` Andi Shyti
2024-12-05 13:32 ` Jani Nikula
2024-12-05 9:49 ` [PATCH 3/3] drm/i915/display: use drm_print_hex_dump() for buffer mismatch dumps Jani Nikula
2024-12-05 13:17 ` Andi Shyti
2024-12-05 11:09 ` ✓ CI.Patch_applied: success for drm: add drm_printer based hex dumper and use it Patchwork
2024-12-05 11:09 ` ✓ CI.checkpatch: " Patchwork
2024-12-05 11:10 ` ✓ CI.KUnit: " Patchwork
2024-12-05 11:28 ` ✓ CI.Build: " Patchwork
2024-12-05 11:31 ` ✓ CI.Hooks: " Patchwork
2024-12-05 11:32 ` ✗ CI.checksparse: warning " Patchwork
2024-12-05 12:27 ` ✓ Xe.CI.BAT: success " Patchwork
[not found] ` <f650fe1ed3e3bb74760426fa7461c3b028d661fb.1733392101.git.jani.nikula@intel.com>
2024-12-05 13:12 ` [PATCH 1/3] drm/print: add drm_print_hex_dump() Andi Shyti
2024-12-10 12:33 ` Jani Nikula
2024-12-09 11:02 ` Jani Nikula [this message]
2024-12-05 13:24 ` ✗ Xe.CI.Full: failure for drm: add drm_printer based hex dumper and use it Patchwork
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=87y10pyv8m.fsf@intel.com \
--to=jani.nikula@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=tzimmermann@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).