[Intel-gfx] [PATCH 32/33] drm/i915: Consolidate error object printing

Chris Wilson chris at chris-wilson.co.uk
Tue Aug 9 11:53:31 UTC 2016


On Tue, Aug 09, 2016 at 02:44:41PM +0300, Joonas Lahtinen wrote:
> On su, 2016-08-07 at 15:45 +0100, Chris Wilson wrote:
> >  static void print_error_obj(struct drm_i915_error_state_buf *m,
> > +			    struct intel_engine_cs *engine,
> > +			    const char *name,
> >  			    struct drm_i915_error_object *obj)
> >  {
> >  	int page, offset, elt;
> >  
> > +	if (!obj)
> > +		return;
> > +
> > +	if (name) {
> > +		err_printf(m, "%s --- %s gtt_offset = 0x%08x_%08x\n",
> > +			   engine ? engine->name : "global", name,
> > +			   upper_32_bits(obj->gtt_offset),
> > +			   lower_32_bits(obj->gtt_offset));
> > +	}
> > +
> >  	for (page = offset = 0; page < obj->page_count; page++) {
> >  		for (elt = 0; elt < PAGE_SIZE/4; elt++) {
> >  			err_printf(m, "%08x :  %08x\n", offset,
> > @@ -330,8 +342,8 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
> >  	struct drm_i915_private *dev_priv = to_i915(dev);
> >  	struct drm_i915_error_state *error = error_priv->error;
> >  	struct drm_i915_error_object *obj;
> > -	int i, j, offset, elt;
> >  	int max_hangcheck_score;
> > +	int i, j;
> >  
> >  	if (!error) {
> >  		err_printf(m, "no error state collected\n");
> > @@ -446,15 +458,7 @@ int i915_error_state_to_str(struct drm_i915_error_state_buf *m,
> >  			err_printf(m, " --- gtt_offset = 0x%08x %08x\n",
> 
> If intended for userspace parsing "0x%08x %08x" vs. "0x%08x_%08x" would
> be good to be consistent. And to reduce such error in future, I'd also
> make this line be printed with above function (let there be extra
> space).

Yes, I remembered to fix that mistake only after sending the patches. :|

Combining this one is a bit trickier as it doesn't conform to the others.
For simplicity I left the custom header in the caller.
-Chris

-- 
Chris Wilson, Intel Open Source Technology Centre


More information about the Intel-gfx mailing list