Re: [PATCH 06/10] drm/dp: switch drm_dp_vsc_sdp_log() to struct drm_printer

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

 



On Tue, 2024-01-16 at 15:07 +0200, Jani Nikula wrote:
> Use the existing drm printer infrastructure instead of local macros.
> 
> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
> ---
>  drivers/gpu/drm/display/drm_dp_helper.c       | 17 +++++-------
>  .../drm/i915/display/intel_crtc_state_dump.c  |  5 ++--
>  drivers/gpu/drm/i915/display/intel_display.c  | 27 +++++++++----------
>  include/drm/display/drm_dp_helper.h           |  3 +--
>  4 files changed, 23 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/gpu/drm/display/drm_dp_helper.c b/drivers/gpu/drm/display/drm_dp_helper.c
> index d72b6f9a352c..1cf51a748022 100644
> --- a/drivers/gpu/drm/display/drm_dp_helper.c
> +++ b/drivers/gpu/drm/display/drm_dp_helper.c
> @@ -2898,22 +2898,19 @@ static const char *dp_content_type_get_name(enum dp_content_type content_type)
>  	}
>  }
>  
> -void drm_dp_vsc_sdp_log(const char *level, struct device *dev,
> -			const struct drm_dp_vsc_sdp *vsc)
> +void drm_dp_vsc_sdp_log(struct drm_printer *p, const struct drm_dp_vsc_sdp *vsc)
>  {
> -#define DP_SDP_LOG(fmt, ...) dev_printk(level, dev, fmt, ##__VA_ARGS__)
> -	DP_SDP_LOG("DP SDP: %s, revision %u, length %u\n", "VSC",
> +	drm_printf(p, "DP SDP: VSC, revision %u, length %u\n",
>  		   vsc->revision, vsc->length);
> -	DP_SDP_LOG("    pixelformat: %s\n",
> +	drm_printf(p, "    pixelformat: %s\n",
>  		   dp_pixelformat_get_name(vsc->pixelformat));
> -	DP_SDP_LOG("    colorimetry: %s\n",
> +	drm_printf(p, "    colorimetry: %s\n",
>  		   dp_colorimetry_get_name(vsc->pixelformat, vsc->colorimetry));
> -	DP_SDP_LOG("    bpc: %u\n", vsc->bpc);
> -	DP_SDP_LOG("    dynamic range: %s\n",
> +	drm_printf(p, "    bpc: %u\n", vsc->bpc);
> +	drm_printf(p, "    dynamic range: %s\n",
>  		   dp_dynamic_range_get_name(vsc->dynamic_range));
> -	DP_SDP_LOG("    content type: %s\n",
> +	drm_printf(p, "    content type: %s\n",
>  		   dp_content_type_get_name(vsc->content_type));
> -#undef DP_SDP_LOG
>  }
>  EXPORT_SYMBOL(drm_dp_vsc_sdp_log);
>  
> diff --git a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
> index 49fd100ec98a..4bcf446c75f4 100644
> --- a/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
> +++ b/drivers/gpu/drm/i915/display/intel_crtc_state_dump.c
> @@ -55,10 +55,9 @@ static void
>  intel_dump_dp_vsc_sdp(struct drm_i915_private *i915,
>  		      const struct drm_dp_vsc_sdp *vsc)
>  {
> -	if (!drm_debug_enabled(DRM_UT_KMS))
> -		return;
> +	struct drm_printer p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
>  
> -	drm_dp_vsc_sdp_log(KERN_DEBUG, i915->drm.dev, vsc);
> +	drm_dp_vsc_sdp_log(&p, vsc);
>  }
>  
>  static void
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c
> index a92e959c8ac7..e1573e0a2661 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -4813,28 +4813,27 @@ pipe_config_infoframe_mismatch(struct drm_i915_private *dev_priv,
>  }
>  
>  static void
> -pipe_config_dp_vsc_sdp_mismatch(struct drm_i915_private *dev_priv,
> +pipe_config_dp_vsc_sdp_mismatch(struct drm_i915_private *i915,
>  				bool fastset, const char *name,
>  				const struct drm_dp_vsc_sdp *a,
>  				const struct drm_dp_vsc_sdp *b)
>  {
> +	struct drm_printer p;
> +
>  	if (fastset) {
> -		if (!drm_debug_enabled(DRM_UT_KMS))
> -			return;
> +		p = drm_dbg_printer(&i915->drm, DRM_UT_KMS, NULL);
>  
> -		drm_dbg_kms(&dev_priv->drm,
> -			    "fastset requirement not met in %s dp sdp\n", name);
> -		drm_dbg_kms(&dev_priv->drm, "expected:\n");
> -		drm_dp_vsc_sdp_log(KERN_DEBUG, dev_priv->drm.dev, a);
> -		drm_dbg_kms(&dev_priv->drm, "found:\n");
> -		drm_dp_vsc_sdp_log(KERN_DEBUG, dev_priv->drm.dev, b);
> +		drm_printf(&p, "fastset requirement not met in %s dp sdp\n", name);
>  	} else {
> -		drm_err(&dev_priv->drm, "mismatch in %s dp sdp\n", name);
> -		drm_err(&dev_priv->drm, "expected:\n");
> -		drm_dp_vsc_sdp_log(KERN_ERR, dev_priv->drm.dev, a);
> -		drm_err(&dev_priv->drm, "found:\n");
> -		drm_dp_vsc_sdp_log(KERN_ERR, dev_priv->drm.dev, b);
> +		p = drm_err_printer(&i915->drm, NULL);
> +
> +		drm_printf(&p, "mismatch in %s dp sdp\n", name);
>  	}
> +
> +	drm_printf(&p, "expected:\n");
> +	drm_dp_vsc_sdp_log(&p, a);
> +	drm_printf(&p, "found:\n");
> +	drm_dp_vsc_sdp_log(&p, b);
>  }
>  
>  /* Returns the length up to and including the last differing byte */
> diff --git a/include/drm/display/drm_dp_helper.h b/include/drm/display/drm_dp_helper.h
> index 863b2e7add29..d02014a87f12 100644
> --- a/include/drm/display/drm_dp_helper.h
> +++ b/include/drm/display/drm_dp_helper.h
> @@ -98,8 +98,7 @@ struct drm_dp_vsc_sdp {
>  	enum dp_content_type content_type;
>  };
>  
> -void drm_dp_vsc_sdp_log(const char *level, struct device *dev,
> -			const struct drm_dp_vsc_sdp *vsc);
> +void drm_dp_vsc_sdp_log(struct drm_printer *p, const struct drm_dp_vsc_sdp *vsc);
>  
>  int drm_dp_psr_setup_time(const u8 psr_cap[EDP_PSR_RECEIVER_CAP_SIZE]);
>  

Reviewed-by: Luca Coelho <luciano.coelho@xxxxxxxxx>

--
Cheers,
Luca.




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux