[PATCH 1/2] drm/i915: remove IS_LP()

Ville Syrjälä ville.syrjala at linux.intel.com
Wed Sep 18 17:58:50 UTC 2024


On Wed, Sep 18, 2024 at 05:50:41PM +0300, Jani Nikula wrote:
> The .is_lp member of struct intel_device_info and its wrapper IS_LP()
> are used to identify just four platforms, VLV/CHV/BXT/GLK. It didn't
> become as important as it was perhaps originally planned. Just remove
> it, and replace with exact platform identification. In a few places this
> becomes slightly verbose, but in many places it improves clarity to
> immediately see the exact platforms.
> 
> Additionally, this lets us remove the xe compat macro.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_device.h | 2 +-
>  drivers/gpu/drm/i915/display/intel_dpll.c           | 7 +++++--
>  drivers/gpu/drm/i915/display/intel_pps.c            | 4 +++-
>  drivers/gpu/drm/i915/gem/i915_gem_stolen.c          | 2 +-
>  drivers/gpu/drm/i915/i915_drv.h                     | 5 ++---
>  drivers/gpu/drm/i915/i915_pci.c                     | 3 ---
>  drivers/gpu/drm/i915/intel_device_info.h            | 1 -
>  drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h   | 1 -
>  8 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_device.h b/drivers/gpu/drm/i915/display/intel_display_device.h
> index 5306bbd13e59..54dc95f7535b 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_device.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_device.h
> @@ -150,7 +150,7 @@ enum intel_display_subplatform {
>  #define HAS_PSR(i915)			(DISPLAY_INFO(i915)->has_psr)
>  #define HAS_PSR_HW_TRACKING(i915)	(DISPLAY_INFO(i915)->has_psr_hw_tracking)
>  #define HAS_PSR2_SEL_FETCH(i915)	(DISPLAY_VER(i915) >= 12)
> -#define HAS_SAGV(i915)			(DISPLAY_VER(i915) >= 9 && !IS_LP(i915))
> +#define HAS_SAGV(i915)			(DISPLAY_VER(i915) >= 9 && !IS_BROXTON(i915) && !IS_GEMINILAKE(i915))
>  #define HAS_TRANSCODER(i915, trans)	((DISPLAY_RUNTIME_INFO(i915)->cpu_transcoder_mask & \
>  					  BIT(trans)) != 0)
>  #define HAS_UNCOMPRESSED_JOINER(i915)	(DISPLAY_VER(i915) >= 13)
> diff --git a/drivers/gpu/drm/i915/display/intel_dpll.c b/drivers/gpu/drm/i915/display/intel_dpll.c
> index 38e34b72bc4e..b679c5391fe6 100644
> --- a/drivers/gpu/drm/i915/display/intel_dpll.c
> +++ b/drivers/gpu/drm/i915/display/intel_dpll.c
> @@ -589,11 +589,14 @@ static bool intel_pll_is_valid(struct drm_i915_private *dev_priv,
>  	if (clock->m1 < limit->m1.min || limit->m1.max < clock->m1)
>  		return false;
>  
> -	if (!IS_PINEVIEW(dev_priv) && !IS_LP(dev_priv))
> +	if (!IS_PINEVIEW(dev_priv) &&
> +	    !IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) &&
> +	    !IS_BROXTON(dev_priv) && !IS_GEMINILAKE(dev_priv))
>  		if (clock->m1 <= clock->m2)
>  			return false;
>  
> -	if (!IS_LP(dev_priv)) {
> +	if (!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) &&
> +	    !IS_BROXTON(dev_priv) && !IS_GEMINILAKE(dev_priv)) {
>  		if (clock->p < limit->p.min || limit->p.max < clock->p)
>  			return false;
>  		if (clock->m < limit->m.min || limit->m.max < clock->m)
> diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c
> index cdbac9f5a14c..cb1e0992b759 100644
> --- a/drivers/gpu/drm/i915/display/intel_pps.c
> +++ b/drivers/gpu/drm/i915/display/intel_pps.c
> @@ -453,7 +453,9 @@ void intel_pps_reset_all(struct intel_display *display)
>  	struct drm_i915_private *dev_priv = to_i915(display->drm);
>  	struct intel_encoder *encoder;
>  
> -	if (drm_WARN_ON(display->drm, !IS_LP(dev_priv)))
> +	if (drm_WARN_ON(display->drm,
> +			!IS_VALLEYVIEW(dev_priv) && !IS_CHERRYVIEW(dev_priv) &&
> +			!IS_BROXTON(dev_priv) && !IS_GEMINILAKE(dev_priv)))
>  		return;
>  
>  	if (!HAS_DISPLAY(display))
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> index d29005980806..9d958a6f377e 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_stolen.c
> @@ -457,7 +457,7 @@ static int init_reserved_stolen(struct drm_i915_private *i915)
>  		icl_get_stolen_reserved(i915, uncore,
>  					&reserved_base, &reserved_size);
>  	} else if (GRAPHICS_VER(i915) >= 8) {
> -		if (IS_LP(i915))
> +		if (IS_CHERRYVIEW(i915) || IS_BROXTON(i915) || IS_GEMINILAKE(i915))
>  			chv_get_stolen_reserved(i915, uncore,
>  						&reserved_base, &reserved_size);
>  		else

side note: someone should probably flatten the pointlessly
nested if ladder...

Patch is
Reviewed-by: Ville Syrjälä <ville.syrjala at linux.intel.com>

> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index def3ca135406..3c4b106cc7a0 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -612,9 +612,8 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,
>  #define IS_TIGERLAKE_UY(i915) \
>  	IS_SUBPLATFORM(i915, INTEL_TIGERLAKE, INTEL_SUBPLATFORM_UY)
>  
> -#define IS_LP(i915)		(INTEL_INFO(i915)->is_lp)
> -#define IS_GEN9_LP(i915)	(GRAPHICS_VER(i915) == 9 && IS_LP(i915))
> -#define IS_GEN9_BC(i915)	(GRAPHICS_VER(i915) == 9 && !IS_LP(i915))
> +#define IS_GEN9_LP(i915)	(IS_BROXTON(i915) || IS_GEMINILAKE(i915))
> +#define IS_GEN9_BC(i915)	(GRAPHICS_VER(i915) == 9 && !IS_GEN9_LP(i915))
>  
>  #define __HAS_ENGINE(engine_mask, id) ((engine_mask) & BIT(id))
>  #define HAS_ENGINE(gt, id) __HAS_ENGINE((gt)->info.engine_mask, id)
> diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
> index 617f411feb8c..eaf8a098e1c5 100644
> --- a/drivers/gpu/drm/i915/i915_pci.c
> +++ b/drivers/gpu/drm/i915/i915_pci.c
> @@ -367,7 +367,6 @@ static const struct intel_device_info ivb_q_info = {
>  static const struct intel_device_info vlv_info = {
>  	PLATFORM(INTEL_VALLEYVIEW),
>  	GEN(7),
> -	.is_lp = 1,
>  	.has_runtime_pm = 1,
>  	.has_rc6 = 1,
>  	.has_reset_engine = true,
> @@ -451,7 +450,6 @@ static const struct intel_device_info bdw_gt3_info = {
>  static const struct intel_device_info chv_info = {
>  	PLATFORM(INTEL_CHERRYVIEW),
>  	GEN(8),
> -	.is_lp = 1,
>  	.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0),
>  	.has_64bit_reloc = 1,
>  	.has_runtime_pm = 1,
> @@ -512,7 +510,6 @@ static const struct intel_device_info skl_gt4_info = {
>  
>  #define GEN9_LP_FEATURES \
>  	GEN(9), \
> -	.is_lp = 1, \
>  	.platform_engine_mask = BIT(RCS0) | BIT(VCS0) | BIT(BCS0) | BIT(VECS0), \
>  	.has_3d_pipeline = 1, \
>  	.has_64bit_reloc = 1, \
> diff --git a/drivers/gpu/drm/i915/intel_device_info.h b/drivers/gpu/drm/i915/intel_device_info.h
> index 643ff1bf74ee..4f4aa4ff9963 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.h
> +++ b/drivers/gpu/drm/i915/intel_device_info.h
> @@ -138,7 +138,6 @@ enum intel_ppgtt_type {
>  
>  #define DEV_INFO_FOR_EACH_FLAG(func) \
>  	func(is_mobile); \
> -	func(is_lp); \
>  	func(require_force_probe); \
>  	func(is_dgfx); \
>  	/* Keep has_* in alphabetical order */ \
> diff --git a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
> index f27a2c75b56d..c43673bcecde 100644
> --- a/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
> +++ b/drivers/gpu/drm/xe/compat-i915-headers/i915_drv.h
> @@ -75,7 +75,6 @@ static inline struct drm_i915_private *to_i915(const struct drm_device *dev)
>  
>  #define IS_MOBILE(xe) (xe && 0)
>  
> -#define IS_LP(xe) ((xe) && 0)
>  #define IS_GEN9_LP(xe) ((xe) && 0)
>  #define IS_GEN9_BC(xe) ((xe) && 0)
>  
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list