[Intel-gfx] [PATCH 11/18] drm/i915: Record space required for request emission

Joonas Lahtinen joonas.lahtinen at linux.intel.com
Mon Sep 19 10:47:30 UTC 2016


On ke, 2016-09-14 at 07:52 +0100, Chris Wilson wrote:
> @@ -1572,6 +1572,8 @@ static int gen8_emit_request(struct drm_i915_gem_request *request)
>  	return intel_logical_ring_advance(request);
>  }
>  
> +static const int gen8_emit_request_sz = 6 + WA_TAIL_DWORDS;

Could argue these to be #define by current convention.

> @@ -1677,6 +1681,7 @@ logical_ring_default_vfuncs(struct intel_engine_cs *engine)
>  	engine->reset_hw = reset_common_ring;
>  	engine->emit_flush = gen8_emit_flush;
>  	engine->emit_request = gen8_emit_request;
> +	engine->emit_request_sz = gen8_emit_request_sz;

This assignment would then stand out better too, now it looks like a
bunch of function assignments.

> @@ -2677,8 +2681,21 @@ static void intel_ring_default_vfuncs(struct drm_i915_private *dev_priv,
>  	engine->reset_hw = reset_ring_common;
>  
>  	engine->emit_request = i9xx_emit_request;
> -	if (i915.semaphores)
> +	engine->emit_request_sz = i9xx_emit_request_sz;
> +	if (i915.semaphores) {
> +		int num_rings;

'initialized_rings' to differentiate as suggested by Tvrtko too.

> +
>  		engine->emit_request = gen6_sema_emit_request;
> +
> +		num_rings = hweight32(INTEL_INFO(dev_priv)->ring_mask) - 1;
> +		if (INTEL_GEN(dev_priv) >= 8) {
> +			engine->emit_request_sz += num_rings * 6;
> +		} else {
> +			engine->emit_request_sz += num_rings * 3;
> +			if (num_rings & 1)
> +				engine->emit_request_sz++;

Please do add a comment explaining this.

Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>

Regards, Joonas
-- 
Joonas Lahtinen
Open Source Technology Center
Intel Corporation


More information about the Intel-gfx mailing list