From: Daniel Vetter <daniel@ffwll.ch>
To: ville.syrjala@linux.intel.com
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 04/11] drm/i915: Factor out i9xx_compute_clocks() like ironlake_compute_clocks()
Date: Wed, 31 Oct 2012 17:28:40 +0100 [thread overview]
Message-ID: <20121031162840.GH5755@phenom.ffwll.local> (raw)
In-Reply-To: <1351698624-26626-5-git-send-email-ville.syrjala@linux.intel.com>
On Wed, Oct 31, 2012 at 05:50:17PM +0200, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> Split the i9xx clock stuff out from i9xx_compute_clocks().
>
> Only compile tested!
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
I'm working on a massive overhaul of the clock computation madness, so
that we do all that stuff before we start to touch the hw (and so would
finally have a reasonable chance at getting global bw issues right).
Current wip pile is at:
http://cgit.freedesktop.org/~danvet/drm/log/?h=modeset-rework
Until we've figured out what's the best approach I prefere if we keep the
churn in this (rather convoluted code) low.
-Daniel
> ---
> drivers/gpu/drm/i915/intel_display.c | 128 ++++++++++++++++++++--------------
> 1 files changed, 75 insertions(+), 53 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 6d3feea..b42637b 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -4557,6 +4557,76 @@ static void intel_set_pipe_timings(struct intel_crtc *intel_crtc,
> ((mode->hdisplay - 1) << 16) | (mode->vdisplay - 1));
> }
>
> +static bool i9xx_compute_clocks(struct drm_crtc *crtc,
> + struct drm_display_mode *adjusted_mode,
> + intel_clock_t *clock,
> + bool *has_reduced_clock,
> + intel_clock_t *reduced_clock,
> + int *refclk, int *num_connectors, bool *is_dp)
> +{
> + struct drm_device *dev = crtc->dev;
> + struct drm_i915_private *dev_priv = dev->dev_private;
> + struct intel_encoder *encoder;
> + const intel_limit_t *limit;
> + bool ok, is_sdvo = false, is_tv = false, is_lvds = false;
> +
> + *num_connectors = 0;
> +
> + for_each_encoder_on_crtc(dev, crtc, encoder) {
> + switch (encoder->type) {
> + case INTEL_OUTPUT_LVDS:
> + is_lvds = true;
> + break;
> + case INTEL_OUTPUT_SDVO:
> + case INTEL_OUTPUT_HDMI:
> + is_sdvo = true;
> + if (encoder->needs_tv_clock)
> + is_tv = true;
> + break;
> + case INTEL_OUTPUT_TVOUT:
> + is_tv = true;
> + break;
> + case INTEL_OUTPUT_DISPLAYPORT:
> + *is_dp = true;
> + break;
> + }
> +
> + (*num_connectors)++;
> + }
> +
> + *refclk = i9xx_get_refclk(crtc, *num_connectors);
> +
> + /*
> + * Returns a set of divisors for the desired target clock with the given
> + * refclk, or FALSE. The returned values represent the clock equation:
> + * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2.
> + */
> + limit = intel_limit(crtc, *refclk);
> + ok = limit->find_pll(limit, crtc, adjusted_mode->clock, *refclk, NULL,
> + clock);
> + if (!ok)
> + return false;
> +
> + if (is_lvds && dev_priv->lvds_downclock_avail) {
> + /*
> + * Ensure we match the reduced clock's P to the target clock.
> + * If the clocks don't match, we can't switch the display clock
> + * by using the FP0/FP1. In such case we will disable the LVDS
> + * downclock feature.
> + */
> + *has_reduced_clock = limit->find_pll(limit, crtc,
> + dev_priv->lvds_downclock,
> + *refclk,
> + clock,
> + reduced_clock);
> + }
> +
> + if (is_sdvo && is_tv)
> + i9xx_adjust_sdvo_tv_clock(adjusted_mode, clock);
> +
> + return true;
> +}
> +
> static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
> struct drm_display_mode *mode,
> struct drm_display_mode *adjusted_mode,
> @@ -4571,44 +4641,13 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
> int refclk, num_connectors = 0;
> intel_clock_t clock, reduced_clock;
> u32 dspcntr, pipeconf;
> - bool ok, has_reduced_clock = false, is_sdvo = false;
> - bool is_lvds = false, is_tv = false, is_dp = false;
> - struct intel_encoder *encoder;
> - const intel_limit_t *limit;
> + bool ok, has_reduced_clock = false;
> + bool is_dp = false;
> int ret;
>
> - for_each_encoder_on_crtc(dev, crtc, encoder) {
> - switch (encoder->type) {
> - case INTEL_OUTPUT_LVDS:
> - is_lvds = true;
> - break;
> - case INTEL_OUTPUT_SDVO:
> - case INTEL_OUTPUT_HDMI:
> - is_sdvo = true;
> - if (encoder->needs_tv_clock)
> - is_tv = true;
> - break;
> - case INTEL_OUTPUT_TVOUT:
> - is_tv = true;
> - break;
> - case INTEL_OUTPUT_DISPLAYPORT:
> - is_dp = true;
> - break;
> - }
> -
> - num_connectors++;
> - }
> -
> - refclk = i9xx_get_refclk(crtc, num_connectors);
> -
> - /*
> - * Returns a set of divisors for the desired target clock with the given
> - * refclk, or FALSE. The returned values represent the clock equation:
> - * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2.
> - */
> - limit = intel_limit(crtc, refclk);
> - ok = limit->find_pll(limit, crtc, adjusted_mode->clock, refclk, NULL,
> - &clock);
> + ok = i9xx_compute_clocks(crtc, adjusted_mode, &clock,
> + &has_reduced_clock, &reduced_clock,
> + &refclk, &num_connectors, &is_dp);
> if (!ok) {
> DRM_ERROR("Couldn't find PLL settings for mode!\n");
> return -EINVAL;
> @@ -4617,23 +4656,6 @@ static int i9xx_crtc_mode_set(struct drm_crtc *crtc,
> /* Ensure that the cursor is valid for the new mode before changing... */
> intel_crtc_update_cursor(crtc, true);
>
> - if (is_lvds && dev_priv->lvds_downclock_avail) {
> - /*
> - * Ensure we match the reduced clock's P to the target clock.
> - * If the clocks don't match, we can't switch the display clock
> - * by using the FP0/FP1. In such case we will disable the LVDS
> - * downclock feature.
> - */
> - has_reduced_clock = limit->find_pll(limit, crtc,
> - dev_priv->lvds_downclock,
> - refclk,
> - &clock,
> - &reduced_clock);
> - }
> -
> - if (is_sdvo && is_tv)
> - i9xx_adjust_sdvo_tv_clock(adjusted_mode, &clock);
> -
> if (IS_GEN2(dev))
> i8xx_update_pll(crtc, adjusted_mode, &clock,
> has_reduced_clock ? &reduced_clock : NULL,
> --
> 1.7.8.6
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
next prev parent reply other threads:[~2012-10-31 16:27 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-31 15:50 [PATCH 00/11] drm/i915: Patches cherry-picked from drm_atomic ville.syrjala
2012-10-31 15:50 ` [PATCH 01/11] drm/i915: Fix display pixel format handling ville.syrjala
2012-10-31 20:20 ` Jesse Barnes
2012-11-01 14:03 ` Ville Syrjälä
2012-11-01 14:06 ` Chris Wilson
2012-10-31 15:50 ` [PATCH 02/11] drm/i915: Add SURFLIVE register definitions ville.syrjala
2012-10-31 20:23 ` Jesse Barnes
2012-10-31 22:57 ` Daniel Vetter
2012-11-01 14:16 ` Ville Syrjälä
2012-11-01 14:19 ` Daniel Vetter
2012-11-01 14:23 ` Ville Syrjälä
2012-10-31 15:50 ` [PATCH 03/11] drm/i915: Implement execbuffer wait for all planes ville.syrjala
2012-10-31 15:59 ` Chris Wilson
2012-10-31 15:50 ` [PATCH 04/11] drm/i915: Factor out i9xx_compute_clocks() like ironlake_compute_clocks() ville.syrjala
2012-10-31 16:28 ` Daniel Vetter [this message]
2012-10-31 17:04 ` Ville Syrjälä
2012-10-31 18:29 ` Daniel Vetter
2012-10-31 15:50 ` [PATCH 05/11] drm/i915: Check framebuffer stride more thoroughly ville.syrjala
2012-10-31 20:25 ` Jesse Barnes
2012-11-01 14:06 ` Ville Syrjälä
2012-10-31 15:50 ` [PATCH 06/11] drm/i915: Check the framebuffer offset ville.syrjala
2012-10-31 20:26 ` Jesse Barnes
2012-11-01 14:09 ` Ville Syrjälä
2012-11-01 14:18 ` Daniel Vetter
2012-11-01 14:40 ` Jesse Barnes
2012-11-01 14:40 ` Ville Syrjälä
2012-10-31 15:50 ` [PATCH 07/11] drm/i915: pixel_size == cpp ville.syrjala
2012-10-31 20:27 ` Jesse Barnes
2012-10-31 15:50 ` [PATCH 08/11] drm/i915: Bad pixel formats can't reach the sprite code ville.syrjala
2012-10-31 20:27 ` Jesse Barnes
2012-10-31 15:50 ` [PATCH 09/11] drm/i915: Consitify adjusted_mode parameter ville.syrjala
2012-10-31 15:50 ` [PATCH 10/11] drm/i915: Constify mode argument to intel_modeset_adjusted_mode() ville.syrjala
2012-10-31 15:50 ` [PATCH 11/11] drm/i915: Introduce intel_crtc_update_sarea_pos() ville.syrjala
2012-10-31 20:27 ` Jesse Barnes
2012-10-31 23:02 ` Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121031162840.GH5755@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.org \
--cc=ville.syrjala@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.