drm/i915: OCD fixes
Subsystems (2)
cover drm/i915: OCD fixes
After spotting one open coded pipe_name() some form of OCD kicked in and I had to fix it all.
PATCH 1/5 drm/i915: Use pipe_name() and port_name() where appropriate
From: Ville Syrjälä <[email protected]>
Get rid of the few remaining open coded copies ofpipe_name() and port_name().
--- drivers/gpu/drm/i915/intel_display.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_display.c +2 -2
@@ -4723,7 +4723,7 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc, dspcntr |=DISPPLANE_SEL_PIPE_B ; } -DRM_DEBUG_KMS ("Mode for pipe %c:\n" , pipe ==0 ?'A' :'B' ); +DRM_DEBUG_KMS ("Mode for pipe %c:\n" ,pipe_name (pipe));drm_mode_debug_printmodeline (mode);intel_set_pipe_timings (intel_crtc, mode, adjusted_mode);
@@ -6109,7 +6109,7 @@ static void ironlake_write_eld(struct drm_connector *connector, eldv |=IBX_ELD_VALIDB <<4 ; eldv |=IBX_ELD_VALIDB <<8 ; }else { -DRM_DEBUG_DRIVER ("ELD on port %c\n" ,'A' + i); +DRM_DEBUG_DRIVER ("ELD on port %c\n" ,port_name (i)); eldv =IBX_ELD_VALIDB << ((i -1 ) *4 ); }
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915: Use port_name() in PCH port audio power change message
In reply to [email protected]From: Ville Syrjälä <[email protected]>
--- drivers/gpu/drm/i915/i915_irq.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +11 -7
@@ -763,10 +763,12 @@ static void ibx_irq_handler(struct drm_device *dev, u32 pch_iir)ibx_hpd_irq_setup (dev);queue_work (dev_priv->wq, &dev_priv->hotplug_work); } -if (pch_iir &SDE_AUDIO_POWER_MASK ) +if (pch_iir &SDE_AUDIO_POWER_MASK ) { +int port =ffs ((pch_iir &SDE_AUDIO_POWER_MASK ) >> +SDE_AUDIO_POWER_SHIFT );DRM_DEBUG_DRIVER ("PCH audio power change on port %d\n" , - (pch_iir &SDE_AUDIO_POWER_MASK ) >> -SDE_AUDIO_POWER_SHIFT ); +port_name (port)); + }if (pch_iir &SDE_AUX_MASK )dp_aux_irq_handler (dev);
@@ -812,10 +814,12 @@ static void cpt_irq_handler(struct drm_device *dev, u32 pch_iir)ibx_hpd_irq_setup (dev);queue_work (dev_priv->wq, &dev_priv->hotplug_work); } -if (pch_iir &SDE_AUDIO_POWER_MASK_CPT ) -DRM_DEBUG_DRIVER ("PCH audio power change on port %d\n" , - (pch_iir &SDE_AUDIO_POWER_MASK_CPT ) >> -SDE_AUDIO_POWER_SHIFT_CPT ); +if (pch_iir &SDE_AUDIO_POWER_MASK_CPT ) { +int port =ffs ((pch_iir &SDE_AUDIO_POWER_MASK_CPT ) >> +SDE_AUDIO_POWER_SHIFT_CPT ); +DRM_DEBUG_DRIVER ("PCH audio power change on port %c\n" , +port_name (port)); + }if (pch_iir &SDE_AUX_MASK_CPT )dp_aux_irq_handler (dev);
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915: Print plane, pipe, port names as alphabetical insted of decimal
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Alway use the alphabetical names in debug/error messages for planes, pipes and ports, instead of using decimal numbers occasionally.
--- drivers/gpu/drm/i915/intel_ddi.c | 10 ++++----- drivers/gpu/drm/i915/intel_display.c | 42 ++++++++++++++++++------------------ drivers/gpu/drm/i915/intel_pm.c | 26 +++++++++++----------- 3 files changed, 39 insertions(+), 39 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +5 -5
@@ -748,8 +748,8 @@ intel_ddi_get_crtc_encoder(struct drm_crtc *crtc) }if (num_encoders !=1 ) -WARN (1 ,"%d encoders on crtc for pipe %d\n" , num_encoders, - intel_crtc->pipe); +WARN (1 ,"%d encoders on crtc for pipe %c\n" , num_encoders, +pipe_name (intel_crtc->pipe));BUG_ON (ret ==NULL );return ret;
@@ -1047,8 +1047,8 @@ void intel_ddi_enable_transcoder_func(struct drm_crtc *crtc) } }else { -WARN (1 ,"Invalid encoder type %d for pipe %d\n" , - intel_encoder->type, pipe); +WARN (1 ,"Invalid encoder type %d for pipe %c\n" , + intel_encoder->type,pipe_name (pipe)); }I915_WRITE (TRANS_DDI_FUNC_CTL (cpu_transcoder), temp);
@@ -1148,7 +1148,7 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, } } -DRM_DEBUG_KMS ("No pipe for ddi port %i found\n" , port); +DRM_DEBUG_KMS ("No pipe for ddi port %c found\n" ,port_name (port));return false; }
drivers/gpu/drm/i915/intel_display.c +21 -21
115 lines not on this page · raw message
drivers/gpu/drm/i915/intel_pm.c +13 -13
@@ -113,8 +113,8 @@ static void i8xx_enable_fbc(struct drm_crtc *crtc, unsigned long interval) fbc_ctl |= obj->fence_reg;I915_WRITE (FBC_CONTROL , fbc_ctl); -DRM_DEBUG_KMS ("enabled FBC, pitch %d, yoff %d, plane %d, " , - cfb_pitch, crtc->y, intel_crtc->plane); +DRM_DEBUG_KMS ("enabled FBC, pitch %d, yoff %d, plane %c, " , + cfb_pitch, crtc->y,plane_name (intel_crtc->plane)); }static bool i8xx_fbc_enabled (struct drm_device *dev)
@@ -148,7 +148,7 @@ static void g4x_enable_fbc(struct drm_crtc *crtc, unsigned long interval)/* enable it... */ I915_WRITE (DPFC_CONTROL ,I915_READ (DPFC_CONTROL ) |DPFC_CTL_EN ); -DRM_DEBUG_KMS ("enabled fbc on plane %d\n" , intel_crtc->plane); +DRM_DEBUG_KMS ("enabled fbc on plane %c\n" ,plane_name (intel_crtc->plane)); }static void g4x_disable_fbc (struct drm_device *dev)
@@ -228,7 +228,7 @@ static void ironlake_enable_fbc(struct drm_crtc *crtc, unsigned long interval)sandybridge_blit_fbc_update (dev); } -DRM_DEBUG_KMS ("enabled fbc on plane %d\n" , intel_crtc->plane); +DRM_DEBUG_KMS ("enabled fbc on plane %c\n" ,plane_name (intel_crtc->plane)); }static void ironlake_disable_fbc (struct drm_device *dev)
@@ -2146,15 +2146,15 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe, &sandybridge_display_wm_info, latency, &sprite_wm);if (!ret) { -DRM_DEBUG_KMS ("failed to compute sprite wm for pipe %d\n" , - pipe); +DRM_DEBUG_KMS ("failed to compute sprite wm for pipe %c\n" , +pipe_name (pipe));return ; } val =I915_READ (reg); val &= ~WM0_PIPE_SPRITE_MASK ;I915_WRITE (reg, val | (sprite_wm <<WM0_PIPE_SPRITE_SHIFT )); -DRM_DEBUG_KMS ("sprite watermarks For pipe %d - %d\n" , pipe, sprite_wm); +DRM_DEBUG_KMS ("sprite watermarks For pipe %c - %d\n" ,pipe_name (pipe), sprite_wm); ret = sandybridge_compute_sprite_srwm(dev, pipe, sprite_width,
@@ -2163,8 +2163,8 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe,SNB_READ_WM1_LATENCY () *500 , &sprite_wm);if (!ret) { -DRM_DEBUG_KMS ("failed to compute sprite lp1 wm on pipe %d\n" , - pipe); +DRM_DEBUG_KMS ("failed to compute sprite lp1 wm on pipe %c\n" , +pipe_name (pipe));return ; }I915_WRITE (WM1S_LP_ILK , sprite_wm);
@@ -2179,8 +2179,8 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe,SNB_READ_WM2_LATENCY () *500 , &sprite_wm);if (!ret) { -DRM_DEBUG_KMS ("failed to compute sprite lp2 wm on pipe %d\n" , - pipe); +DRM_DEBUG_KMS ("failed to compute sprite lp2 wm on pipe %c\n" , +pipe_name (pipe));return ; }I915_WRITE (WM2S_LP_IVB , sprite_wm);
@@ -2191,8 +2191,8 @@ static void sandybridge_update_sprite_wm(struct drm_device *dev, int pipe,SNB_READ_WM3_LATENCY () *500 , &sprite_wm);if (!ret) { -DRM_DEBUG_KMS ("failed to compute sprite lp3 wm on pipe %d\n" , - pipe); +DRM_DEBUG_KMS ("failed to compute sprite lp3 wm on pipe %c\n" , +pipe_name (pipe));return ; }I915_WRITE (WM3S_LP_IVB , sprite_wm);
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: Use alphabetical names for transcoders too
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Print the alphabetical name for transcoders. The code already used the pipe_name() macro for transcoders, so I did the same. But we do have the (unused) transcoder_name() macro which could be used instead.
--- drivers/gpu/drm/i915/intel_display.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -6
@@ -1097,14 +1097,14 @@ static void assert_pch_pll(struct drm_i915_private *dev_priv, pch_dpll =I915_READ (PCH_DPLL_SEL ); cur_state = pll->pll_reg == _PCH_DPLL_B;if (!WARN (((pch_dpll >> (4 * crtc->pipe)) &1 ) != cur_state, -"PLL[%d] not attached to this transcoder %d: %08x\n" , - cur_state, crtc->pipe, pch_dpll)) { +"PLL[%d] not attached to this transcoder %c: %08x\n" , + cur_state,pipe_name (crtc->pipe), pch_dpll)) { cur_state = !!(val >> (4 *crtc->pipe +3 ));WARN (cur_state != state, -"PLL[%d] not %s on this transcoder %d: %08x\n" , +"PLL[%d] not %s on this transcoder %c: %08x\n" , pll->pll_reg == _PCH_DPLL_B,state_string (state), - crtc->pipe, +pipe_name (crtc->pipe), val); } }
@@ -1733,7 +1733,7 @@ static void ironlake_enable_pch_transcoder(struct drm_i915_private *dev_priv,I915_WRITE (reg, val |TRANS_ENABLE );if (wait_for (I915_READ (reg) &TRANS_STATE_ENABLE ,100 )) -DRM_ERROR ("failed to enable transcoder %d\n" , pipe); +DRM_ERROR ("failed to enable transcoder %c\n" ,pipe_name (pipe)); } static void lpt_enable_pch_transcoder(struct drm_i915_private *dev_priv,
@@ -1786,7 +1786,7 @@ static void ironlake_disable_pch_transcoder(struct drm_i915_private *dev_priv,I915_WRITE (reg, val);/* wait for PCH transcoder off, transcoder state */ if (wait_for ((I915_READ (reg) &TRANS_STATE_ENABLE ) ==0 ,50 )) -DRM_ERROR ("failed to disable transcoder %d\n" , pipe); +DRM_ERROR ("failed to disable transcoder %c\n" ,pipe_name (pipe));if (!HAS_PCH_IBX (dev)) {/* Workaround: Clear the timing override chicken bit again. */
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915: Use alphabetical names for sprites
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add sprite_name() macro which should be used with the kind of sprites that are fixed to pipes (gen4.5+).
Also use dev_priv->num_plane to calculate the sprite index insted assuming two sprites per pipe. This should make it print the right name.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/intel_display.c | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -76,6 +76,8 @@ enum plane { };#define plane_name (p) ((p) + 'A') +#define sprite_name (p, s) ((p) * dev_priv->num_plane + (s) + 'A') +enum port {PORT_A =0 ,PORT_B ,
drivers/gpu/drm/i915/intel_display.c +4 -4
@@ -1302,8 +1302,8 @@ static void assert_sprites_disabled(struct drm_i915_private *dev_priv, reg =SPCNTR (pipe, i); val =I915_READ (reg);WARN ((val &SP_ENABLE ), -"sprite %d assertion failure, should be off on pipe %c but is still active\n" , - pipe *2 + i,pipe_name (pipe)); +"sprite %c assertion failure, should be off on pipe %c but is still active\n" , +sprite_name (pipe, i),pipe_name (pipe)); } }
@@ -9049,8 +9049,8 @@ void intel_modeset_init(struct drm_device *dev)for (j =0 ; j < dev_priv->num_plane; j++) { ret =intel_plane_init (dev, i, j);if (ret) -DRM_DEBUG_KMS ("pipe %c plane %d init failed: %d\n" , -pipe_name (i), j, ret); +DRM_DEBUG_KMS ("pipe %c sprite %c init failed: %d\n" , +pipe_name (i),sprite_name (i, j), ret); } }
Signature · 6 lines
1.8.1.5 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 2 lines · On Wed, Apr 17, 2013 at 05:48:46PM +0300, [email protected] wrote:
After spotting one open coded
pipe_name()some form of OCD kicked in and I had to fix it all.
OCD approved, entire pile shovelled on top of dinq. -Daniel
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch