Skip to content

Commit e24bcd3

Browse files
Manasi Navareuma-intel
authored andcommitted
drm/i915/dp: Add all tiled and port sync conns to modeset
If one of the synced crtcs needs a full modeset, we need to make sure all the synced crtcs are forced a full modeset. v3: * Remove ~BIT(cpu_trans) which is a nop (Ville) * use get_new_crtc_state and remove error check (Ville) v2: * Add tiles based on cpu_trans check (Ville) Suggested-by: Ville Syrjälä <[email protected]> Cc: Ville Syrjälä <[email protected]> Signed-off-by: Manasi Navare <[email protected]> Reviewed-by: Ville Syrjälä <[email protected]> Signed-off-by: Uma Shankar <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent b50a1aa commit e24bcd3

File tree

2 files changed

+135
-86
lines changed

2 files changed

+135
-86
lines changed

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

Lines changed: 0 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -14694,76 +14694,6 @@ static bool intel_cpu_transcoders_need_modeset(struct intel_atomic_state *state,
1469414694
return false;
1469514695
}
1469614696

14697-
static int
14698-
intel_modeset_all_tiles(struct intel_atomic_state *state, int tile_grp_id)
14699-
{
14700-
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
14701-
struct drm_connector *connector;
14702-
struct drm_connector_list_iter conn_iter;
14703-
int ret = 0;
14704-
14705-
drm_connector_list_iter_begin(&dev_priv->drm, &conn_iter);
14706-
drm_for_each_connector_iter(connector, &conn_iter) {
14707-
struct drm_connector_state *conn_state;
14708-
struct drm_crtc_state *crtc_state;
14709-
14710-
if (!connector->has_tile ||
14711-
connector->tile_group->id != tile_grp_id)
14712-
continue;
14713-
conn_state = drm_atomic_get_connector_state(&state->base,
14714-
connector);
14715-
if (IS_ERR(conn_state)) {
14716-
ret = PTR_ERR(conn_state);
14717-
break;
14718-
}
14719-
14720-
if (!conn_state->crtc)
14721-
continue;
14722-
14723-
crtc_state = drm_atomic_get_crtc_state(&state->base,
14724-
conn_state->crtc);
14725-
if (IS_ERR(crtc_state)) {
14726-
ret = PTR_ERR(crtc_state);
14727-
break;
14728-
}
14729-
crtc_state->mode_changed = true;
14730-
ret = drm_atomic_add_affected_connectors(&state->base,
14731-
conn_state->crtc);
14732-
if (ret)
14733-
break;
14734-
}
14735-
drm_connector_list_iter_end(&conn_iter);
14736-
14737-
return ret;
14738-
}
14739-
14740-
static int
14741-
intel_atomic_check_tiled_conns(struct intel_atomic_state *state)
14742-
{
14743-
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
14744-
struct drm_connector *connector;
14745-
struct drm_connector_state *old_conn_state, *new_conn_state;
14746-
int i, ret;
14747-
14748-
if (INTEL_GEN(dev_priv) < 11)
14749-
return 0;
14750-
14751-
/* Is tiled, mark all other tiled CRTCs as needing a modeset */
14752-
for_each_oldnew_connector_in_state(&state->base, connector,
14753-
old_conn_state, new_conn_state, i) {
14754-
if (!connector->has_tile)
14755-
continue;
14756-
if (!intel_connector_needs_modeset(state, connector))
14757-
continue;
14758-
14759-
ret = intel_modeset_all_tiles(state, connector->tile_group->id);
14760-
if (ret)
14761-
return ret;
14762-
}
14763-
14764-
return 0;
14765-
}
14766-
1476714697
/**
1476814698
* intel_atomic_check - validate state object
1476914699
* @dev: drm device
@@ -14792,21 +14722,6 @@ static int intel_atomic_check(struct drm_device *dev,
1479214722
if (ret)
1479314723
goto fail;
1479414724

14795-
/**
14796-
* This check adds all the connectors in current state that belong to
14797-
* the same tile group to a full modeset.
14798-
* This function directly sets the mode_changed to true and we also call
14799-
* drm_atomic_add_affected_connectors(). Hence we are not explicitly
14800-
* calling drm_atomic_helper_check_modeset() after this.
14801-
*
14802-
* Fixme: Handle some corner cases where one of the
14803-
* tiled connectors gets disconnected and tile info is lost but since it
14804-
* was previously synced to other conn, we need to add that to the modeset.
14805-
*/
14806-
ret = intel_atomic_check_tiled_conns(state);
14807-
if (ret)
14808-
goto fail;
14809-
1481014725
for_each_oldnew_intel_crtc_in_state(state, crtc, old_crtc_state,
1481114726
new_crtc_state, i) {
1481214727
if (!needs_modeset(new_crtc_state)) {

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

Lines changed: 135 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6585,6 +6585,140 @@ void intel_dp_encoder_reset(struct drm_encoder *encoder)
65856585
}
65866586
}
65876587

6588+
static int intel_modeset_tile_group(struct intel_atomic_state *state,
6589+
int tile_group_id)
6590+
{
6591+
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
6592+
struct drm_connector_list_iter conn_iter;
6593+
struct drm_connector *connector;
6594+
int ret = 0;
6595+
6596+
drm_connector_list_iter_begin(&dev_priv->drm, &conn_iter);
6597+
drm_for_each_connector_iter(connector, &conn_iter) {
6598+
struct drm_connector_state *conn_state;
6599+
struct intel_crtc_state *crtc_state;
6600+
struct intel_crtc *crtc;
6601+
6602+
if (!connector->has_tile ||
6603+
connector->tile_group->id != tile_group_id)
6604+
continue;
6605+
6606+
conn_state = drm_atomic_get_connector_state(&state->base,
6607+
connector);
6608+
if (IS_ERR(conn_state)) {
6609+
ret = PTR_ERR(conn_state);
6610+
break;
6611+
}
6612+
6613+
crtc = to_intel_crtc(conn_state->crtc);
6614+
6615+
if (!crtc)
6616+
continue;
6617+
6618+
crtc_state = intel_atomic_get_new_crtc_state(state, crtc);
6619+
crtc_state->uapi.mode_changed = true;
6620+
6621+
ret = drm_atomic_add_affected_planes(&state->base, &crtc->base);
6622+
if (ret)
6623+
break;
6624+
}
6625+
drm_connector_list_iter_begin(&dev_priv->drm, &conn_iter);
6626+
6627+
return ret;
6628+
}
6629+
6630+
static int intel_modeset_affected_transcoders(struct intel_atomic_state *state, u8 transcoders)
6631+
{
6632+
struct drm_i915_private *dev_priv = to_i915(state->base.dev);
6633+
struct intel_crtc *crtc;
6634+
6635+
if (transcoders == 0)
6636+
return 0;
6637+
6638+
for_each_intel_crtc(&dev_priv->drm, crtc) {
6639+
struct intel_crtc_state *crtc_state;
6640+
int ret;
6641+
6642+
crtc_state = intel_atomic_get_crtc_state(&state->base, crtc);
6643+
if (IS_ERR(crtc_state))
6644+
return PTR_ERR(crtc_state);
6645+
6646+
if (!crtc_state->hw.enable)
6647+
continue;
6648+
6649+
if (!(transcoders & BIT(crtc_state->cpu_transcoder)))
6650+
continue;
6651+
6652+
crtc_state->uapi.mode_changed = true;
6653+
6654+
ret = drm_atomic_add_affected_connectors(&state->base, &crtc->base);
6655+
if (ret)
6656+
return ret;
6657+
6658+
ret = drm_atomic_add_affected_planes(&state->base, &crtc->base);
6659+
if (ret)
6660+
return ret;
6661+
6662+
transcoders &= ~BIT(crtc_state->cpu_transcoder);
6663+
}
6664+
6665+
WARN_ON(transcoders != 0);
6666+
6667+
return 0;
6668+
}
6669+
6670+
static int intel_modeset_synced_crtcs(struct intel_atomic_state *state,
6671+
struct drm_connector *connector)
6672+
{
6673+
const struct drm_connector_state *old_conn_state =
6674+
drm_atomic_get_old_connector_state(&state->base, connector);
6675+
const struct intel_crtc_state *old_crtc_state;
6676+
struct intel_crtc *crtc;
6677+
u8 transcoders;
6678+
6679+
crtc = to_intel_crtc(old_conn_state->crtc);
6680+
if (!crtc)
6681+
return 0;
6682+
6683+
old_crtc_state = intel_atomic_get_old_crtc_state(state, crtc);
6684+
6685+
if (!old_crtc_state->hw.active)
6686+
return 0;
6687+
6688+
transcoders = old_crtc_state->sync_mode_slaves_mask;
6689+
if (old_crtc_state->master_transcoder != INVALID_TRANSCODER)
6690+
transcoders |= BIT(old_crtc_state->master_transcoder);
6691+
6692+
return intel_modeset_affected_transcoders(state,
6693+
transcoders);
6694+
}
6695+
6696+
static int intel_dp_connector_atomic_check(struct drm_connector *conn,
6697+
struct drm_atomic_state *_state)
6698+
{
6699+
struct drm_i915_private *dev_priv = to_i915(conn->dev);
6700+
struct intel_atomic_state *state = to_intel_atomic_state(_state);
6701+
int ret;
6702+
6703+
ret = intel_digital_connector_atomic_check(conn, &state->base);
6704+
if (ret)
6705+
return ret;
6706+
6707+
if (INTEL_GEN(dev_priv) < 11)
6708+
return 0;
6709+
6710+
if (!intel_connector_needs_modeset(state, conn))
6711+
return 0;
6712+
6713+
if (conn->has_tile) {
6714+
ret = intel_modeset_tile_group(state, conn->tile_group->id);
6715+
if (ret)
6716+
return ret;
6717+
}
6718+
6719+
return intel_modeset_synced_crtcs(state, conn);
6720+
}
6721+
65886722
static const struct drm_connector_funcs intel_dp_connector_funcs = {
65896723
.force = intel_dp_force,
65906724
.fill_modes = drm_helper_probe_single_connector_modes,
@@ -6601,7 +6735,7 @@ static const struct drm_connector_helper_funcs intel_dp_connector_helper_funcs =
66016735
.detect_ctx = intel_dp_detect,
66026736
.get_modes = intel_dp_get_modes,
66036737
.mode_valid = intel_dp_mode_valid,
6604-
.atomic_check = intel_digital_connector_atomic_check,
6738+
.atomic_check = intel_dp_connector_atomic_check,
66056739
};
66066740

66076741
static const struct drm_encoder_funcs intel_dp_enc_funcs = {

0 commit comments

Comments
 (0)