Re: [Intel-gfx] [PATCH v3 v2 4/5] drm/i915: add pipe id/name to pipe mismatch logs

2019-10-15 Thread Ville Syrjälä
On Tue, Oct 15, 2019 at 09:40:28AM -0700, Lucas De Marchi wrote:
> This way it's easier to figure out what didn't match when we have
> multiple pipes enabled.
> 
> v2: pass drm_crtc and use the more common [CRTC:%d:%s] format
> (Ville)
> 
> Signed-off-by: Lucas De Marchi 
> ---
>  drivers/gpu/drm/i915/display/intel_display.c | 34 +++-
>  1 file changed, 19 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
> b/drivers/gpu/drm/i915/display/intel_display.c
> index e71ec9d96c75..cd0f600e0205 100644
> --- a/drivers/gpu/drm/i915/display/intel_display.c
> +++ b/drivers/gpu/drm/i915/display/intel_display.c
> @@ -12526,8 +12526,9 @@ pipe_config_infoframe_mismatch(struct 
> drm_i915_private *dev_priv,
>   }
>  }
>  
> -static void __printf(3, 4)
> -pipe_config_mismatch(bool fastset, const char *name, const char *format, ...)
> +static void __printf(4, 5)
> +pipe_config_mismatch(bool fastset, const struct drm_crtc *crtc,
> +  const char *name, const char *format, ...)
>  {
>   struct va_format vaf;
>   va_list args;
> @@ -12537,9 +12538,11 @@ pipe_config_mismatch(bool fastset, const char *name, 
> const char *format, ...)
>   vaf.va = 
>  
>   if (fastset)
> - DRM_DEBUG_KMS("fastset mismatch in %s %pV\n", name, );
> + DRM_DEBUG_KMS("[CRTC:%d:%s] fastset mismatch in %s %pV\n",
> +   crtc->base.id, crtc->name, name, );
>   else
> - DRM_ERROR("mismatch in %s %pV\n", name, );
> + DRM_ERROR("[CRTC:%d:%s] mismatch in %s %pV\n",
> +   crtc->base.id, crtc->name, name, );
>  
>   va_end(args);
>  }
> @@ -12567,6 +12570,7 @@ intel_pipe_config_compare(const struct 
> intel_crtc_state *current_config,
> bool fastset)
>  {
>   struct drm_i915_private *dev_priv = 
> to_i915(current_config->base.crtc->dev);
> + const struct drm_crtc *crtc = pipe_config->base.crtc;

The only thing we really const these days is the states. So I'd drop the
const here.

Also pls make it struct intel_crtc since we're trying to get rid of
this mess with both drm_ and intel_ types getting mixed around randomly.

with that
Reviewed-by: Ville Syrjälä 

>   bool ret = true;
>   u32 bp_gamma = 0;
>   bool fixup_inherited = fastset &&
> @@ -12580,7 +12584,7 @@ intel_pipe_config_compare(const struct 
> intel_crtc_state *current_config,
>  
>  #define PIPE_CONF_CHECK_X(name) do { \
>   if (current_config->name != pipe_config->name) { \
> - pipe_config_mismatch(fastset, __stringify(name), \
> + pipe_config_mismatch(fastset, crtc, __stringify(name), \
>"(expected 0x%08x, found 0x%08x)", \
>current_config->name, \
>pipe_config->name); \
> @@ -12590,7 +12594,7 @@ intel_pipe_config_compare(const struct 
> intel_crtc_state *current_config,
>  
>  #define PIPE_CONF_CHECK_I(name) do { \
>   if (current_config->name != pipe_config->name) { \
> - pipe_config_mismatch(fastset, __stringify(name), \
> + pipe_config_mismatch(fastset, crtc, __stringify(name), \
>"(expected %i, found %i)", \
>current_config->name, \
>pipe_config->name); \
> @@ -12600,7 +12604,7 @@ intel_pipe_config_compare(const struct 
> intel_crtc_state *current_config,
>  
>  #define PIPE_CONF_CHECK_BOOL(name) do { \
>   if (current_config->name != pipe_config->name) { \
> - pipe_config_mismatch(fastset, __stringify(name), \
> + pipe_config_mismatch(fastset, crtc,  __stringify(name), \
>"(expected %s, found %s)", \
>yesno(current_config->name), \
>yesno(pipe_config->name)); \
> @@ -12617,7 +12621,7 @@ intel_pipe_config_compare(const struct 
> intel_crtc_state *current_config,
>   if (!fixup_inherited || (!current_config->name && !pipe_config->name)) 
> { \
>   PIPE_CONF_CHECK_BOOL(name); \
>   } else { \
> - pipe_config_mismatch(fastset, __stringify(name), \
> + pipe_config_mismatch(fastset, crtc, __stringify(name), \
>"unable to verify whether state matches 
> exactly, forcing modeset (expected %s, found %s)", \
>yesno(current_config->name), \
>yesno(pipe_config->name)); \
> @@ -12627,7 +12631,7 @@ intel_pipe_config_compare(const struct 
> intel_crtc_state *current_config,
>  
>  #define PIPE_CONF_CHECK_P(name) do { \
>   if (current_config->name != pipe_config->name) { \
> - pipe_config_mismatch(fastset, __stringify(name), \
> + pipe_config_mismatch(fastset, crtc, __stringify(name), \
>   

[Intel-gfx] [PATCH v3 v2 4/5] drm/i915: add pipe id/name to pipe mismatch logs

2019-10-15 Thread Lucas De Marchi
This way it's easier to figure out what didn't match when we have
multiple pipes enabled.

v2: pass drm_crtc and use the more common [CRTC:%d:%s] format
(Ville)

Signed-off-by: Lucas De Marchi 
---
 drivers/gpu/drm/i915/display/intel_display.c | 34 +++-
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display.c 
b/drivers/gpu/drm/i915/display/intel_display.c
index e71ec9d96c75..cd0f600e0205 100644
--- a/drivers/gpu/drm/i915/display/intel_display.c
+++ b/drivers/gpu/drm/i915/display/intel_display.c
@@ -12526,8 +12526,9 @@ pipe_config_infoframe_mismatch(struct drm_i915_private 
*dev_priv,
}
 }
 
-static void __printf(3, 4)
-pipe_config_mismatch(bool fastset, const char *name, const char *format, ...)
+static void __printf(4, 5)
+pipe_config_mismatch(bool fastset, const struct drm_crtc *crtc,
+const char *name, const char *format, ...)
 {
struct va_format vaf;
va_list args;
@@ -12537,9 +12538,11 @@ pipe_config_mismatch(bool fastset, const char *name, 
const char *format, ...)
vaf.va = 
 
if (fastset)
-   DRM_DEBUG_KMS("fastset mismatch in %s %pV\n", name, );
+   DRM_DEBUG_KMS("[CRTC:%d:%s] fastset mismatch in %s %pV\n",
+ crtc->base.id, crtc->name, name, );
else
-   DRM_ERROR("mismatch in %s %pV\n", name, );
+   DRM_ERROR("[CRTC:%d:%s] mismatch in %s %pV\n",
+ crtc->base.id, crtc->name, name, );
 
va_end(args);
 }
@@ -12567,6 +12570,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
  bool fastset)
 {
struct drm_i915_private *dev_priv = 
to_i915(current_config->base.crtc->dev);
+   const struct drm_crtc *crtc = pipe_config->base.crtc;
bool ret = true;
u32 bp_gamma = 0;
bool fixup_inherited = fastset &&
@@ -12580,7 +12584,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
 
 #define PIPE_CONF_CHECK_X(name) do { \
if (current_config->name != pipe_config->name) { \
-   pipe_config_mismatch(fastset, __stringify(name), \
+   pipe_config_mismatch(fastset, crtc, __stringify(name), \
 "(expected 0x%08x, found 0x%08x)", \
 current_config->name, \
 pipe_config->name); \
@@ -12590,7 +12594,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
 
 #define PIPE_CONF_CHECK_I(name) do { \
if (current_config->name != pipe_config->name) { \
-   pipe_config_mismatch(fastset, __stringify(name), \
+   pipe_config_mismatch(fastset, crtc, __stringify(name), \
 "(expected %i, found %i)", \
 current_config->name, \
 pipe_config->name); \
@@ -12600,7 +12604,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
 
 #define PIPE_CONF_CHECK_BOOL(name) do { \
if (current_config->name != pipe_config->name) { \
-   pipe_config_mismatch(fastset, __stringify(name), \
+   pipe_config_mismatch(fastset, crtc,  __stringify(name), \
 "(expected %s, found %s)", \
 yesno(current_config->name), \
 yesno(pipe_config->name)); \
@@ -12617,7 +12621,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
if (!fixup_inherited || (!current_config->name && !pipe_config->name)) 
{ \
PIPE_CONF_CHECK_BOOL(name); \
} else { \
-   pipe_config_mismatch(fastset, __stringify(name), \
+   pipe_config_mismatch(fastset, crtc, __stringify(name), \
 "unable to verify whether state matches 
exactly, forcing modeset (expected %s, found %s)", \
 yesno(current_config->name), \
 yesno(pipe_config->name)); \
@@ -12627,7 +12631,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
 
 #define PIPE_CONF_CHECK_P(name) do { \
if (current_config->name != pipe_config->name) { \
-   pipe_config_mismatch(fastset, __stringify(name), \
+   pipe_config_mismatch(fastset, crtc, __stringify(name), \
 "(expected %p, found %p)", \
 current_config->name, \
 pipe_config->name); \
@@ -12639,7 +12643,7 @@ intel_pipe_config_compare(const struct intel_crtc_state 
*current_config,
if (!intel_compare_link_m_n(_config->name, \
_config->name,\
!fastset)) { \
-