Re: [PATCH] drm/i915: Inline feature detection into sanitize_enable_ppgtt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Sep 19, 2014 at 11:56:27AM +0100, Chris Wilson wrote:
> Rather than splitting and hiding away critical parts of
> sanitize_enable_ppgtt() into single use macros in the headers, inline
> them into the function for clarity.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> ---
>  drivers/gpu/drm/i915/i915_drv.h     |  2 --
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 14 +++++++++++---
>  2 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 07dafa2c2d8c..b1fa13942d14 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2139,8 +2139,6 @@ struct drm_i915_cmd_table {
>  
>  #define HAS_HW_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 6)
>  #define HAS_LOGICAL_RING_CONTEXTS(dev)	(INTEL_INFO(dev)->gen >= 8)
> -#define HAS_ALIASING_PPGTT(dev)	(INTEL_INFO(dev)->gen >= 6)
> -#define HAS_PPGTT(dev)		(INTEL_INFO(dev)->gen >= 7 && !IS_GEN8(dev))
>  #define USES_PPGTT(dev)		(i915.enable_ppgtt)
>  #define USES_FULL_PPGTT(dev)	(i915.enable_ppgtt == 2)
>  
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index a234446a8678..90c9bf6e71b7 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -35,13 +35,21 @@ static void chv_setup_private_ppat(struct drm_i915_private *dev_priv);
>  
>  static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
>  {
> -	if (enable_ppgtt == 0 || !HAS_ALIASING_PPGTT(dev))
> +	bool has_aliasing_ppgtt;
> +	bool has_full_ppgtt;
> +
> +	has_aliasing_ppgtt = INTEL_INFO(dev)->gen >= 6;
> +	has_full_ppgtt = INTEL_INFO(dev)->gen >= 7;
> +	if (IS_GEN8(dev))
> +		has_full_ppgtt = false; /* XXX why? */

Becuase we've had a crazy mix of feature macros which also encoded
defaults. But now that's fixed, so we could replace this by a comment
saying that full ppgtt upsets the hw without execlist.

Queued for -next, thanks for the patch.
-Daniel

> +
> +	if (enable_ppgtt == 0 || !has_aliasing_ppgtt)
>  		return 0;
>  
>  	if (enable_ppgtt == 1)
>  		return 1;
>  
> -	if (enable_ppgtt == 2 && HAS_PPGTT(dev))
> +	if (enable_ppgtt == 2 && has_full_ppgtt)
>  		return 2;
>  
>  #ifdef CONFIG_INTEL_IOMMU
> @@ -59,7 +67,7 @@ static int sanitize_enable_ppgtt(struct drm_device *dev, int enable_ppgtt)
>  		return 0;
>  	}
>  
> -	return HAS_PPGTT(dev) ? 2 : HAS_ALIASING_PPGTT(dev) ? 1 : 0;
> +	return has_full_ppgtt ? 2 : has_aliasing_ppgtt ? 1 : 0;
>  }
>  
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux