[Intel-gfx] [PATCH 2/7] drm/i915: Always call the adjusted mode 'adjusted_mode'
Mika Kahola
mika.kahola at intel.com
Thu Sep 24 01:01:37 PDT 2015
coccinelle does a fine job on renaming the variables. Although, it does
break the rule of 80 character line width.
Reviewed-by: Mika Kahola <mika.kahola at intel.com>
On Tue, 2015-09-08 at 13:40 +0300, ville.syrjala at linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala at linux.intel.com>
>
> Always name any variable pointing at the adjusted mode as
> 'adjustead_mode'. This will make it much easier to identify
> when we should use the crtc_ timings and when we shoudln't.
>
> Conversion was performed with coccinelle:
> @@
> expression E;
> identifier I;
> @@
> - struct drm_display_mode *I = &E.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &E.adjusted_mode;
> <...
> - I
> + adjusted_mode
> ...>
>
> Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
> ---
> drivers/gpu/drm/i915/intel_audio.c | 7 ++++---
> drivers/gpu/drm/i915/intel_display.c | 12 +++++-------
> drivers/gpu/drm/i915/intel_dsi.c | 13 ++++++-------
> drivers/gpu/drm/i915/intel_hdmi.c | 9 +++------
> drivers/gpu/drm/i915/intel_lvds.c | 3 +--
> drivers/gpu/drm/i915/intel_pm.c | 14 ++++++--------
> drivers/gpu/drm/i915/intel_sdvo.c | 3 +--
> drivers/gpu/drm/i915/intel_sprite.c | 8 ++++----
> 8 files changed, 30 insertions(+), 39 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index f73de0b..cf4f5d1 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -396,7 +396,7 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
> {
> struct drm_encoder *encoder = &intel_encoder->base;
> struct intel_crtc *crtc = to_intel_crtc(encoder->crtc);
> - struct drm_display_mode *mode = &crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
> struct drm_connector *connector;
> struct drm_device *dev = encoder->dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -419,10 +419,11 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder)
> if (intel_pipe_has_type(crtc, INTEL_OUTPUT_DISPLAYPORT))
> connector->eld[5] |= (1 << 2);
>
> - connector->eld[6] = drm_av_sync_delay(connector, mode) / 2;
> + connector->eld[6] = drm_av_sync_delay(connector, adjusted_mode) / 2;
>
> if (dev_priv->display.audio_codec_enable)
> - dev_priv->display.audio_codec_enable(connector, intel_encoder, mode);
> + dev_priv->display.audio_codec_enable(connector, intel_encoder,
> + adjusted_mode);
>
> if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
> acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, (int) port);
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index e629a1b..b8b7540 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4348,8 +4348,7 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
> int skl_update_scaler_crtc(struct intel_crtc_state *state)
> {
> struct intel_crtc *intel_crtc = to_intel_crtc(state->base.crtc);
> - struct drm_display_mode *adjusted_mode =
> - &state->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode;
>
> DRM_DEBUG_KMS("Updating scaler for [CRTC:%i] scaler_user index %u.%u\n",
> intel_crtc->base.base.id, intel_crtc->pipe, SKL_CRTC_INDEX);
> @@ -7575,8 +7574,7 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc)
> struct drm_i915_private *dev_priv = dev->dev_private;
> enum pipe pipe = intel_crtc->pipe;
> enum transcoder cpu_transcoder = intel_crtc->config->cpu_transcoder;
> - struct drm_display_mode *adjusted_mode =
> - &intel_crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
> uint32_t crtc_vtotal, crtc_vblank_end;
> int vsyncshift = 0;
>
> @@ -12767,11 +12765,11 @@ static void update_scanline_offset(struct intel_crtc *crtc)
> * one to the value.
> */
> if (IS_GEN2(dev)) {
> - const struct drm_display_mode *mode = &crtc->config->base.adjusted_mode;
> + const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
> int vtotal;
>
> - vtotal = mode->crtc_vtotal;
> - if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> + vtotal = adjusted_mode->crtc_vtotal;
> + if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> vtotal /= 2;
>
> crtc->scanline_offset = vtotal - 1;
> diff --git a/drivers/gpu/drm/i915/intel_dsi.c b/drivers/gpu/drm/i915/intel_dsi.c
> index 781c267..0c26ba5 100644
> --- a/drivers/gpu/drm/i915/intel_dsi.c
> +++ b/drivers/gpu/drm/i915/intel_dsi.c
> @@ -759,8 +759,7 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
> struct intel_dsi *intel_dsi = enc_to_intel_dsi(encoder);
> - struct drm_display_mode *adjusted_mode =
> - &intel_crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
> enum port port;
> unsigned int bpp = intel_crtc->config->pipe_bpp;
> u32 val, tmp;
> @@ -842,14 +841,14 @@ static void intel_dsi_prepare(struct intel_encoder *intel_encoder)
> intel_dsi->video_mode_format == VIDEO_MODE_BURST) {
> I915_WRITE(MIPI_HS_TX_TIMEOUT(port),
> txbyteclkhs(adjusted_mode->htotal, bpp,
> - intel_dsi->lane_count,
> - intel_dsi->burst_mode_ratio) + 1);
> + intel_dsi->lane_count,
> + intel_dsi->burst_mode_ratio) + 1);
> } else {
> I915_WRITE(MIPI_HS_TX_TIMEOUT(port),
> txbyteclkhs(adjusted_mode->vtotal *
> - adjusted_mode->htotal,
> - bpp, intel_dsi->lane_count,
> - intel_dsi->burst_mode_ratio) + 1);
> + adjusted_mode->htotal,
> + bpp, intel_dsi->lane_count,
> + intel_dsi->burst_mode_ratio) + 1);
> }
> I915_WRITE(MIPI_LP_RX_TIMEOUT(port), intel_dsi->lp_rx_timeout);
> I915_WRITE(MIPI_TURN_AROUND_TIMEOUT(port),
> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
> index feb31d8..0b256c9 100644
> --- a/drivers/gpu/drm/i915/intel_hdmi.c
> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
> @@ -1523,8 +1523,7 @@ static void intel_hdmi_pre_enable(struct intel_encoder *encoder)
> {
> struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(&encoder->base);
> struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
> - struct drm_display_mode *adjusted_mode =
> - &intel_crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
>
> intel_hdmi_prepare(encoder);
>
> @@ -1541,8 +1540,7 @@ static void vlv_hdmi_pre_enable(struct intel_encoder *encoder)
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc =
> to_intel_crtc(encoder->base.crtc);
> - struct drm_display_mode *adjusted_mode =
> - &intel_crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
> enum dpio_channel port = vlv_dport_to_channel(dport);
> int pipe = intel_crtc->pipe;
> u32 val;
> @@ -1808,8 +1806,7 @@ static void chv_hdmi_pre_enable(struct intel_encoder *encoder)
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc =
> to_intel_crtc(encoder->base.crtc);
> - struct drm_display_mode *adjusted_mode =
> - &intel_crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
> enum dpio_channel ch = vlv_dport_to_channel(dport);
> int pipe = intel_crtc->pipe;
> int data, i, stagger;
> diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
> index 2c2d1f0..5e70acf 100644
> --- a/drivers/gpu/drm/i915/intel_lvds.c
> +++ b/drivers/gpu/drm/i915/intel_lvds.c
> @@ -139,8 +139,7 @@ static void intel_pre_enable_lvds(struct intel_encoder *encoder)
> struct drm_device *dev = encoder->base.dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
> - const struct drm_display_mode *adjusted_mode =
> - &crtc->config->base.adjusted_mode;
> + const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
> int pipe = crtc->pipe;
> u32 temp;
>
> diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
> index 64bc77e..7aa9a4e 100644
> --- a/drivers/gpu/drm/i915/intel_pm.c
> +++ b/drivers/gpu/drm/i915/intel_pm.c
> @@ -1500,8 +1500,7 @@ static void i965_update_wm(struct drm_crtc *unused_crtc)
> if (crtc) {
> /* self-refresh has much higher latency */
> static const int sr_latency_ns = 12000;
> - const struct drm_display_mode *adjusted_mode =
> - &to_intel_crtc(crtc)->config->base.adjusted_mode;
> + const struct drm_display_mode *adjusted_mode = &to_intel_crtc(crtc)->config->base.adjusted_mode;
> int clock = adjusted_mode->crtc_clock;
> int htotal = adjusted_mode->crtc_htotal;
> int hdisplay = to_intel_crtc(crtc)->config->pipe_src_w;
> @@ -1648,8 +1647,7 @@ static void i9xx_update_wm(struct drm_crtc *unused_crtc)
> if (HAS_FW_BLC(dev) && enabled) {
> /* self-refresh has much higher latency */
> static const int sr_latency_ns = 6000;
> - const struct drm_display_mode *adjusted_mode =
> - &to_intel_crtc(enabled)->config->base.adjusted_mode;
> + const struct drm_display_mode *adjusted_mode = &to_intel_crtc(enabled)->config->base.adjusted_mode;
> int clock = adjusted_mode->crtc_clock;
> int htotal = adjusted_mode->crtc_htotal;
> int hdisplay = to_intel_crtc(enabled)->config->pipe_src_w;
> @@ -2086,7 +2084,7 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
> - struct drm_display_mode *mode = &intel_crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &intel_crtc->config->base.adjusted_mode;
> u32 linetime, ips_linetime;
>
> if (!intel_crtc->active)
> @@ -2095,9 +2093,9 @@ hsw_compute_linetime_wm(struct drm_device *dev, struct drm_crtc *crtc)
> /* The WM are computed with base on how long it takes to fill a single
> * row at the given clock rate, multiplied by 8.
> * */
> - linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
> - mode->crtc_clock);
> - ips_linetime = DIV_ROUND_CLOSEST(mode->crtc_htotal * 1000 * 8,
> + linetime = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
> + adjusted_mode->crtc_clock);
> + ips_linetime = DIV_ROUND_CLOSEST(adjusted_mode->crtc_htotal * 1000 * 8,
> dev_priv->cdclk_freq);
>
> return PIPE_WM_LINETIME_IPS_LINETIME(ips_linetime) |
> diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
> index ca3dd7c..3a70c2f 100644
> --- a/drivers/gpu/drm/i915/intel_sdvo.c
> +++ b/drivers/gpu/drm/i915/intel_sdvo.c
> @@ -1189,8 +1189,7 @@ static void intel_sdvo_pre_enable(struct intel_encoder *intel_encoder)
> struct drm_device *dev = intel_encoder->base.dev;
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *crtc = to_intel_crtc(intel_encoder->base.crtc);
> - struct drm_display_mode *adjusted_mode =
> - &crtc->config->base.adjusted_mode;
> + struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
> struct drm_display_mode *mode = &crtc->config->base.mode;
> struct intel_sdvo *intel_sdvo = to_sdvo(intel_encoder);
> u32 sdvox;
> diff --git a/drivers/gpu/drm/i915/intel_sprite.c b/drivers/gpu/drm/i915/intel_sprite.c
> index ca7e264..a5e599b 100644
> --- a/drivers/gpu/drm/i915/intel_sprite.c
> +++ b/drivers/gpu/drm/i915/intel_sprite.c
> @@ -79,19 +79,19 @@ static int usecs_to_scanlines(const struct drm_display_mode *mode, int usecs)
> void intel_pipe_update_start(struct intel_crtc *crtc)
> {
> struct drm_device *dev = crtc->base.dev;
> - const struct drm_display_mode *mode = &crtc->config->base.adjusted_mode;
> + const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode;
> enum pipe pipe = crtc->pipe;
> long timeout = msecs_to_jiffies_timeout(1);
> int scanline, min, max, vblank_start;
> wait_queue_head_t *wq = drm_crtc_vblank_waitqueue(&crtc->base);
> DEFINE_WAIT(wait);
>
> - vblank_start = mode->crtc_vblank_start;
> - if (mode->flags & DRM_MODE_FLAG_INTERLACE)
> + vblank_start = adjusted_mode->crtc_vblank_start;
> + if (adjusted_mode->flags & DRM_MODE_FLAG_INTERLACE)
> vblank_start = DIV_ROUND_UP(vblank_start, 2);
>
> /* FIXME needs to be calibrated sensibly */
> - min = vblank_start - usecs_to_scanlines(mode, 100);
> + min = vblank_start - usecs_to_scanlines(adjusted_mode, 100);
> max = vblank_start - 1;
>
> local_irq_disable();
More information about the Intel-gfx
mailing list