> Subject: [PATCH v2 05/34] drm/i915/dp_link_caps: Add helper to get iteration > order for a connector > > Add helper to select the link configuration iteration order for a connector > during state computation and fallback selection. This keeps the connector- > specific ordering policy in the link caps module. > > v2: Add helper to get the order for fallback selection as well. > > Signed-off-by: Imre Deak <[email protected]>
LGTM, Reviewed-by: Suraj Kandpal <[email protected]> > --- > .../gpu/drm/i915/display/intel_dp_link_caps.c | 50 +++++++++++++++++++ > .../gpu/drm/i915/display/intel_dp_link_caps.h | 5 ++ > 2 files changed, 55 insertions(+) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c > b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c > index d46b9d505a847..36895dd9d6c81 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.c > @@ -160,6 +160,56 @@ static struct intel_dp_link_caps_order > bw_desc_config_order(void) > return order; > } > > +static enum intel_dp_link_caps_order_key > +connector_compute_order_key(bool is_mst) { > + if (is_mst) > + return INTEL_DP_LINK_CAPS_ORDER_KEY_BW; > + else > + return INTEL_DP_LINK_CAPS_ORDER_KEY_RATE_LANE; > +} > + > +static enum intel_dp_link_caps_order_key > +connector_fallback_order_key(bool is_mst) { > + if (is_mst) > + return INTEL_DP_LINK_CAPS_ORDER_KEY_BW; > + else > + return INTEL_DP_LINK_CAPS_ORDER_KEY_LANE_RATE; > +} > + > +static enum intel_dp_link_caps_order_direction > +connector_compute_order_dir(bool is_mst, bool use_max_params) { > + if (is_mst || use_max_params) > + return INTEL_DP_LINK_CAPS_ORDER_DIR_DESC; > + else > + return INTEL_DP_LINK_CAPS_ORDER_DIR_ASC; } > + > +struct intel_dp_link_caps_order > +intel_dp_link_caps_connector_compute_order(struct intel_connector > +*connector) { > + struct intel_dp *intel_dp = intel_attached_dp(connector); > + struct intel_dp_link_caps_order order = { > + .key = connector_compute_order_key(connector->mst.dp), > + .dir = connector_compute_order_dir(connector->mst.dp, > intel_dp->use_max_params) > + }; > + > + return order; > +} > + > +struct intel_dp_link_caps_order > +intel_dp_link_caps_connector_fallback_order(bool is_mst) { > + struct intel_dp_link_caps_order order = { > + .key = connector_fallback_order_key(is_mst), > + .dir = INTEL_DP_LINK_CAPS_ORDER_DIR_DESC, > + }; > + > + return order; > +} > + > /* Get length of common rates array potentially limited by max_rate. */ int > intel_dp_common_len_rate_limit(struct intel_dp_link_caps *link_caps, > int max_rate) > diff --git a/drivers/gpu/drm/i915/display/intel_dp_link_caps.h > b/drivers/gpu/drm/i915/display/intel_dp_link_caps.h > index 5ea87f112c13a..79aca74ad9eee 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_link_caps.h > +++ b/drivers/gpu/drm/i915/display/intel_dp_link_caps.h > @@ -113,6 +113,11 @@ void intel_dp_link_caps_iter_start(struct > intel_dp_link_caps_iter *iter, > > void intel_dp_link_caps_iter_end(struct intel_dp_link_caps_iter *iter); > > +struct intel_dp_link_caps_order > +intel_dp_link_caps_connector_compute_order(struct intel_connector > +*connector); struct intel_dp_link_caps_order > +intel_dp_link_caps_connector_fallback_order(bool is_mst); > + > int intel_dp_common_len_rate_limit(struct intel_dp_link_caps *link_caps, > int max_rate); > int intel_dp_common_rate(struct intel_dp_link_caps *link_caps, int index); > -- > 2.49.1
