drm/i915/mst: split out a helper for figuring out the TU
Extract intel_dp_mtp_tu_compute_config() for figuring out the TU. Move the link configuration and mst state access to the callers. This will be easier to adapt to 128b/132b SST. v2: Don't add SST stuff here yet Reviewed-by: Imre Deak <imre.deak@intel.com> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/c3ea8370c9bd3cdc579159e68a63f4ed2fadc66a.1735912293.git.jani.nikula@intel.com
This commit is contained in:
@@ -209,31 +209,23 @@ static int intel_dp_mst_dsc_get_slice_count(const struct intel_connector *connec
|
||||
num_joined_pipes);
|
||||
}
|
||||
|
||||
static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
|
||||
struct intel_crtc_state *crtc_state,
|
||||
int max_bpp, int min_bpp,
|
||||
struct link_config_limits *limits,
|
||||
struct drm_connector_state *conn_state,
|
||||
int step, bool dsc)
|
||||
int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
|
||||
struct intel_crtc_state *crtc_state,
|
||||
int max_bpp, int min_bpp,
|
||||
struct drm_connector_state *conn_state,
|
||||
int step, bool dsc)
|
||||
{
|
||||
struct intel_display *display = to_intel_display(intel_dp);
|
||||
struct drm_atomic_state *state = crtc_state->uapi.state;
|
||||
struct drm_dp_mst_topology_state *mst_state;
|
||||
struct intel_connector *connector =
|
||||
to_intel_connector(conn_state->connector);
|
||||
const struct drm_display_mode *adjusted_mode =
|
||||
&crtc_state->hw.adjusted_mode;
|
||||
fixed20_12 pbn_div;
|
||||
int bpp, slots = -EINVAL;
|
||||
int dsc_slice_count = 0;
|
||||
int max_dpt_bpp;
|
||||
|
||||
mst_state = drm_atomic_get_mst_topology_state(state, &intel_dp->mst_mgr);
|
||||
if (IS_ERR(mst_state))
|
||||
return PTR_ERR(mst_state);
|
||||
|
||||
crtc_state->lane_count = limits->max_lane_count;
|
||||
crtc_state->port_clock = limits->max_rate;
|
||||
|
||||
if (dsc) {
|
||||
if (!intel_dp_supports_fec(intel_dp, connector, crtc_state))
|
||||
return -EINVAL;
|
||||
@@ -241,8 +233,8 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
|
||||
crtc_state->fec_enable = !intel_dp_is_uhbr(crtc_state);
|
||||
}
|
||||
|
||||
mst_state->pbn_div = drm_dp_get_vc_payload_bw(crtc_state->port_clock,
|
||||
crtc_state->lane_count);
|
||||
pbn_div = drm_dp_get_vc_payload_bw(crtc_state->port_clock,
|
||||
crtc_state->lane_count);
|
||||
|
||||
max_dpt_bpp = intel_dp_mst_max_dpt_bpp(crtc_state, dsc);
|
||||
if (max_bpp > max_dpt_bpp) {
|
||||
@@ -302,7 +294,7 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
|
||||
pbn.full = dfixed_const(intel_dp_mst_calc_pbn(adjusted_mode->crtc_clock,
|
||||
link_bpp_x16,
|
||||
remote_bw_overhead));
|
||||
remote_tu = DIV_ROUND_UP(pbn.full, mst_state->pbn_div.full);
|
||||
remote_tu = DIV_ROUND_UP(pbn.full, pbn_div.full);
|
||||
|
||||
/*
|
||||
* Aligning the TUs ensures that symbols consisting of multiple
|
||||
@@ -320,7 +312,7 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
|
||||
* allocated for the whole path and the TUs allocated for the
|
||||
* first branch device's link also applies here.
|
||||
*/
|
||||
pbn.full = remote_tu * mst_state->pbn_div.full;
|
||||
pbn.full = remote_tu * pbn_div.full;
|
||||
|
||||
drm_WARN_ON(display->drm, remote_tu < crtc_state->dp_m_n.tu);
|
||||
crtc_state->dp_m_n.tu = remote_tu;
|
||||
@@ -355,6 +347,31 @@ static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mst_stream_find_vcpi_slots_for_bpp(struct intel_dp *intel_dp,
|
||||
struct intel_crtc_state *crtc_state,
|
||||
int max_bpp, int min_bpp,
|
||||
struct link_config_limits *limits,
|
||||
struct drm_connector_state *conn_state,
|
||||
int step, bool dsc)
|
||||
{
|
||||
struct drm_atomic_state *state = crtc_state->uapi.state;
|
||||
struct drm_dp_mst_topology_state *mst_state;
|
||||
|
||||
mst_state = drm_atomic_get_mst_topology_state(state, &intel_dp->mst_mgr);
|
||||
if (IS_ERR(mst_state))
|
||||
return PTR_ERR(mst_state);
|
||||
|
||||
crtc_state->lane_count = limits->max_lane_count;
|
||||
crtc_state->port_clock = limits->max_rate;
|
||||
|
||||
mst_state->pbn_div = drm_dp_get_vc_payload_bw(crtc_state->port_clock,
|
||||
crtc_state->lane_count);
|
||||
|
||||
return intel_dp_mtp_tu_compute_config(intel_dp, crtc_state,
|
||||
max_bpp, min_bpp,
|
||||
conn_state, step, dsc);
|
||||
}
|
||||
|
||||
static int mst_stream_compute_link_config(struct intel_dp *intel_dp,
|
||||
struct intel_crtc_state *crtc_state,
|
||||
struct drm_connector_state *conn_state,
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
struct drm_connector_state;
|
||||
struct intel_atomic_state;
|
||||
struct intel_crtc;
|
||||
struct intel_crtc_state;
|
||||
@@ -30,4 +31,10 @@ bool intel_dp_mst_crtc_needs_modeset(struct intel_atomic_state *state,
|
||||
void intel_dp_mst_prepare_probe(struct intel_dp *intel_dp);
|
||||
bool intel_dp_mst_verify_dpcd_state(struct intel_dp *intel_dp);
|
||||
|
||||
int intel_dp_mtp_tu_compute_config(struct intel_dp *intel_dp,
|
||||
struct intel_crtc_state *crtc_state,
|
||||
int max_bpp, int min_bpp,
|
||||
struct drm_connector_state *conn_state,
|
||||
int step, bool dsc);
|
||||
|
||||
#endif /* __INTEL_DP_MST_H__ */
|
||||
|
||||
Reference in New Issue
Block a user