dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: abhinavk@codeaurora.org
To: Sean Paul <sean@poorly.run>
Cc: dri-devel@lists.freedesktop.org, ppaalanen@gmail.com,
	maarten.lankhorst@linux.intel.com, tzimmermann@suse.de,
	airlied@linux.ie, daniel.vetter@ffwll.ch,
	Sean Paul <seanpaul@chromium.org>
Subject: Re: [RESEND PATCH v6 10/14] drm/print: Add drm_debug_category_printer
Date: Fri, 17 Sep 2021 11:27:03 -0700	[thread overview]
Message-ID: <cb17a4b73b5d542c139661633c595ae2@codeaurora.org> (raw)
In-Reply-To: <20210721175526.22020-11-sean@poorly.run>

On 2021-07-21 10:55, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
> 
> This patch adds a new printer which will select the appropriate output
> for a given debug category. Currently there is only one output target,
> which is syslog. However in the future we'll have tracefs and it will 
> be
> useful to print to syslog, tracefs, or both. Drivers just need to 
> create
> the printer for the appropriate category and the printer will decide
> where to send the output.
> 
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Abhinav Kumar <abhinavk@codeaurora.org>
> Link:
> https://patchwork.freedesktop.org/patch/msgid/20200608210505.48519-11-sean@poorly.run
> #v5
> 
> Changes in v5:
> -Added to the set
> Changes in v6:
> -None
> ---
>  drivers/gpu/drm/drm_print.c |  5 +++++
>  include/drm/drm_print.h     | 28 ++++++++++++++++++++++++++++
>  2 files changed, 33 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> index 2ff7a6ecc632..4d984a01b3a3 100644
> --- a/drivers/gpu/drm/drm_print.c
> +++ b/drivers/gpu/drm/drm_print.c
> @@ -172,6 +172,11 @@ void __drm_printfn_err(struct drm_printer *p,
> struct va_format *vaf)
>  }
>  EXPORT_SYMBOL(__drm_printfn_err);
> 
> +void __drm_printfn_noop(struct drm_printer *p, struct va_format *vaf)
> +{
> +}
> +EXPORT_SYMBOL(__drm_printfn_noop);
> +
>  /**
>   * drm_puts - print a const string to a &drm_printer stream
>   * @p: the &drm printer
> diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> index 2ea0ffd9c1ce..af31beeb82a1 100644
> --- a/include/drm/drm_print.h
> +++ b/include/drm/drm_print.h
> @@ -87,6 +87,7 @@ void __drm_puts_seq_file(struct drm_printer *p,
> const char *str);
>  void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
>  void __drm_printfn_debug_syslog(struct drm_printer *p, struct 
> va_format *vaf);
>  void __drm_printfn_err(struct drm_printer *p, struct va_format *vaf);
> +void __drm_printfn_noop(struct drm_printer *p, struct va_format *vaf);
> 
>  __printf(2, 3)
>  void drm_printf(struct drm_printer *p, const char *f, ...);
> @@ -329,6 +330,33 @@ static inline bool drm_debug_enabled(enum
> drm_debug_category category)
>  	return drm_debug_syslog_enabled(category);
>  }
> 
> +/**
> + * drm_debug_category_printer - construct a &drm_printer that outputs 
> to
> + * pr_debug() if enabled for the given category.
> + * @category: the DRM_UT_* message category this message belongs to
> + * @prefix: trace output prefix
> + *
> + * RETURNS:
> + * The &drm_printer object
> + */
> +static inline struct drm_printer
> +drm_debug_category_printer(enum drm_debug_category category,
> +			   const char *prefix)
> +{
> +	struct drm_printer p = {
> +		.prefix = prefix
> +	};
> +
> +	if (drm_debug_syslog_enabled(category)) {
> +		p.printfn = __drm_printfn_debug_syslog;
> +	} else {
> +		WARN(1, "Debug category %d is inactive.", category);
> +		p.printfn = __drm_printfn_noop;
> +	}
> +
> +	return p;
> +}
> +
>  /*
>   * struct device based logging
>   *

  reply	other threads:[~2021-09-17 18:27 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-21 17:55 [RESEND PATCH v6 00/14] drm/trace: Mirror DRM debug logs to tracefs Sean Paul
2021-07-21 17:55 ` [RESEND PATCH v6 01/14] drm/mipi_dbi: Convert pr_debug calls to DRM_DEBUG_DRIVER Sean Paul
2021-07-28 15:41   ` jim.cromie
2021-07-21 17:55 ` [RESEND PATCH v6 02/14] drm/sil164: Convert dev_printk to drm_dev_dbg Sean Paul
2021-07-28 14:34   ` jim.cromie
2021-07-21 17:55 ` [RESEND PATCH v6 03/14] drm/i915/utils: Replace dev_printk with drm helpers Sean Paul
2021-07-28 14:39   ` jim.cromie
2021-07-21 17:55 ` [RESEND PATCH v6 04/14] drm/msm/dpu: Replace definitions for dpu debug macros Sean Paul
2021-08-05 14:00   ` Dmitry Baryshkov
2021-09-17 18:23   ` [Freedreno] " abhinavk
2021-07-21 17:55 ` [RESEND PATCH v6 05/14] drm/print: rename drm_debug* to be more syslog-centric Sean Paul
2021-07-28 16:03   ` jim.cromie
2021-07-28 16:13   ` jim.cromie
2021-09-17 18:24   ` abhinavk
2021-09-17 18:25   ` abhinavk
2021-07-21 17:55 ` [RESEND PATCH v6 06/14] drm/amd: Gate i2c transaction logs on drm_debug_syslog Sean Paul
2021-07-21 17:55 ` [RESEND PATCH v6 07/14] drm/etnaviv: Change buffer dump checks to target syslog Sean Paul
2021-07-21 20:54   ` Lucas Stach
2021-07-21 17:55 ` [RESEND PATCH v6 08/14] drm/nouveau: Change debug checks to specifically " Sean Paul
2021-07-21 17:55 ` [RESEND PATCH v6 09/14] drm/i915: Change infoframe debug checks to specify syslog Sean Paul
2021-07-21 17:55 ` [RESEND PATCH v6 10/14] drm/print: Add drm_debug_category_printer Sean Paul
2021-09-17 18:27   ` abhinavk [this message]
2021-07-21 17:55 ` [RESEND PATCH v6 11/14] drm/mst: Convert debug printers to debug category printers Sean Paul
2021-07-27 19:25   ` Lyude Paul
2021-07-21 17:55 ` [RESEND PATCH v6 12/14] drm/i915: Use debug category printer for welcome message Sean Paul
2021-07-21 17:55 ` [RESEND PATCH v6 13/14] drm/atomic: Use debug category printer for atomic state printer Sean Paul
2021-09-17 18:27   ` abhinavk
2021-07-21 17:55 ` [RESEND PATCH v6 14/14] drm/print: Add tracefs support to the drm logging helpers Sean Paul
2021-07-26 20:50   ` Rodrigo Siqueira
2021-07-29 20:24   ` jim.cromie
2021-07-29 20:33     ` jim.cromie
2021-09-17 18:17   ` abhinavk
2021-07-22  7:49 ` [RESEND PATCH v6 00/14] drm/trace: Mirror DRM debug logs to tracefs Pekka Paalanen
2021-07-22 13:48   ` Sean Paul
2021-07-22 13:49     ` Sean Paul
2021-07-23  8:02     ` Pekka Paalanen
2021-09-17 17:58 ` abhinavk

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=cb17a4b73b5d542c139661633c595ae2@codeaurora.org \
    --to=abhinavk@codeaurora.org \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=ppaalanen@gmail.com \
    --cc=sean@poorly.run \
    --cc=seanpaul@chromium.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).