Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 241bfc38 authored by Damien Lespiau's avatar Damien Lespiau Committed by Daniel Vetter
Browse files

drm/i915: Use crtc_clock with the adjusted mode



struct drm_mode_display now has a separate crtc_ version of the clock to
be used when we're talking about the timings given to the harwadre (was
far as the mode is concerned).

This commit is really the result of a git grep adjusted_mode.*clock and
replacing those by adjusted_mode.crtc_clock. No functional change.

v2: Rebased on drm-intel-queued-next

Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
Acked-by: default avatarDave Airlie <airlied@gmail.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent 1342830c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ static void intel_crt_get_config(struct intel_encoder *encoder,
	if (HAS_PCH_SPLIT(dev))
		ironlake_check_encoder_dotclock(pipe_config, dotclock);

	pipe_config->adjusted_mode.clock = dotclock;
	pipe_config->adjusted_mode.crtc_clock = dotclock;
}

static void hsw_crt_get_config(struct intel_encoder *encoder,
+17 −17
Original line number Diff line number Diff line
@@ -739,14 +739,14 @@ bool intel_crtc_active(struct drm_crtc *crtc)
	/* Be paranoid as we can arrive here with only partial
	 * state retrieved from the hardware during setup.
	 *
	 * We can ditch the adjusted_mode.clock check as soon
	 * We can ditch the adjusted_mode.crtc_clock check as soon
	 * as Haswell has gained clock readout/fastboot support.
	 *
	 * We can ditch the crtc->fb check as soon as we can
	 * properly reconstruct framebuffers.
	 */
	return intel_crtc->active && crtc->fb &&
		intel_crtc->config.adjusted_mode.clock;
		intel_crtc->config.adjusted_mode.crtc_clock;
}

enum transcoder intel_pipe_to_cpu_transcoder(struct drm_i915_private *dev_priv,
@@ -2913,7 +2913,7 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)
{
	struct drm_device *dev = crtc->dev;
	struct drm_i915_private *dev_priv = dev->dev_private;
	int clock = to_intel_crtc(crtc)->config.adjusted_mode.clock;
	int clock = to_intel_crtc(crtc)->config.adjusted_mode.crtc_clock;
	u32 divsel, phaseinc, auxdiv, phasedir = 0;
	u32 temp;

@@ -2937,8 +2937,8 @@ static void lpt_program_iclkip(struct drm_crtc *crtc)
		phaseinc = 0x20;
	} else {
		/* The iCLK virtual clock root frequency is in MHz,
		 * but the adjusted_mode->clock in in KHz. To get the divisors,
		 * it is necessary to divide one by another, so we
		 * but the adjusted_mode->crtc_clock in in KHz. To get the
		 * divisors, it is necessary to divide one by another, so we
		 * convert the virtual clock precision to KHz here for higher
		 * precision.
		 */
@@ -4148,7 +4148,7 @@ static int ironlake_fdi_compute_config(struct intel_crtc *intel_crtc,
	 */
	link_bw = intel_fdi_link_freq(dev) * MHz(100)/KHz(1)/10;

	fdi_dotclock = adjusted_mode->clock;
	fdi_dotclock = adjusted_mode->crtc_clock;

	lane = ironlake_get_lanes_required(fdi_dotclock, link_bw,
					   pipe_config->pipe_bpp);
@@ -4204,12 +4204,12 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,
		 * otherwise pipe A only.
		 */
		if ((crtc->pipe == PIPE_A || IS_I915G(dev)) &&
		    adjusted_mode->clock > clock_limit * 9 / 10) {
		    adjusted_mode->crtc_clock > clock_limit * 9 / 10) {
			clock_limit *= 2;
			pipe_config->double_wide = true;
		}

		if (adjusted_mode->clock > clock_limit * 9 / 10)
		if (adjusted_mode->crtc_clock > clock_limit * 9 / 10)
			return -EINVAL;
	}

@@ -4869,7 +4869,7 @@ static void intel_crtc_mode_from_pipe_config(struct intel_crtc *intel_crtc,

	crtc->mode.flags = pipe_config->adjusted_mode.flags;

	crtc->mode.clock = pipe_config->adjusted_mode.clock;
	crtc->mode.clock = pipe_config->adjusted_mode.crtc_clock;
	crtc->mode.flags |= pipe_config->adjusted_mode.flags;
}

@@ -7473,7 +7473,7 @@ static void i9xx_crtc_clock_get(struct intel_crtc *crtc,

	/*
	 * This value includes pixel_multiplier. We will use
	 * port_clock to compute adjusted_mode.clock in the
	 * port_clock to compute adjusted_mode.crtc_clock in the
	 * encoder's get_config() function.
	 */
	pipe_config->port_clock = clock.dot;
@@ -7508,11 +7508,11 @@ static void ironlake_pch_clock_get(struct intel_crtc *crtc,

	/*
	 * This value does not include pixel_multiplier.
	 * We will check that port_clock and adjusted_mode.clock
	 * We will check that port_clock and adjusted_mode.crtc_clock
	 * agree once we know their relationship in the encoder's
	 * get_config() function.
	 */
	pipe_config->adjusted_mode.clock =
	pipe_config->adjusted_mode.crtc_clock =
		intel_dotclock_calculate(intel_fdi_link_freq(dev) * 10000,
					 &pipe_config->fdi_m_n);
}
@@ -8489,8 +8489,8 @@ intel_modeset_pipe_config(struct drm_crtc *crtc,
	/* Set default port clock if not overwritten by the encoder. Needs to be
	 * done afterwards in case the encoder adjusts the mode. */
	if (!pipe_config->port_clock)
		pipe_config->port_clock = pipe_config->adjusted_mode.clock *
			pipe_config->pixel_multiplier;
		pipe_config->port_clock = pipe_config->adjusted_mode.crtc_clock
			* pipe_config->pixel_multiplier;

	ret = intel_crtc_compute_config(to_intel_crtc(crtc), pipe_config);
	if (ret < 0) {
@@ -8820,7 +8820,7 @@ intel_pipe_config_compare(struct drm_device *dev,
		PIPE_CONF_CHECK_I(pipe_bpp);

	if (!IS_HASWELL(dev)) {
		PIPE_CONF_CHECK_CLOCK_FUZZY(adjusted_mode.clock);
		PIPE_CONF_CHECK_CLOCK_FUZZY(adjusted_mode.crtc_clock);
		PIPE_CONF_CHECK_CLOCK_FUZZY(port_clock);
	}

@@ -9042,9 +9042,9 @@ void ironlake_check_encoder_dotclock(const struct intel_crtc_config *pipe_config
	 * FDI already provided one idea for the dotclock.
	 * Yell if the encoder disagrees.
	 */
	WARN(!intel_fuzzy_clock_check(pipe_config->adjusted_mode.clock, dotclock),
	WARN(!intel_fuzzy_clock_check(pipe_config->adjusted_mode.crtc_clock, dotclock),
	     "FDI dotclock and encoder dotclock mismatch, fdi: %i, encoder: %i\n",
	     pipe_config->adjusted_mode.clock, dotclock);
	     pipe_config->adjusted_mode.crtc_clock, dotclock);
}

static int __intel_set_mode(struct drm_crtc *crtc,
+7 −4
Original line number Diff line number Diff line
@@ -811,7 +811,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,

	DRM_DEBUG_KMS("DP link computation with max lane count %i "
		      "max bw %02x pixel clock %iKHz\n",
		      max_lane_count, bws[max_clock], adjusted_mode->clock);
		      max_lane_count, bws[max_clock],
		      adjusted_mode->crtc_clock);

	/* Walk through all bpp values. Luckily they're all nicely spaced with 2
	 * bpc in between. */
@@ -823,7 +824,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
	}

	for (; bpp >= 6*3; bpp -= 2*3) {
		mode_rate = intel_dp_link_required(adjusted_mode->clock, bpp);
		mode_rate = intel_dp_link_required(adjusted_mode->crtc_clock,
						   bpp);

		for (clock = 0; clock <= max_clock; clock++) {
			for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
@@ -868,7 +870,8 @@ intel_dp_compute_config(struct intel_encoder *encoder,
		      mode_rate, link_avail);

	intel_link_compute_m_n(bpp, lane_count,
			       adjusted_mode->clock, pipe_config->port_clock,
			       adjusted_mode->crtc_clock,
			       pipe_config->port_clock,
			       &pipe_config->dp_m_n);

	intel_dp_set_clock(encoder, pipe_config, intel_dp->link_bw);
@@ -1483,7 +1486,7 @@ static void intel_dp_get_config(struct intel_encoder *encoder,
	if (HAS_PCH_SPLIT(dev_priv->dev) && port != PORT_A)
		ironlake_check_encoder_dotclock(pipe_config, dotclock);

	pipe_config->adjusted_mode.clock = dotclock;
	pipe_config->adjusted_mode.crtc_clock = dotclock;
}

static bool is_edp_psr(struct intel_dp *intel_dp)
+1 −1
Original line number Diff line number Diff line
@@ -217,7 +217,7 @@ struct intel_crtc_config {
	 * preferred input timings. */
	struct drm_display_mode requested_mode;
	/* Actual pipe timings ie. what we program into the pipe timing
	 * registers. adjusted_mode.clock is the pipe pixel clock. */
	 * registers. adjusted_mode.crtc_clock is the pipe pixel clock. */
	struct drm_display_mode adjusted_mode;

	/* Pipe source size (ie. panel fitter input size)
+1 −1
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ static void intel_dvo_get_config(struct intel_encoder *encoder,

	pipe_config->adjusted_mode.flags |= flags;

	pipe_config->adjusted_mode.clock = pipe_config->port_clock;
	pipe_config->adjusted_mode.crtc_clock = pipe_config->port_clock;
}

static void intel_disable_dvo(struct intel_encoder *encoder)
Loading