• Ville Syrjälä's avatar
    drm/i915: Fix TV encoder clock computation · 1bba5543
    Ville Syrjälä authored
    The TV encoder has its own special clocking strategy,
    which means we can't just use intel_crtc_dotclock() to
    figure out what the resulting dotclock will be given
    the actual DPLL port_clock. Additionally the DPLL can't
    always generate exactly the frequency we initially asked
    for. This results in us computing a bogus dotclock/etc.,
    and it won't match the readout which is handled by the
    encoder itself properly. Naturally the state checker
    becomes unhappy with the mismatch.
    
    To do this sanely we'll need to move the DPLL computation
    into encoder->compute_config() so that all the derived
    state gets correctly computed based on the actual DPLL
    output frequency. Start doing that just for the TV encoder
    initally as intel_crtc_dotclock() should be able to handle
    other encoder types well enough. Though eventually this
    should be done for all encoder types rather than
    doing it from intel_crtc_compute_config().
    
    With this we actually do some of the DPLL state computation
    twice, but we can skip the second actual .find_dpll() search
    by flagging .clock_set=true after we've done it once. We also
    still need to avoid clobbering the correct
    adjusted_mode.crtc_clock set up by encoder->compute_config()
    when called a second time from intel_crtc_compute_config().
    
    Fixes: 665a7b04 ("drm/i915: Feed the DPLL output freq back into crtc_state")
    Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20220909205932.32537-1-ville.syrjala@linux.intel.comAcked-by: default avatarJani Nikula <jani.nikula@intel.com>
    1bba5543
intel_dpll.c 58.8 KB