[Intel-gfx] [PATCH 24/25] drm/i915: add has_turbo bit to driver info struct

Daniel Vetter daniel at ffwll.ch
Wed Mar 21 22:43:39 CET 2012


On Wed, Mar 21, 2012 at 12:48:45PM -0700, Jesse Barnes wrote:
> Since ValleyView is a gen7 chip but doesn't have the same turbo interface.
> 
> Signed-off-by: Jesse Barnes <jbarnes at virtuousgeek.org>

Commit headline is imo misleading - effectively the patch disables turbo
on vlv. Then msg body could then elaborate that we do this with a feature
flag. For this specific case where we have just 2 if blocks (you've missed
the disable_rps btw) I don't think it's worth it to add a feature flag.
Normal if cascade like

if (IS_ILK)
else if (IS_VLV)
else if (IS_GEN6 || IS_GEN7)

should do the trick without confusing anyone. And we avoid having to jump
through a few indirections when rechecking the code.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.c      |    4 ++++
>  drivers/gpu/drm/i915/i915_drv.h      |    2 ++
>  drivers/gpu/drm/i915/intel_display.c |    2 +-
>  3 files changed, 7 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index 48fc5ab..6c92ded 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -220,6 +220,7 @@ static const struct intel_device_info intel_sandybridge_d_info = {
>  	.has_bsd_ring = 1,
>  	.has_blt_ring = 1,
>  	.has_llc = 1,
> +	.has_turbo = 1,
>  };
>  
>  static const struct intel_device_info intel_sandybridge_m_info = {
> @@ -229,6 +230,7 @@ static const struct intel_device_info intel_sandybridge_m_info = {
>  	.has_bsd_ring = 1,
>  	.has_blt_ring = 1,
>  	.has_llc = 1,
> +	.has_turbo = 1,
>  };
>  
>  static const struct intel_device_info intel_ivybridge_d_info = {
> @@ -237,6 +239,7 @@ static const struct intel_device_info intel_ivybridge_d_info = {
>  	.has_bsd_ring = 1,
>  	.has_blt_ring = 1,
>  	.has_llc = 1,
> +	.has_turbo = 1,
>  };
>  
>  static const struct intel_device_info intel_ivybridge_m_info = {
> @@ -246,6 +249,7 @@ static const struct intel_device_info intel_ivybridge_m_info = {
>  	.has_bsd_ring = 1,
>  	.has_blt_ring = 1,
>  	.has_llc = 1,
> +	.has_turbo = 1,
>  };
>  
>  static const struct intel_device_info intel_valleyview_m_info = {
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 178a955..024f574 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -266,6 +266,7 @@ struct intel_device_info {
>  	u8 has_bsd_ring:1;
>  	u8 has_blt_ring:1;
>  	u8 has_llc:1;
> +	u8 has_turbo:1;
>  };
>  
>  #define I915_PPGTT_PD_ENTRIES 512
> @@ -1025,6 +1026,7 @@ struct drm_i915_file_private {
>  #define HAS_BSD(dev)            (INTEL_INFO(dev)->has_bsd_ring)
>  #define HAS_BLT(dev)            (INTEL_INFO(dev)->has_blt_ring)
>  #define HAS_LLC(dev)            (INTEL_INFO(dev)->has_llc)
> +#define HAS_TURBO(dev)		(INTEL_INFO(dev)->has_turbo)
>  #define I915_NEED_GFX_HWS(dev)	(INTEL_INFO(dev)->need_gfx_hws)
>  
>  #define HAS_ALIASING_PPGTT(dev)	(INTEL_INFO(dev)->gen >=6)
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 8668d38..dc0ef17 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -9715,7 +9715,7 @@ void intel_modeset_init(struct drm_device *dev)
>  		intel_init_emon(dev);
>  	}
>  
> -	if (IS_GEN6(dev) || IS_GEN7(dev)) {
> +	if (HAS_TURBO(dev)) {
>  		gen6_enable_rps(dev_priv);
>  		gen6_update_ring_freq(dev_priv);
>  	}
> -- 
> 1.7.5.4
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Mail: daniel at ffwll.ch
Mobile: +41 (0)79 365 57 48



More information about the Intel-gfx mailing list