[Intel-gfx] [PATCH 1/5] drm/i915/execlists: Skip redundant resubmission

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Oct 4 10:08:08 UTC 2019


On 03/10/2019 22:00, Chris Wilson wrote:
> If we unwind the active requests, and on resubmission discover that we
> intend to preempt the active context with itself, simply skip the ELSP
> submission.
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>   drivers/gpu/drm/i915/gt/intel_lrc.c | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c
> index 431d3b8c3371..3cfea1758fd2 100644
> --- a/drivers/gpu/drm/i915/gt/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c
> @@ -1739,11 +1739,26 @@ static void execlists_dequeue(struct intel_engine_cs *engine)
>   
>   	if (submit) {
>   		*port = execlists_schedule_in(last, port - execlists->pending);
> -		memset(port + 1, 0, (last_port - port) * sizeof(*port));
>   		execlists->switch_priority_hint =
>   			switch_prio(engine, *execlists->pending);
> +
> +		/*
> +		 * Skip if we ended up with exactly the same set of requests,
> +		 * e.g. trying to timeslice a pair of ordered contexts
> +		 */
> +		if (!memcmp(execlists->active, execlists->pending,
> +			    (port - execlists->pending + 1) * sizeof(*port))) {
> +			do
> +				execlists_schedule_out(fetch_and_zero(port));
> +			while (port-- != execlists->pending);
> +
> +			goto skip_submit;
> +		}
> +
> +		memset(port + 1, 0, (last_port - port) * sizeof(*port));
>   		execlists_submit_ports(engine);
>   	} else {
> +skip_submit:
>   		ring_set_paused(engine, 0);
>   	}
>   }
> 

A little bit of tracepoint noise with in/out but looks correct after I 
read the new code. And I wonder if trace.pl still works after last 
couple months of refactors.. :)

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the Intel-gfx mailing list