Commit b000abd3 authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Do .crtc_compute_clock() earlier

Currently we calculate a lot of things (pixel rate, watermarks,
cdclk) trusting that the DPLL can generate the exact frequency
we ask it. In practice that is not true and there can be
certain amount of rounding involved.

To allow us to eventually get accurate numbers for all our
DPLL clock derived state we need to move the DPLL calculation
to hapen much earlier. To that end we hoist it up to the just
after the fastset checks. For now we just do the easy code
motion, and the actual back feeding of the final DPLL clock
into the state will come later.

A slight change here is that now .crtc_compute_clock()
can get called while the shared_dpll is still assigned.
But since .crtc_compute_clock() no longer assignes new
shared_dplls this is perfectly fine.

TODO: I'd actually like to do this before the fastset check
so that if the DPLL state should change we actually do the
modeset. Which I think is what the video aficionados want,
but it might not be what the fans of fastboot want. Not yet
sure how to reconcile those conflicting requirements...

v2: s/return/goto/ in error handling
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220907091057.11572-6-ville.syrjala@linux.intel.com
parent e72df53d
...@@ -4820,10 +4820,6 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state, ...@@ -4820,10 +4820,6 @@ static int intel_crtc_atomic_check(struct intel_atomic_state *state,
crtc_state->update_wm_post = true; crtc_state->update_wm_post = true;
if (mode_changed) { if (mode_changed) {
ret = intel_dpll_crtc_compute_clock(state, crtc);
if (ret)
return ret;
ret = intel_dpll_crtc_get_shared_dpll(state, crtc); ret = intel_dpll_crtc_get_shared_dpll(state, crtc);
if (ret) if (ret)
return ret; return ret;
...@@ -6912,6 +6908,11 @@ static int intel_atomic_check(struct drm_device *dev, ...@@ -6912,6 +6908,11 @@ static int intel_atomic_check(struct drm_device *dev,
new_crtc_state, i) { new_crtc_state, i) {
if (intel_crtc_needs_modeset(new_crtc_state)) { if (intel_crtc_needs_modeset(new_crtc_state)) {
any_ms = true; any_ms = true;
ret = intel_dpll_crtc_compute_clock(state, crtc);
if (ret)
goto fail;
continue; continue;
} }
......
...@@ -1411,9 +1411,6 @@ int intel_dpll_crtc_compute_clock(struct intel_atomic_state *state, ...@@ -1411,9 +1411,6 @@ int intel_dpll_crtc_compute_clock(struct intel_atomic_state *state,
drm_WARN_ON(&i915->drm, !intel_crtc_needs_modeset(crtc_state)); drm_WARN_ON(&i915->drm, !intel_crtc_needs_modeset(crtc_state));
if (drm_WARN_ON(&i915->drm, crtc_state->shared_dpll))
return 0;
memset(&crtc_state->dpll_hw_state, 0, memset(&crtc_state->dpll_hw_state, 0,
sizeof(crtc_state->dpll_hw_state)); sizeof(crtc_state->dpll_hw_state));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment