Re: [PATCH 4/6] drm/i915: Record the default hw state after reset upon load

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

 



On Thu, 2017-11-02 at 12:42 +0000, Chris Wilson wrote:
> Take a copy of the HW state after a reset upon module loading by
> executing a context switch from a blank context to the kernel context,
> thus saving the default hw state over the blank context image.
> We can then use the default hw state to initialise any future context,
> ensuring that each starts with the default view of hw state.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>

<SNIP>

> @@ -795,11 +770,7 @@ static int do_rcs_switch(struct drm_i915_gem_request *req)
>  			return ret;
>  	}
>  
> -	if (!to->engine[RCS].initialised || i915_gem_context_is_default(to))
> -		/* NB: If we inhibit the restore, the context is not allowed to
> -		 * die because future work may end up depending on valid address
> -		 * space. This means we must enforce that a page table load
> -		 * occur when this occurs. */

Maybe add a comment explaining that we never ever assume execution on
the kernel context, so we don't care about the register state.

> +	if (i915_gem_context_is_kernel(to))
>  		hw_flags = MI_RESTORE_INHIBIT;
>  	else if (ppgtt && intel_engine_flag(engine) & ppgtt->pd_dirty_rings)
>  		hw_flags = MI_FORCE_RESTORE;

<SNIP>

> @@ -2193,11 +2184,28 @@ populate_lr_context(struct i915_gem_context *ctx,
>  	}
>  	ctx_obj->mm.dirty = true;
>  
> +	if (engine->default_state) {
> +		void *defaults;
> +
> +		defaults = i915_gem_object_pin_map(engine->default_state,
> +						   I915_MAP_WB);
> +		if (IS_ERR(defaults))
> +			return PTR_ERR(defaults);
> +
> +		memcpy(vaddr + LRC_HEADER_PAGES * PAGE_SIZE,
> +		       defaults + LRC_HEADER_PAGES * PAGE_SIZE,

Could use somethingsomething_offset variable.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
_______________________________________________
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