public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	DRI Development <dri-devel@lists.freedesktop.org>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH 1/2] drm/printer: add debug printer
Date: Fri, 30 Dec 2016 11:42:32 +0100	[thread overview]
Message-ID: <20161230104232.GA2667@dvetter-linux.ger.corp.intel.com> (raw)
In-Reply-To: <20161229124752.GD13154@nuc-i3427.alporthouse.com>

On Thu, Dec 29, 2016 at 12:47:52PM +0000, Chris Wilson wrote:
> On Wed, Dec 28, 2016 at 05:42:09PM +0100, Daniel Vetter wrote:
> > Useful for dumping lots of data into dmesg, e.g. drm_mm.
> > 
> > Cc: Rob Clark <robdclark@gmail.com>
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/drm_print.c |  6 ++++++
> >  include/drm/drm_print.h     | 20 ++++++++++++++++++--
> >  2 files changed, 24 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_print.c b/drivers/gpu/drm/drm_print.c
> > index ad3caaa1f48b..a8300cd2d3b3 100644
> > --- a/drivers/gpu/drm/drm_print.c
> > +++ b/drivers/gpu/drm/drm_print.c
> > @@ -40,6 +40,12 @@ void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf)
> >  }
> >  EXPORT_SYMBOL(__drm_printfn_info);
> >  
> > +void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf)
> > +{
> > +	pr_debug("%s %pV", p->prefix, vaf);
> > +}
> > +EXPORT_SYMBOL(__drm_printfn_info);
> 
> Ahem.

Oops, I spotted it, but misplaced the fixup hunk into the 2nd patch. Will
fix.

> > +
> >  /**
> >   * drm_printf - print to a &drm_printer stream
> >   * @p: the &drm_printer
> > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> > index 1adf84aea622..e9d0ba20089c 100644
> > --- a/include/drm/drm_print.h
> > +++ b/include/drm/drm_print.h
> > @@ -60,19 +60,20 @@
> >  
> >  /**
> >   * struct drm_printer - drm output "stream"
> > - * @printfn: actual output fxn
> > - * @arg: output fxn specific data
> >   *
> >   * Do not use struct members directly.  Use drm_printer_seq_file(),
> >   * drm_printer_info(), etc to initialize.  And drm_printf() for output.
> >   */
> >  struct drm_printer {
> > +	/* private: */
> >  	void (*printfn)(struct drm_printer *p, struct va_format *vaf);
> >  	void *arg;
> > +	const char *prefix;
> >  };
> >  
> >  void __drm_printfn_seq_file(struct drm_printer *p, struct va_format *vaf);
> >  void __drm_printfn_info(struct drm_printer *p, struct va_format *vaf);
> > +void __drm_printfn_debug(struct drm_printer *p, struct va_format *vaf);
> >  
> >  void drm_printf(struct drm_printer *p, const char *f, ...);
> >  
> > @@ -109,4 +110,19 @@ static inline struct drm_printer drm_info_printer(struct device *dev)
> >  	return p;
> >  }
> >  
> > +/**
> > + * drm_debug_printer - construct a &drm_printer that outputs to pr_debug()
> > + * @prefix: debug output prefix
> > + *
> > + * RETURNS:
> > + * The &drm_printer object
> > + */
> > +static inline struct drm_printer drm_debug_printer(const char *prefix)
> > +{
> > +	struct drm_printer p = {
> > +		.printfn = __drm_printfn_debug,
> > +		.prefix = prefix
> > +	};
> > +	return p;
> > +}
> 
> \n
> 
> >  #endif /* DRM_PRINT_H_ */
> 
> I was looking at a single __drm_printfn callback with a
> drm_printer.level, but we lose the dynamic debug goodness.
> 
> With the EXPORT_SYMBOL fixed,
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Thanks for the review, both applied to -misc.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2016-12-30 10:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-28 16:42 [PATCH 1/2] drm/printer: add debug printer Daniel Vetter
2016-12-28 16:42 ` [PATCH 2/2] drm/mm: Convert to drm_printer Daniel Vetter
2016-12-28 17:01   ` Chris Wilson
2016-12-29 11:09   ` [PATCH] " Daniel Vetter
2016-12-29 11:31     ` Chris Wilson
2016-12-29 12:38       ` Daniel Vetter
2016-12-28 17:23 ` ✗ Fi.CI.BAT: warning for series starting with [1/2] drm/printer: add debug printer Patchwork
2016-12-29 11:53 ` ✓ Fi.CI.BAT: success for series starting with [1/2] drm/printer: add debug printer (rev2) Patchwork
2016-12-29 12:47 ` [PATCH 1/2] drm/printer: add debug printer Chris Wilson
2016-12-30 10:42   ` Daniel Vetter [this message]

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=20161230104232.GA2667@dvetter-linux.ger.corp.intel.com \
    --to=daniel@ffwll.ch \
    --cc=chris@chris-wilson.co.uk \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /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