On Fri, Mar 27, 2015 at 11:02:01AM +0000, Chris Wilson wrote:
> The multiple levels of indirect do nothing but hinder the compiler and
> the pointer chasing turns to be quite painful but painless to fix.
> 
> Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>

Hm I did a quick git grep when this came up a few days back on irc, and
just removing the checks from the execbuf hotpaths looked like the simpler
approach. We don't need them, since NORMAL_VIEW == 0 is intentional.

There's still some left afterwards ofc, but no check beats even a fast
check ;-)
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.h     | 4 +---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 1 +
>  drivers/gpu/drm/i915/i915_gem_gtt.h | 2 ++
>  3 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b728250d6550..209c9b612509 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2880,9 +2880,7 @@ bool i915_gem_obj_is_pinned(struct drm_i915_gem_object 
> *obj);
>       (&((struct drm_i915_private *)(obj)->base.dev->dev_private)->gtt.base)
>  static inline bool i915_is_ggtt(struct i915_address_space *vm)
>  {
> -     struct i915_address_space *ggtt =
> -             &((struct drm_i915_private *)(vm)->dev->dev_private)->gtt.base;
> -     return vm == ggtt;
> +     return vm->is_ggtt;
>  }
>  
>  static inline struct i915_hw_ppgtt *
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c 
> b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index e33b1214c4d8..68c1f49f2864 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -2504,6 +2504,7 @@ int i915_gem_gtt_init(struct drm_device *dev)
>               return ret;
>  
>       gtt->base.dev = dev;
> +     gtt->base.is_ggtt = true;
>  
>       /* GMADR is the PCI mmio aperture into the global GTT. */
>       DRM_INFO("Memory usable by graphics device = %zdM\n",
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.h 
> b/drivers/gpu/drm/i915/i915_gem_gtt.h
> index 3f0ad9f25441..20398a18a8a6 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.h
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.h
> @@ -234,6 +234,8 @@ struct i915_address_space {
>       unsigned long start;            /* Start offset always 0 for dri2 */
>       size_t total;           /* size addr space maps (ex. 2GB for ggtt) */
>  
> +     bool is_ggtt;
> +
>       struct {
>               dma_addr_t addr;
>               struct page *page;
> -- 
> 2.1.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to