// SPDX-License-Identifier: MIT /* * Copyright © 2023 Intel Corporation */ #include <drm/drm_fixed.h> #include "i915_drv.h" #include "intel_atomic.h" #include "intel_crtc.h" #include "intel_display_types.h" #include "intel_dp_mst.h" #include "intel_dp_tunnel.h" #include "intel_fdi.h" #include "intel_link_bw.h" /** * intel_link_bw_init_limits - initialize BW limits * @state: Atomic state * @limits: link BW limits * * Initialize @limits. */ void intel_link_bw_init_limits(struct intel_atomic_state *state, struct intel_link_bw_limits *limits) { … } /** * intel_link_bw_reduce_bpp - reduce maximum link bpp for a selected pipe * @state: atomic state * @limits: link BW limits * @pipe_mask: mask of pipes to select from * @reason: explanation of why bpp reduction is needed * * Select the pipe from @pipe_mask with the biggest link bpp value and set the * maximum of link bpp in @limits below this value. Modeset the selected pipe, * so that its state will get recomputed. * * This function can be called to resolve a link's BW overallocation by reducing * the link bpp of one pipe on the link and hence reducing the total link BW. * * Returns * - 0 in case of success * - %-ENOSPC if no pipe can further reduce its link bpp * - Other negative error, if modesetting the selected pipe failed */ int intel_link_bw_reduce_bpp(struct intel_atomic_state *state, struct intel_link_bw_limits *limits, u8 pipe_mask, const char *reason) { … } /** * intel_link_bw_set_bpp_limit_for_pipe - set link bpp limit for a pipe to its minimum * @state: atomic state * @old_limits: link BW limits * @new_limits: link BW limits * @pipe: pipe * * Set the link bpp limit for @pipe in @new_limits to its value in * @old_limits and mark this limit as the minimum. This function must be * called after a pipe's compute config function failed, @old_limits * containing the bpp limit with which compute config previously passed. * * The function will fail if setting a minimum is not possible, either * because the old and new limits match (and so would lead to a pipe compute * config failure) or the limit is already at the minimum. * * Returns %true in case of success. */ bool intel_link_bw_set_bpp_limit_for_pipe(struct intel_atomic_state *state, const struct intel_link_bw_limits *old_limits, struct intel_link_bw_limits *new_limits, enum pipe pipe) { … } static int check_all_link_config(struct intel_atomic_state *state, struct intel_link_bw_limits *limits) { … } static bool assert_link_limit_change_valid(struct intel_display *display, const struct intel_link_bw_limits *old_limits, const struct intel_link_bw_limits *new_limits) { … } /** * intel_link_bw_atomic_check - check display link states and set a fallback config if needed * @state: atomic state * @new_limits: link BW limits * * Check the configuration of all shared display links in @state and set new BW * limits in @new_limits if there is a BW limitation. * * Returns: * - 0 if the confugration is valid * - %-EAGAIN, if the configuration is invalid and @new_limits got updated * with fallback values with which the configuration of all CRTCs * in @state must be recomputed * - Other negative error, if the configuration is invalid without a * fallback possibility, or the check failed for another reason */ int intel_link_bw_atomic_check(struct intel_atomic_state *state, struct intel_link_bw_limits *new_limits) { … }