[Intel-gfx] [PATCH 4/4] drm/i915/display: add i915 parameter to I915_STATE_WARN()
Add i915 parameter to I915_STATE_WARN() and use device based logging. Done using cocci + hand edited where there was no i915 local variable ready. Signed-off-by: Jani Nikula --- drivers/gpu/drm/i915/display/g4x_dp.c | 4 +- drivers/gpu/drm/i915/display/intel_crtc.c | 4 +- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 10 ++--- drivers/gpu/drm/i915/display/intel_display.c | 9 +++-- drivers/gpu/drm/i915/display/intel_display.h | 7 ++-- .../drm/i915/display/intel_display_power.c| 37 --- drivers/gpu/drm/i915/display/intel_dpll.c | 2 +- drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 30 --- drivers/gpu/drm/i915/display/intel_fdi.c | 9 +++-- .../drm/i915/display/intel_modeset_verify.c | 35 ++ .../gpu/drm/i915/display/intel_pch_display.c | 20 +- drivers/gpu/drm/i915/display/intel_pps.c | 7 ++-- drivers/gpu/drm/i915/display/intel_snps_phy.c | 2 +- drivers/gpu/drm/i915/display/vlv_dsi_pll.c| 2 +- 14 files changed, 100 insertions(+), 78 deletions(-) diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c b/drivers/gpu/drm/i915/display/g4x_dp.c index 920d570f7594..112d91d81fdc 100644 --- a/drivers/gpu/drm/i915/display/g4x_dp.c +++ b/drivers/gpu/drm/i915/display/g4x_dp.c @@ -169,7 +169,7 @@ static void assert_dp_port(struct intel_dp *intel_dp, bool state) struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev); bool cur_state = intel_de_read(dev_priv, intel_dp->output_reg) & DP_PORT_EN; - I915_STATE_WARN(cur_state != state, + I915_STATE_WARN(dev_priv, cur_state != state, "[ENCODER:%d:%s] state assertion failure (expected %s, current %s)\n", dig_port->base.base.base.id, dig_port->base.base.name, str_on_off(state), str_on_off(cur_state)); @@ -180,7 +180,7 @@ static void assert_edp_pll(struct drm_i915_private *dev_priv, bool state) { bool cur_state = intel_de_read(dev_priv, DP_A) & DP_PLL_ENABLE; - I915_STATE_WARN(cur_state != state, + I915_STATE_WARN(dev_priv, cur_state != state, "eDP PLL state assertion failure (expected %s, current %s)\n", str_on_off(state), str_on_off(cur_state)); } diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c b/drivers/gpu/drm/i915/display/intel_crtc.c index 1e3f88d00609..ecae9bf05269 100644 --- a/drivers/gpu/drm/i915/display/intel_crtc.c +++ b/drivers/gpu/drm/i915/display/intel_crtc.c @@ -35,7 +35,9 @@ static void assert_vblank_disabled(struct drm_crtc *crtc) { - if (I915_STATE_WARN(drm_crtc_vblank_get(crtc) == 0, + struct drm_i915_private *i915 = to_i915(crtc->dev); + + if (I915_STATE_WARN(i915, drm_crtc_vblank_get(crtc) == 0, "[CRTC:%d:%s] vblank assertion failure (expected off, current on)\n", crtc->base.id, crtc->name)) drm_crtc_vblank_put(crtc); diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c b/drivers/gpu/drm/i915/display/intel_cx0_phy.c index d94127e7448b..ef0615cdc8a0 100644 --- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c @@ -2945,18 +2945,18 @@ void intel_c10pll_state_verify(struct intel_atomic_state *state, for (i = 0; i < ARRAY_SIZE(mpllb_sw_state->pll); i++) { u8 expected = mpllb_sw_state->pll[i]; - I915_STATE_WARN(mpllb_hw_state.pll[i] != expected, + I915_STATE_WARN(i915, mpllb_hw_state.pll[i] != expected, "[CRTC:%d:%s] mismatch in C10MPLLB: Register[%d] (expected 0x%02x, found 0x%02x)", - crtc->base.base.id, crtc->base.name, - i, expected, mpllb_hw_state.pll[i]); + crtc->base.base.id, crtc->base.name, i, + expected, mpllb_hw_state.pll[i]); } - I915_STATE_WARN(mpllb_hw_state.tx != mpllb_sw_state->tx, + I915_STATE_WARN(i915, mpllb_hw_state.tx != mpllb_sw_state->tx, "[CRTC:%d:%s] mismatch in C10MPLLB: Register TX0 (expected 0x%02x, found 0x%02x)", crtc->base.base.id, crtc->base.name, mpllb_sw_state->tx, mpllb_hw_state.tx); - I915_STATE_WARN(mpllb_hw_state.cmn != mpllb_sw_state->cmn, + I915_STATE_WARN(i915, mpllb_hw_state.cmn != mpllb_sw_state->cmn, "[CRTC:%d:%s] mismatch in C10MPLLB: Register CMN0 (expected 0x%02x, found 0x%02x)", crtc->base.base.id, crtc->base.name, mpllb_sw_state->cmn, mpllb_hw_state.cmn); diff --git a/drivers/gpu/drm/i915/display/intel_display.c b/drivers/gpu/drm/i915/display/intel_display.c index 1d5d42a40803..4b70b389e0cb 100644 --- a/drivers/gpu/drm/i915/display/intel_display.c +++ b/drivers/gpu/drm/i915/display/
Re: [Intel-gfx] [PATCH 4/4] drm/i915/display: add i915 parameter to I915_STATE_WARN()
On Fri, May 12, 2023 at 02:04:44PM +0300, Jani Nikula wrote: > Add i915 parameter to I915_STATE_WARN() and use device based logging. > > Done using cocci + hand edited where there was no i915 local variable > ready. > > Signed-off-by: Jani Nikula with a bit of trust in coccinelle + compiler (for dev_priv vs i915 checks): Reviewed-by: Rodrigo Vivi > --- > drivers/gpu/drm/i915/display/g4x_dp.c | 4 +- > drivers/gpu/drm/i915/display/intel_crtc.c | 4 +- > drivers/gpu/drm/i915/display/intel_cx0_phy.c | 10 ++--- > drivers/gpu/drm/i915/display/intel_display.c | 9 +++-- > drivers/gpu/drm/i915/display/intel_display.h | 7 ++-- > .../drm/i915/display/intel_display_power.c| 37 --- > drivers/gpu/drm/i915/display/intel_dpll.c | 2 +- > drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 30 --- > drivers/gpu/drm/i915/display/intel_fdi.c | 9 +++-- > .../drm/i915/display/intel_modeset_verify.c | 35 ++ > .../gpu/drm/i915/display/intel_pch_display.c | 20 +- > drivers/gpu/drm/i915/display/intel_pps.c | 7 ++-- > drivers/gpu/drm/i915/display/intel_snps_phy.c | 2 +- > drivers/gpu/drm/i915/display/vlv_dsi_pll.c| 2 +- > 14 files changed, 100 insertions(+), 78 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/g4x_dp.c > b/drivers/gpu/drm/i915/display/g4x_dp.c > index 920d570f7594..112d91d81fdc 100644 > --- a/drivers/gpu/drm/i915/display/g4x_dp.c > +++ b/drivers/gpu/drm/i915/display/g4x_dp.c > @@ -169,7 +169,7 @@ static void assert_dp_port(struct intel_dp *intel_dp, > bool state) > struct drm_i915_private *dev_priv = to_i915(dig_port->base.base.dev); > bool cur_state = intel_de_read(dev_priv, intel_dp->output_reg) & > DP_PORT_EN; > > - I915_STATE_WARN(cur_state != state, > + I915_STATE_WARN(dev_priv, cur_state != state, > "[ENCODER:%d:%s] state assertion failure (expected %s, > current %s)\n", > dig_port->base.base.base.id, dig_port->base.base.name, > str_on_off(state), str_on_off(cur_state)); > @@ -180,7 +180,7 @@ static void assert_edp_pll(struct drm_i915_private > *dev_priv, bool state) > { > bool cur_state = intel_de_read(dev_priv, DP_A) & DP_PLL_ENABLE; > > - I915_STATE_WARN(cur_state != state, > + I915_STATE_WARN(dev_priv, cur_state != state, > "eDP PLL state assertion failure (expected %s, current > %s)\n", > str_on_off(state), str_on_off(cur_state)); > } > diff --git a/drivers/gpu/drm/i915/display/intel_crtc.c > b/drivers/gpu/drm/i915/display/intel_crtc.c > index 1e3f88d00609..ecae9bf05269 100644 > --- a/drivers/gpu/drm/i915/display/intel_crtc.c > +++ b/drivers/gpu/drm/i915/display/intel_crtc.c > @@ -35,7 +35,9 @@ > > static void assert_vblank_disabled(struct drm_crtc *crtc) > { > - if (I915_STATE_WARN(drm_crtc_vblank_get(crtc) == 0, > + struct drm_i915_private *i915 = to_i915(crtc->dev); > + > + if (I915_STATE_WARN(i915, drm_crtc_vblank_get(crtc) == 0, > "[CRTC:%d:%s] vblank assertion failure (expected > off, current on)\n", > crtc->base.id, crtc->name)) > drm_crtc_vblank_put(crtc); > diff --git a/drivers/gpu/drm/i915/display/intel_cx0_phy.c > b/drivers/gpu/drm/i915/display/intel_cx0_phy.c > index d94127e7448b..ef0615cdc8a0 100644 > --- a/drivers/gpu/drm/i915/display/intel_cx0_phy.c > +++ b/drivers/gpu/drm/i915/display/intel_cx0_phy.c > @@ -2945,18 +2945,18 @@ void intel_c10pll_state_verify(struct > intel_atomic_state *state, > for (i = 0; i < ARRAY_SIZE(mpllb_sw_state->pll); i++) { > u8 expected = mpllb_sw_state->pll[i]; > > - I915_STATE_WARN(mpllb_hw_state.pll[i] != expected, > + I915_STATE_WARN(i915, mpllb_hw_state.pll[i] != expected, > "[CRTC:%d:%s] mismatch in C10MPLLB: > Register[%d] (expected 0x%02x, found 0x%02x)", > - crtc->base.base.id, crtc->base.name, > - i, expected, mpllb_hw_state.pll[i]); > + crtc->base.base.id, crtc->base.name, i, > + expected, mpllb_hw_state.pll[i]); > } > > - I915_STATE_WARN(mpllb_hw_state.tx != mpllb_sw_state->tx, > + I915_STATE_WARN(i915, mpllb_hw_state.tx != mpllb_sw_state->tx, > "[CRTC:%d:%s] mismatch in C10MPLLB: Register TX0 > (expected 0x%02x, found 0x%02x)", > crtc->base.base.id, crtc->base.name, > mpllb_sw_state->tx, mpllb_hw_state.tx); > > - I915_STATE_WARN(mpllb_hw_state.cmn != mpllb_sw_state->cmn, > + I915_STATE_WARN(i915, mpllb_hw_state.cmn != mpllb_sw_state->cmn, > "[CRTC:%d:%s] mismatch in C10MPLLB: Register CMN0 > (expected 0x%02x, found 0x%02x)", > crtc->base.base.id, crtc->base.name, >
Re: [Intel-gfx] [PATCH 4/4] drm/i915/display: add i915 parameter to I915_STATE_WARN()
On Fri, 12 May 2023, Rodrigo Vivi wrote: > On Fri, May 12, 2023 at 02:04:44PM +0300, Jani Nikula wrote: >> Add i915 parameter to I915_STATE_WARN() and use device based logging. >> >> Done using cocci + hand edited where there was no i915 local variable >> ready. >> >> Signed-off-by: Jani Nikula > > with a bit of trust in coccinelle + compiler (for dev_priv vs i915 checks): That was too much trust, as verify_connector_state() had crtc->base.dev but it's possible the crtc is NULL. Caught by CI, hooray. >> @@ -64,6 +65,7 @@ static void >> verify_connector_state(struct intel_atomic_state *state, >> struct intel_crtc *crtc) >> { >> +struct drm_i915_private *i915 = to_i915(crtc->base.dev); crtc can be NULL here. v2 in-reply to v1. BR, Jani. >> struct drm_connector *connector; >> struct drm_connector_state *new_conn_state; >> int i; >> @@ -80,7 +82,7 @@ verify_connector_state(struct intel_atomic_state *state, >> >> intel_connector_verify_state(crtc_state, new_conn_state); >> >> -I915_STATE_WARN(new_conn_state->best_encoder != encoder, >> +I915_STATE_WARN(i915, new_conn_state->best_encoder != encoder, >> "connector's atomic encoder doesn't match >> legacy encoder\n"); >> } >> } -- Jani Nikula, Intel Open Source Graphics Center