[PATCH v3 3/4] drm/print: Add drm_printer_is_full

Matthew Brost matthew.brost at intel.com
Tue Apr 15 17:10:31 UTC 2025


On Thu, Apr 10, 2025 at 03:06:32PM +0300, Jani Nikula wrote:
> On Wed, 09 Apr 2025, Matthew Brost <matthew.brost at intel.com> wrote:
> > Add drm_printer_is_full which indicates if a drm printer's output is
> > full. Useful to short circuit coredump printing once printer's output is
> > full.
> 
> The function is presented as a generic drm_printer thing, but it's
> really only valid for a coredump printer, and will return random results
> for other printers. Which can't even be "full" in any meaningful sense,
> making the documentation for the function seem completely weird.
> 

So maybe:

s/drm_printer_is_full/drm_coredump_printer_is_full?

Matt

> BR,
> Jani.
> 
> >
> > Signed-off-by: Matthew Brost <matthew.brost at intel.com>
> > Reviewed-by: Jonathan Cavitt <jonathan.cavitt at intel.com>
> > ---
> >  include/drm/drm_print.h | 17 +++++++++++++++++
> >  1 file changed, 17 insertions(+)
> >
> > diff --git a/include/drm/drm_print.h b/include/drm/drm_print.h
> > index f31eba1c7cab..db7517ee1b19 100644
> > --- a/include/drm/drm_print.h
> > +++ b/include/drm/drm_print.h
> > @@ -242,6 +242,23 @@ struct drm_print_iterator {
> >  	ssize_t offset;
> >  };
> >  
> > +/**
> > + * drm_printer_is_full() - DRM printer output is full
> > + * @p: DRM printer
> > + *
> > + * DRM printer output is full, useful to short circuit coredump printing once
> > + * printer is full.
> > + *
> > + * RETURNS:
> > + * True if DRM printer output buffer is full, False otherwise
> > + */
> > +static inline bool drm_printer_is_full(struct drm_printer *p)
> > +{
> > +	struct drm_print_iterator *iterator = p->arg;
> > +
> > +	return !iterator->remain;
> > +}
> > +
> >  /**
> >   * drm_coredump_printer - construct a &drm_printer that can output to a buffer
> >   * from the read function for devcoredump
> 
> -- 
> Jani Nikula, Intel


More information about the Intel-xe mailing list