Re: [PATCH 1/3] drm/i915: Add HAS_DISPLAY() and use it

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

 



On Tue, Nov 20, 2018 at 02:32:40PM -0800, José Roberto de Souza wrote:
> Right now it is decided if GEN has display by checking the num_pipes,
> so lets make it explicit and use a macro.
> 
> Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>
> Cc: Jani Nikula <jani.nikula@xxxxxxxxx>
> Signed-off-by: José Roberto de Souza <jose.souza@xxxxxxxxx>

Reviewed-by: Lucas De Marchi <lucas.demarchi@xxxxxxxxx>

Lucas De Marchi

> ---
>  drivers/gpu/drm/i915/i915_drv.c          | 10 +++++-----
>  drivers/gpu/drm/i915/i915_drv.h          |  2 ++
>  drivers/gpu/drm/i915/intel_bios.c        |  2 +-
>  drivers/gpu/drm/i915/intel_device_info.c |  4 ++--
>  drivers/gpu/drm/i915/intel_display.c     |  4 ++--
>  drivers/gpu/drm/i915/intel_fbdev.c       |  2 +-
>  drivers/gpu/drm/i915/intel_i2c.c         |  2 +-
>  7 files changed, 14 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index b1d23c73c147..5e2d91f4dd2d 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -287,7 +287,7 @@ static void intel_detect_pch(struct drm_i915_private *dev_priv)
>  	 * Use PCH_NOP (PCH but no South Display) for PCH platforms without
>  	 * display.
>  	 */
> -	if (pch && INTEL_INFO(dev_priv)->num_pipes == 0) {
> +	if (pch && !HAS_DISPLAY(dev_priv)) {
>  		DRM_DEBUG_KMS("Display disabled, reverting to NOP PCH\n");
>  		dev_priv->pch_type = PCH_NOP;
>  		dev_priv->pch_id = 0;
> @@ -645,7 +645,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  	if (i915_inject_load_failure())
>  		return -ENODEV;
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes) {
> +	if (HAS_DISPLAY(dev_priv)) {
>  		ret = drm_vblank_init(&dev_priv->drm,
>  				      INTEL_INFO(dev_priv)->num_pipes);
>  		if (ret)
> @@ -696,7 +696,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
>  
>  	intel_overlay_setup(dev_priv);
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> +	if (!HAS_DISPLAY(dev_priv))
>  		return 0;
>  
>  	ret = intel_fbdev_init(dev);
> @@ -1551,7 +1551,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
>  	} else
>  		DRM_ERROR("Failed to register driver for userspace access!\n");
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes) {
> +	if (HAS_DISPLAY(dev_priv)) {
>  		/* Must be done after probing outputs */
>  		intel_opregion_register(dev_priv);
>  		acpi_video_register();
> @@ -1575,7 +1575,7 @@ static void i915_driver_register(struct drm_i915_private *dev_priv)
>  	 * We need to coordinate the hotplugs with the asynchronous fbdev
>  	 * configuration, for which we use the fbdev->async_cookie.
>  	 */
> -	if (INTEL_INFO(dev_priv)->num_pipes)
> +	if (HAS_DISPLAY(dev_priv))
>  		drm_kms_helper_poll_init(dev);
>  
>  	intel_power_domains_enable(dev_priv);
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 21e4405e2168..3cdbb3d074db 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2568,6 +2568,8 @@ intel_info(const struct drm_i915_private *dev_priv)
>  #define GT_FREQUENCY_MULTIPLIER 50
>  #define GEN9_FREQ_SCALER 3
>  
> +#define HAS_DISPLAY(dev_priv) (INTEL_INFO(dev_priv)->num_pipes > 0)
> +
>  #include "i915_trace.h"
>  
>  static inline bool intel_vtd_active(void)
> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
> index 0694aa8bb9bc..6d3e0260d49c 100644
> --- a/drivers/gpu/drm/i915/intel_bios.c
> +++ b/drivers/gpu/drm/i915/intel_bios.c
> @@ -1752,7 +1752,7 @@ void intel_bios_init(struct drm_i915_private *dev_priv)
>  	const struct bdb_header *bdb;
>  	u8 __iomem *bios = NULL;
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0) {
> +	if (!HAS_DISPLAY(dev_priv)) {
>  		DRM_DEBUG_KMS("Skipping VBT init due to disabled display.\n");
>  		return;
>  	}
> diff --git a/drivers/gpu/drm/i915/intel_device_info.c b/drivers/gpu/drm/i915/intel_device_info.c
> index ceecb5bd5226..677002a9e893 100644
> --- a/drivers/gpu/drm/i915/intel_device_info.c
> +++ b/drivers/gpu/drm/i915/intel_device_info.c
> @@ -782,7 +782,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
>  	if (i915_modparams.disable_display) {
>  		DRM_INFO("Display disabled (module parameter)\n");
>  		info->num_pipes = 0;
> -	} else if (info->num_pipes > 0 &&
> +	} else if (HAS_DISPLAY(dev_priv) &&
>  		   (IS_GEN7(dev_priv) || IS_GEN8(dev_priv)) &&
>  		   HAS_PCH_SPLIT(dev_priv)) {
>  		u32 fuse_strap = I915_READ(FUSE_STRAP);
> @@ -807,7 +807,7 @@ void intel_device_info_runtime_init(struct intel_device_info *info)
>  			DRM_INFO("PipeC fused off\n");
>  			info->num_pipes -= 1;
>  		}
> -	} else if (info->num_pipes > 0 && IS_GEN9(dev_priv)) {
> +	} else if (HAS_DISPLAY(dev_priv) && IS_GEN9(dev_priv)) {
>  		u32 dfsm = I915_READ(SKL_DFSM);
>  		u8 disabled_mask = 0;
>  		bool invalid;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 132e978227fb..d48f62ec0d7d 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -14155,7 +14155,7 @@ static void intel_setup_outputs(struct drm_i915_private *dev_priv)
>  
>  	intel_pps_init(dev_priv);
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> +	if (!HAS_DISPLAY(dev_priv))
>  		return;
>  
>  	/*
> @@ -16027,7 +16027,7 @@ intel_display_capture_error_state(struct drm_i915_private *dev_priv)
>  	};
>  	int i;
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> +	if (!HAS_DISPLAY(dev_priv))
>  		return NULL;
>  
>  	error = kzalloc(sizeof(*error), GFP_ATOMIC);
> diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c
> index 2480c7d6edee..fb5bb5b32a60 100644
> --- a/drivers/gpu/drm/i915/intel_fbdev.c
> +++ b/drivers/gpu/drm/i915/intel_fbdev.c
> @@ -672,7 +672,7 @@ int intel_fbdev_init(struct drm_device *dev)
>  	struct intel_fbdev *ifbdev;
>  	int ret;
>  
> -	if (WARN_ON(INTEL_INFO(dev_priv)->num_pipes == 0))
> +	if (WARN_ON(!HAS_DISPLAY(dev_priv)))
>  		return -ENODEV;
>  
>  	ifbdev = kzalloc(sizeof(struct intel_fbdev), GFP_KERNEL);
> diff --git a/drivers/gpu/drm/i915/intel_i2c.c b/drivers/gpu/drm/i915/intel_i2c.c
> index 33d87ab93fdd..802d0394ccc4 100644
> --- a/drivers/gpu/drm/i915/intel_i2c.c
> +++ b/drivers/gpu/drm/i915/intel_i2c.c
> @@ -817,7 +817,7 @@ int intel_setup_gmbus(struct drm_i915_private *dev_priv)
>  	unsigned int pin;
>  	int ret;
>  
> -	if (INTEL_INFO(dev_priv)->num_pipes == 0)
> +	if (!HAS_DISPLAY(dev_priv))
>  		return 0;
>  
>  	if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv))
> -- 
> 2.19.1
> 
_______________________________________________
Intel-gfx mailing list
Intel-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/intel-gfx




[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux