On Tue, Mar 22, 2016 at 05:16:52PM +0000, Tvrtko Ursulin wrote:
> From: Tvrtko Ursulin <[email protected]>
> 
> Since we write four times to the same register, caching
> the mmio register saves a tiny amount of generated code.

The compiler can't figure this out on its own?

> 
> Signed-off-by: Tvrtko Ursulin <[email protected]>
> ---
>  drivers/gpu/drm/i915/intel_lrc.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/intel_lrc.c 
> b/drivers/gpu/drm/i915/intel_lrc.c
> index e733795b57e0..6916991bdceb 100644
> --- a/drivers/gpu/drm/i915/intel_lrc.c
> +++ b/drivers/gpu/drm/i915/intel_lrc.c
> @@ -362,6 +362,7 @@ static void execlists_elsp_write(struct 
> drm_i915_gem_request *rq0,
>  
>       struct intel_engine_cs *engine = rq0->engine;
>       struct drm_i915_private *dev_priv = rq0->i915;
> +     i915_reg_t elsp_reg = RING_ELSP(engine);
>       uint64_t desc[2];
>  
>       if (rq1) {
> @@ -375,12 +376,12 @@ static void execlists_elsp_write(struct 
> drm_i915_gem_request *rq0,
>       rq0->elsp_submitted++;
>  
>       /* You must always write both descriptors in the order below. */
> -     I915_WRITE_FW(RING_ELSP(engine), upper_32_bits(desc[1]));
> -     I915_WRITE_FW(RING_ELSP(engine), lower_32_bits(desc[1]));
> +     I915_WRITE_FW(elsp_reg, upper_32_bits(desc[1]));
> +     I915_WRITE_FW(elsp_reg, lower_32_bits(desc[1]));
>  
> -     I915_WRITE_FW(RING_ELSP(engine), upper_32_bits(desc[0]));
> +     I915_WRITE_FW(elsp_reg, upper_32_bits(desc[0]));
>       /* The context is automatically loaded after the following */
> -     I915_WRITE_FW(RING_ELSP(engine), lower_32_bits(desc[0]));
> +     I915_WRITE_FW(elsp_reg, lower_32_bits(desc[0]));
>  
>       /* ELSP is a wo register, use another nearby reg for posting */
>       POSTING_READ_FW(RING_EXECLIST_STATUS_LO(engine));
> -- 
> 1.9.1
> 
> _______________________________________________
> Intel-gfx mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to