Re: [PATCH 2/6] drm/i915: Use snprintf to avoid line-break when pretty-printing engines

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> writes:

> When printing the execlist ports, we first print the ELSP header then
> follow it with the pretty-printed request. Since switching to
> drm_printer and show the output via printk, it automatically appends a
> newline to each call (unlike the old seq_printf output). To avoid the
> unwanted line break, construct the ELSP request header in a temporary
> buffer.
>
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx>

Reviewed-by: Mika Kuoppala <mika.kuoppala@xxxxxxxxxxxxxxx>

> ---
>  drivers/gpu/drm/i915/intel_engine_cs.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c b/drivers/gpu/drm/i915/intel_engine_cs.c
> index 22c095035539..b51400c25c2e 100644
> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
> @@ -1660,6 +1660,7 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m)
>  	struct drm_i915_private *dev_priv = engine->i915;
>  	struct drm_i915_gem_request *rq;
>  	struct rb_node *rb;
> +	char hdr[80];
>  	u64 addr;
>  
>  	drm_printf(m, "%s\n", engine->name);
> @@ -1772,12 +1773,12 @@ void intel_engine_dump(struct intel_engine_cs *engine, struct drm_printer *m)
>  
>  			rq = port_unpack(&execlists->port[idx], &count);
>  			if (rq) {
> -				drm_printf(m, "\t\tELSP[%d] count=%d, ",
> -					   idx, count);
> -				print_request(m, rq, "rq: ");
> +				snprintf(hdr, sizeof(hdr),
> +					 "\t\tELSP[%d] count=%d, rq: ",
> +					 idx, count);
> +				print_request(m, rq, hdr);
>  			} else {
> -				drm_printf(m, "\t\tELSP[%d] idle\n",
> -					   idx);
> +				drm_printf(m, "\t\tELSP[%d] idle\n", idx);
>  			}
>  		}
>  		drm_printf(m, "\t\tHW active? 0x%x\n", execlists->active);
> -- 
> 2.15.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux