• Imre Deak's avatar
    drm/i915: Add helpers for BW management on shared display links · 8ca0b875
    Imre Deak authored
    At the moment a modeset fails if the config computation of a pipe can't
    fit its required BW to the available link BW even though the limitation
    may be resolved by reducing the BW requirement of other pipes.
    
    To improve the above this patch adds helper functions checking the
    overall BW limits after all CRTC states have been computed. If the check
    fails the maximum link bpp for a selected pipe will be reduced and all
    the CRTC states will be recomputed until either the overall BW limit
    check passes, or further bpp reduction is not possible (because all
    pipes/encoders sharing the link BW reached their minimum link bpp).
    
    Atm, the MST encoder allocates twice the required BW for YUV420 format
    streams. A follow-up patchset will fix that, add a code comment about
    this.
    
    This change prepares for upcoming patches enabling the above BW
    management on FDI and MST links.
    
    v2:
    - Rename intel_crtc_state::max_link_bpp to max_link_bpp_x16 and
      intel_link_bw_limits::max_bpp to max_bpp_x16. (Jani)
    v3:
    - Add the helper functions in a separate patch. (Ville)
    - Add the functions to intel_link_bw.c instead of intel_atomic.c (Ville)
    - Return -ENOSPC instead of -EINVAL to userspace in case of a link BW
      limit failure.
    v4:
    - Make intel_atomic_check_config() static.
    v5: (Ville)
    - Rename intel_link_bw_limits::min_bpp_pipes to min_bpp_reached_pipes
      and intel_link_bw_reset_pipe_limit_to_min() to
      intel_link_bw_set_min_bpp_for_pipe().
    - Rename pipe_bpp to link_bpp in intel_link_bw_reduce_bpp().
    - Add FIXME: comment about MST encoder's YUV420 BW allocation and
      tracking the link bpp limit accordingly.
    v6:
    - Move intel_link_bw_compute_pipe_bpp() to intel_fdi.c (Ville)
    - WARN_ON(BIT(pipe) & min_bpp_reached_pipes) in
      intel_link_bw_set_bpp_limit_for_pipe(). (Ville)
    - Rename intel_link_bw_set_min_bpp_for_pipe() to
      intel_link_bw_set_bpp_limit_for_pipe() and
      intel_link_bw_limits::min_bpp_reached_pipes to
      bpp_limit_reached_pipes. (Ville)
    - Remove unused header includes.
    
    Cc: Jani Nikula <jani.nikula@linux.intel.com>
    Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
    Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
    Signed-off-by: default avatarImre Deak <imre.deak@intel.com>
    Link: https://patchwork.freedesktop.org/patch/msgid/20230921195159.2646027-10-imre.deak@intel.com
    8ca0b875
intel_display.c 240 KB