Skip to content

Commit 326b1e7

Browse files
committed
drm/i915/dp_mst: Add the MST topology state for modesetted CRTCs
Add the MST topology for a CRTC to the atomic state if the driver needs to force a modeset on the CRTC after the encoder compute config functions are called. Later the MST encoder's disable hook also adds the state, but that isn't guaranteed to work (since in that hook getting the state may fail, which can't be handled there). This should fix that, while a later patch fixes the use of the MST state in the disable hook. v2: Add missing forward struct declartions, caught by hdrtest. v3: Factor out intel_dp_mst_add_topology_state_for_connector() used later in the patchset. Cc: Lyude Paul <lyude@redhat.com> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: stable@vger.kernel.org # 6.1 Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> # v2 Reviewed-by: Lyude Paul <lyude@redhat.com> Acked-by: Lyude Paul <lyude@redhat.com> Acked-by: Daniel Vetter <daniel@ffwll.ch> Acked-by: Wayne Lin <wayne.lin@amd.com> Acked-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Imre Deak <imre.deak@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230206114856.2665066-1-imre.deak@intel.com
1 parent 467fbc7 commit 326b1e7

3 files changed

Lines changed: 69 additions & 0 deletions

File tree

drivers/gpu/drm/i915/display/intel_display.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5934,6 +5934,10 @@ int intel_modeset_all_pipes(struct intel_atomic_state *state,
59345934
if (ret)
59355935
return ret;
59365936

5937+
ret = intel_dp_mst_add_topology_state_for_crtc(state, crtc);
5938+
if (ret)
5939+
return ret;
5940+
59375941
ret = intel_atomic_add_affected_planes(state, crtc);
59385942
if (ret)
59395943
return ret;

drivers/gpu/drm/i915/display/intel_dp_mst.c

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,3 +1223,64 @@ bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state)
12231223
return crtc_state->mst_master_transcoder != INVALID_TRANSCODER &&
12241224
crtc_state->mst_master_transcoder != crtc_state->cpu_transcoder;
12251225
}
1226+
1227+
/**
1228+
* intel_dp_mst_add_topology_state_for_connector - add MST topology state for a connector
1229+
* @state: atomic state
1230+
* @connector: connector to add the state for
1231+
* @crtc: the CRTC @connector is attached to
1232+
*
1233+
* Add the MST topology state for @connector to @state.
1234+
*
1235+
* Returns 0 on success, negative error code on failure.
1236+
*/
1237+
static int
1238+
intel_dp_mst_add_topology_state_for_connector(struct intel_atomic_state *state,
1239+
struct intel_connector *connector,
1240+
struct intel_crtc *crtc)
1241+
{
1242+
struct drm_dp_mst_topology_state *mst_state;
1243+
1244+
if (!connector->mst_port)
1245+
return 0;
1246+
1247+
mst_state = drm_atomic_get_mst_topology_state(&state->base,
1248+
&connector->mst_port->mst_mgr);
1249+
if (IS_ERR(mst_state))
1250+
return PTR_ERR(mst_state);
1251+
1252+
mst_state->pending_crtc_mask |= drm_crtc_mask(&crtc->base);
1253+
1254+
return 0;
1255+
}
1256+
1257+
/**
1258+
* intel_dp_mst_add_topology_state_for_crtc - add MST topology state for a CRTC
1259+
* @state: atomic state
1260+
* @crtc: CRTC to add the state for
1261+
*
1262+
* Add the MST topology state for @crtc to @state.
1263+
*
1264+
* Returns 0 on success, negative error code on failure.
1265+
*/
1266+
int intel_dp_mst_add_topology_state_for_crtc(struct intel_atomic_state *state,
1267+
struct intel_crtc *crtc)
1268+
{
1269+
struct drm_connector *_connector;
1270+
struct drm_connector_state *conn_state;
1271+
int i;
1272+
1273+
for_each_new_connector_in_state(&state->base, _connector, conn_state, i) {
1274+
struct intel_connector *connector = to_intel_connector(_connector);
1275+
int ret;
1276+
1277+
if (conn_state->crtc != &crtc->base)
1278+
continue;
1279+
1280+
ret = intel_dp_mst_add_topology_state_for_connector(state, connector, crtc);
1281+
if (ret)
1282+
return ret;
1283+
}
1284+
1285+
return 0;
1286+
}

drivers/gpu/drm/i915/display/intel_dp_mst.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <linux/types.h>
1010

11+
struct intel_atomic_state;
12+
struct intel_crtc;
1113
struct intel_crtc_state;
1214
struct intel_digital_port;
1315
struct intel_dp;
@@ -18,5 +20,7 @@ int intel_dp_mst_encoder_active_links(struct intel_digital_port *dig_port);
1820
bool intel_dp_mst_is_master_trans(const struct intel_crtc_state *crtc_state);
1921
bool intel_dp_mst_is_slave_trans(const struct intel_crtc_state *crtc_state);
2022
bool intel_dp_mst_source_support(struct intel_dp *intel_dp);
23+
int intel_dp_mst_add_topology_state_for_crtc(struct intel_atomic_state *state,
24+
struct intel_crtc *crtc);
2125

2226
#endif /* __INTEL_DP_MST_H__ */

0 commit comments

Comments
 (0)