[Intel-gfx] [PATCH] drm/i915/vlv: modeset_global_* for VLV v6
Jesse Barnes
jbarnes at virtuousgeek.org
Mon Nov 4 22:24:57 CET 2013
On Mon, 4 Nov 2013 23:22:03 +0200
Ville Syrjälä <ville.syrjala at linux.intel.com> wrote:
> So now the problem is now that we have to calculate max_pixclk before
> intel_crtc->config has been update for modeset_pipes.
>
> If we make intel_mode_max_pixclk() and valleyview_modeset_global_pipes() like so:
>
> static int intel_mode_max_pixclk(struct drm_i915_private *dev_priv,
> unsigned int modeset_pipes,
> struct intel_crtc_config *pipe_config)
> {
> struct drm_device *dev = dev_priv->dev;
> struct intel_crtc *intel_crtc;
> int max_pixclk = 0;
>
> list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list, base.head) {
> if (!intel_crtc->base.enabled)
> continue;
>
> if (modeset_pipes & (1 << intel_crtc_pipe))
> max_pixclk = max(max_pixclk, pipe_config->adjusted_mode.crtc_clock);
> else
> max_pixclk = max(max_pixclk, intel_crtc->config.adjusted_mode.crtc_clock);
> }
>
> return max_pixclk;
> }
>
> static void valleyview_modeset_global_pipes(struct drm_device *dev,
> unsigned *prepare_pipes,
> unsigned int modeset_pipes,
> struct intel_crtc_config *pipe_config)
> {
> struct drm_i915_private *dev_priv = dev->dev_private;
> struct intel_crtc *intel_crtc;
> int max_pixclk = intel_mode_max_pixclk(dev_priv, modeset_pipes, pipe_config);
> int cur_cdclk = valleyview_cur_cdclk(dev_priv);
>
> if (valleyview_calc_cdclk(dev_priv, max_pixclk) == cur_cdclk)
> return;
>
> list_for_each_entry(intel_crtc, &dev->mode_config.crtc_list,
> base.head)
> if (intel_crtc->base.enabled)
> *prepare_pipes |= (1 << intel_crtc->pipe);
> }
>
> And then we calculate it after the new pipe config has been computed like so:
>
> ...
> if (modeset_pipes) {
> pipe_config = intel_modeset_pipe_config(crtc, fb, mode);
> if (IS_ERR(pipe_config)) {
> ret = PTR_ERR(pipe_config);
> pipe_config = NULL;
>
> goto out;
> }
> intel_dump_pipe_config(to_intel_crtc(crtc), pipe_config,
> "[modeset]");
> }
>
> + if (IS_VALLEYVIEW(dev))
> + valleyview_modeset_global_pipes(dev, &prepare_pipes, modeset_pipes, pipe_config);
>
> for_each_intel_crtc_masked(dev, disable_pipes, intel_crtc)
> intel_crtc_disable(&intel_crtc->base);
> ...
>
>
> Then things should just work (tm).
>
Yeah, good catch. It should be safe to push it that late since we
disable the prepare_pipes just after this point.
Maybe once we have atomic mode setting this will all get easier. :)
--
Jesse Barnes, Intel Open Source Technology Center
More information about the Intel-gfx
mailing list