[Intel-gfx] [PATCH] drm/i915: Remove duplicate intel_logical_ring_workarounds_emit

Mika Kuoppala mika.kuoppala at linux.intel.com
Tue Feb 14 15:08:27 UTC 2017


Tvrtko Ursulin <tursulin at ursulin.net> writes:

> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>
> intel_ring_workarounds_emit is exactly the same code.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

This was entertaining.

Reviewed-by: Mika Kuoppala <mika.kuoppala at intel.com>

> ---
>  drivers/gpu/drm/i915/intel_lrc.c        | 35 +--------------------------------
>  drivers/gpu/drm/i915/intel_ringbuffer.c |  2 +-
>  drivers/gpu/drm/i915/intel_ringbuffer.h |  1 +
>  3 files changed, 3 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
> index f567d4b08863..ee431d39ce06 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -890,39 +890,6 @@ static int execlists_request_alloc(struct drm_i915_gem_request *request)
>  	return ret;
>  }
>  
> -static int intel_logical_ring_workarounds_emit(struct drm_i915_gem_request *req)
> -{
> -	struct i915_workarounds *w = &req->i915->workarounds;
> -	u32 *cs;
> -	int ret, i;
> -
> -	if (w->count == 0)
> -		return 0;
> -
> -	ret = req->engine->emit_flush(req, EMIT_BARRIER);
> -	if (ret)
> -		return ret;
> -
> -	cs = intel_ring_begin(req, w->count * 2 + 2);
> -	if (IS_ERR(cs))
> -		return PTR_ERR(cs);
> -
> -	*cs++ = MI_LOAD_REGISTER_IMM(w->count);
> -	for (i = 0; i < w->count; i++) {
> -		*cs++ = i915_mmio_reg_offset(w->reg[i].addr);
> -		*cs++ = w->reg[i].value;
> -	}
> -	*cs++ = MI_NOOP;
> -
> -	intel_ring_advance(req, cs);
> -
> -	ret = req->engine->emit_flush(req, EMIT_BARRIER);
> -	if (ret)
> -		return ret;
> -
> -	return 0;
> -}
> -
>  #define wa_ctx_emit(batch, index, cmd)					\
>  	do {								\
>  		int __index = (index)++;				\
> @@ -1672,7 +1639,7 @@ static int gen8_init_rcs_context(struct drm_i915_gem_request *req)
>  {
>  	int ret;
>  
> -	ret = intel_logical_ring_workarounds_emit(req);
> +	ret = intel_ring_workarounds_emit(req);
>  	if (ret)
>  		return ret;
>  
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.c b/drivers/gpu/drm/i915/intel_ringbuffer.c
> index 0b9030c36625..ff0ecac6ff38 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.c
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.c
> @@ -644,7 +644,7 @@ static void reset_ring_common(struct intel_engine_cs *engine,
>  	}
>  }
>  
> -static int intel_ring_workarounds_emit(struct drm_i915_gem_request *req)
> +int intel_ring_workarounds_emit(struct drm_i915_gem_request *req)
>  {
>  	struct i915_workarounds *w = &req->i915->workarounds;
>  	u32 *cs;
> diff --git a/drivers/gpu/drm/i915/intel_ringbuffer.h b/drivers/gpu/drm/i915/intel_ringbuffer.h
> index 4350713dbc58..16714096810d 100644
> --- a/drivers/gpu/drm/i915/intel_ringbuffer.h
> +++ b/drivers/gpu/drm/i915/intel_ringbuffer.h
> @@ -560,6 +560,7 @@ static inline u32 intel_engine_last_submit(struct intel_engine_cs *engine)
>  }
>  
>  int init_workarounds_ring(struct intel_engine_cs *engine);
> +int intel_ring_workarounds_emit(struct drm_i915_gem_request *req);
>  
>  void intel_engine_get_instdone(struct intel_engine_cs *engine,
>  			       struct intel_instdone *instdone);
> -- 
> 2.9.3
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx


More information about the Intel-gfx mailing list