[Intel-gfx] [PATCH 1/6] drm/i915: Reinitialize default context after reset

Volkin, Bradley D bradley.d.volkin at intel.com
Fri Sep 19 19:46:15 CEST 2014


[snip]

On Thu, Sep 18, 2014 at 07:58:30AM -0700, Mika Kuoppala wrote:
> @@ -577,7 +596,7 @@ static int do_switch(struct intel_engine_cs *ring,
>  		vma->bind_vma(vma, to->legacy_hw_ctx.rcs_state->cache_level, GLOBAL_BIND);
>  	}
>  
> -	if (!to->legacy_hw_ctx.initialized || i915_gem_context_is_default(to))
> +	if (!to->initialized || i915_gem_context_is_default(to))
>  		hw_flags |= MI_RESTORE_INHIBIT;
>  
>  	ret = mi_set_context(ring, to, hw_flags);
> @@ -618,26 +637,19 @@ static int do_switch(struct intel_engine_cs *ring,
>  		/* obj is kept alive until the next request by its active ref */
>  		i915_gem_object_ggtt_unpin(from->legacy_hw_ctx.rcs_state);
>  		i915_gem_context_unreference(from);
> -	}
>  
> -	uninitialized = !to->legacy_hw_ctx.initialized && from == NULL;
> -	to->legacy_hw_ctx.initialized = true;
> +		/* We inherit the state from the previous context */
> +		to->initialized = true;
> +	}

Regarding these two hunks, I may have asked this question before but if
so I've forgotten the answer. Why do we want to set MI_RESTORE_INHIBIT
when switching to the default context? Why do we want to inherit state
from the previous context?

I assumed that when switching to an initialized context we would always
want to restore its last state.

Thanks,
Brad



More information about the Intel-gfx mailing list