drm/i915: Introduce intel_crtc_state_alloc()
Subsystems (3)
PATCH v6 1/8 drm/i915: Introduce intel_crtc_state_alloc()
From: Ville Syrjälä <[email protected]>
We have several places where we want to allocate a pristine crtc state. Some of those currently call intel_crtc_state_reset() to properly initialize all the non-zero defaults in the state, but some places do not. Let's add intel_crtc_state_alloc() to do both the alloc and the reset, and call that everywhere we need a fresh crtc state.
--- drivers/gpu/drm/i915/display/intel_display.c | 30 +++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +19 -11
@@ -168,6 +168,7 @@ static void skylake_pfit_enable(const struct intel_crtc_state *crtc_state);static void ironlake_pfit_enable (const struct intel_crtc_state *crtc_state);static void intel_modeset_setup_hw_state (struct drm_device *dev,struct drm_modeset_acquire_ctx *ctx); +static struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc); struct intel_limit { struct {
@@ -8051,11 +8052,10 @@ int vlv_force_pll_on(struct drm_i915_private *dev_priv, enum pipe pipe,struct intel_crtc *crtc =intel_get_crtc_for_pipe (dev_priv, pipe);struct intel_crtc_state *pipe_config; - pipe_config =kzalloc (sizeof (*pipe_config),GFP_KERNEL ); + pipe_config =intel_crtc_state_alloc (crtc);if (!pipe_config)return -ENOMEM ; - pipe_config->uapi.crtc = &crtc->base; pipe_config->cpu_transcoder = (enum transcoder )pipe; pipe_config->pixel_multiplier =1 ; pipe_config->dpll = *dpll;
@@ -11646,6 +11646,18 @@ static void intel_crtc_state_reset(struct intel_crtc_state *crtc_state, crtc_state->scaler_state.scaler_id =-1 ; } +static struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc) +{ +struct intel_crtc_state *crtc_state; + + crtc_state =kzalloc (sizeof (*crtc_state),GFP_KERNEL ); + +if (crtc_state) +intel_crtc_state_reset (crtc_state, crtc); + +return crtc_state; +} +/* Returns the currently programmed mode of the given encoder. */ struct drm_display_mode *intel_encoder_current_mode (struct intel_encoder *encoder)
@@ -11665,14 +11677,12 @@ intel_encoder_current_mode(struct intel_encoder *encoder)if (!mode)return NULL ; - crtc_state =kzalloc (sizeof (*crtc_state),GFP_KERNEL ); + crtc_state =intel_crtc_state_alloc (crtc);if (!crtc_state) {kfree (mode);return NULL ; } -intel_crtc_state_reset (crtc_state, crtc); -if (!dev_priv->display.get_pipe_config (crtc, crtc_state)) {kfree (crtc_state);kfree (mode);
@@ -12609,11 +12619,11 @@ static void intel_crtc_copy_hw_to_uapi_state(struct intel_crtc_state *crtc_statestatic int intel_crtc_prepare_cleared_state (struct intel_crtc_state *crtc_state) { -struct drm_i915_private *dev_priv = -to_i915 (crtc_state->uapi.crtc->dev); +struct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);struct intel_crtc_state *saved_state; - saved_state =kzalloc (sizeof (*saved_state),GFP_KERNEL ); + saved_state =intel_crtc_state_alloc (crtc);if (!saved_state)return -ENOMEM ;
@@ -15734,14 +15744,12 @@ static struct intel_crtc *intel_crtc_alloc(void)if (!crtc)return ERR_PTR (-ENOMEM ); - crtc_state =kzalloc (sizeof (*crtc_state),GFP_KERNEL ); + crtc_state =intel_crtc_state_alloc (crtc);if (!crtc_state) {kfree (crtc);return ERR_PTR (-ENOMEM ); } -intel_crtc_state_reset (crtc_state, crtc); - crtc->base.state = &crtc_state->uapi; crtc->config = crtc_state;
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 2/8 drm/i915/display: Share intel_connector_needs_modeset()
intel_connector_needs_modeset() will be used outside of intel_display.c in a future patch so it would only be necessary to remove the state and add the prototype to the header file.
But while at it, I simplified the arguments and moved it to a better place intel_atomic.c.
No behavior changes intended here.
v3:
- removed digital from exported version of intel_connector_needs_modeset
- rollback connector to drm type
v4:
- Renamed new_connector_state to new_conn_state
- Going back to drm_connector_state in intel_encoders_update_prepare/complete as we also have intel_tv_connector_state
--- drivers/gpu/drm/i915/display/intel_atomic.c | 18 ++++++++ drivers/gpu/drm/i915/display/intel_atomic.h | 2 + drivers/gpu/drm/i915/display/intel_display.c | 45 ++++++-------------- 3 files changed, 34 insertions(+), 31 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic.c +18 -0
@@ -174,6 +174,24 @@ intel_digital_connector_duplicate_state(struct drm_connector *connector)return &state->base; } +/** +* intel_connector_needs_modeset - check if connector needs a modeset +*/ +bool +intel_connector_needs_modeset (struct intel_atomic_state *state, +struct drm_connector *connector) +{ +const struct drm_connector_state *old_conn_state, *new_conn_state; + + old_conn_state =drm_atomic_get_old_connector_state (&state->base, connector); + new_conn_state =drm_atomic_get_new_connector_state (&state->base, connector); + +return old_conn_state->crtc != new_conn_state->crtc || + (new_conn_state->crtc && +drm_atomic_crtc_needs_modeset (drm_atomic_get_new_crtc_state (&state->base, + new_conn_state->crtc))); +} +/** * intel_crtc_duplicate_state - duplicate crtc state * @crtc: drm crtc
drivers/gpu/drm/i915/display/intel_atomic.h +2 -0
@@ -32,6 +32,8 @@ int intel_digital_connector_atomic_check(struct drm_connector *conn, struct drm_atomic_state *state);struct drm_connector_state *intel_digital_connector_duplicate_state (struct drm_connector *connector); +bool intel_connector_needs_modeset (struct intel_atomic_state *state, +struct drm_connector *connector);struct drm_crtc_state *intel_crtc_duplicate_state (struct drm_crtc *crtc); void intel_crtc_destroy_state(struct drm_crtc *crtc,
drivers/gpu/drm/i915/display/intel_display.c +14 -31
75 lines not on this page · raw message
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 3/8 drm/i915/tgl: Select master transcoder for MST stream
In reply to José Roberto de SouzaOn TGL the blending of all the streams have moved from DDI to transcoder, so now every transcoder working over the same MST port must send its stream to a master transcoder and master will send to DDI respecting the time slots.
So here adding all the CRTCs that shares the same MST stream if needed and computing their state again, it will pick the lowest pipe/transcoder among the ones in the same stream to be master.
Most of the time skl_commit_modeset_enables() enables pipes in a crescent order but due DDB overlapping it might not happen, this scenarios will be handled in the next patch.
v2:
- Using recently added intel_crtc_state_reset() to set mst_master_transcoder to invalid transcoder for all non gen12 & MST code paths
- Setting lowest pipe/transcoder as master, previously it was the first one but setting a predictable one will help in future MST e port sync integration
- Moving to intel type as much as we can
v3:
- Now intel_dp_mst_master_trans_compute() returns the MST master transcoder
- Replaced stdbool.h by linux/types.h
- Skip the connector being checked in intel_dp_mst_atomic_master_trans_check()
- Using pipe instead of transcoder to compute MST master
v4:
- renamed connector_state to conn_state
v5:
- Improved the parameters of intel_dp_mst_master_trans_compute() to simply code
- Added call drm_atomic_add_affected_planes() in intel_dp_mst_atomic_master_trans_check() as helper could not do it for us
- Removed "if (ret)" left over from v3 changes
v6:
- handled ret == I915_MAX_PIPES case in compute
BSpec: 50493
BSpec: 49190
--- drivers/gpu/drm/i915/display/intel_atomic.c | 14 ++ drivers/gpu/drm/i915/display/intel_atomic.h | 4 + drivers/gpu/drm/i915/display/intel_ddi.c | 14 +- drivers/gpu/drm/i915/display/intel_display.c | 12 +- .../drm/i915/display/intel_display_types.h | 3 + drivers/gpu/drm/i915/display/intel_dp_mst.c | 143 ++++++++++++++++-- drivers/gpu/drm/i915/display/intel_dp_mst.h | 5 + 7 files changed, 182 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/display/intel_atomic.c +14 -0
@@ -192,6 +192,20 @@ intel_connector_needs_modeset(struct intel_atomic_state *state, new_conn_state->crtc))); } +struct intel_digital_connector_state * +intel_atomic_get_digital_connector_state (struct intel_atomic_state *state, +struct intel_connector *connector) +{ +struct drm_connector_state *conn_state; + + conn_state =drm_atomic_get_connector_state (&state->base, + &connector->base); +if (IS_ERR (conn_state)) +return ERR_CAST (conn_state); + +return to_intel_digital_connector_state (conn_state); +} +/** * intel_crtc_duplicate_state - duplicate crtc state * @crtc: drm crtc
drivers/gpu/drm/i915/display/intel_atomic.h +4 -0
@@ -17,6 +17,7 @@ struct drm_device;struct drm_i915_private ;struct drm_property ;struct intel_atomic_state ; +struct intel_connector ;struct intel_crtc ;struct intel_crtc_state ;
@@ -34,6 +35,9 @@ struct drm_connector_state * intel_digital_connector_duplicate_state(struct drm_connector *connector);bool intel_connector_needs_modeset (struct intel_atomic_state *state,struct drm_connector *connector); +struct intel_digital_connector_state * +intel_atomic_get_digital_connector_state (struct intel_atomic_state *state, +struct intel_connector *connector);struct drm_crtc_state *intel_crtc_duplicate_state (struct drm_crtc *crtc); void intel_crtc_destroy_state(struct drm_crtc *crtc,
drivers/gpu/drm/i915/display/intel_ddi.c +12 -2
@@ -1899,8 +1899,13 @@ intel_ddi_transcoder_func_reg_val_get(const struct intel_crtc_state *crtc_state) temp |=TRANS_DDI_MODE_SELECT_DP_MST ; temp |=DDI_PORT_WIDTH (crtc_state->lane_count); -if (INTEL_GEN (dev_priv) >=12 ) - temp |=TRANS_DDI_MST_TRANSPORT_SELECT (crtc_state->cpu_transcoder); +if (INTEL_GEN (dev_priv) >=12 ) { +enum transcoder master; + + master = crtc_state->mst_master_transcoder; +WARN_ON (master ==INVALID_TRANSCODER ); + temp |=TRANS_DDI_MST_TRANSPORT_SELECT (master); + } }else { temp |=TRANS_DDI_MODE_SELECT_DP_SST ; temp |=DDI_PORT_WIDTH (crtc_state->lane_count);
@@ -4405,6 +4410,11 @@ void intel_ddi_get_config(struct intel_encoder *encoder, pipe_config->output_types |=BIT (INTEL_OUTPUT_DP_MST ); pipe_config->lane_count = ((temp &DDI_PORT_WIDTH_MASK ) >>DDI_PORT_WIDTH_SHIFT ) +1 ; + +if (INTEL_GEN (dev_priv) >=12 ) + pipe_config->mst_master_transcoder = +REG_FIELD_GET (TRANS_DDI_MST_TRANSPORT_SELECT_MASK , temp); +intel_dp_get_m_n (intel_crtc, pipe_config);break ;default :
drivers/gpu/drm/i915/display/intel_display.c +10 -2
@@ -46,6 +46,7 @@#include "display/intel_crt.h" #include "display/intel_ddi.h" #include "display/intel_dp.h" +#include "display/intel_dp_mst.h" #include "display/intel_dsi.h" #include "display/intel_dvo.h" #include "display/intel_gmbus.h"
@@ -11627,6 +11628,7 @@ static void intel_crtc_state_reset(struct intel_crtc_state *crtc_state, crtc_state->hsw_workaround_pipe =INVALID_PIPE ; crtc_state->output_format =INTEL_OUTPUT_FORMAT_INVALID ; crtc_state->scaler_state.scaler_id =-1 ; + crtc_state->mst_master_transcoder =INVALID_TRANSCODER ; }static struct intel_crtc_state *intel_crtc_state_alloc (struct intel_crtc *crtc)
@@ -12484,6 +12486,9 @@ static void intel_dump_pipe_config(const struct intel_crtc_state *pipe_config, pipe_config->csc_mode, pipe_config->gamma_mode, pipe_config->gamma_enable, pipe_config->csc_enable); +DRM_DEBUG_KMS ("MST master transcoder: %s\n" , +transcoder_name (pipe_config->mst_master_transcoder)); + dump_planes:if (!state)return ;
@@ -13264,6 +13269,8 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,PIPE_CONF_CHECK_I (dsc.dsc_split);PIPE_CONF_CHECK_I (dsc.compressed_bpp); +PIPE_CONF_CHECK_I (mst_master_transcoder); +#undef PIPE_CONF_CHECK_X#undef PIPE_CONF_CHECK_I#undef PIPE_CONF_CHECK_BOOL
@@ -14348,7 +14355,7 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)u32 handled =0 ;int i; -/* Only disable port sync slaves */ +/* Only disable port sync and MST slaves */ for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {if (!needs_modeset (new_crtc_state))
@@ -14362,7 +14369,8 @@ static void intel_commit_modeset_disables(struct intel_atomic_state *state)* slave CRTCs are disabled first and then master CRTC since * Slave vblanks are masked till Master Vblanks. */ -if (!is_trans_port_sync_slave (old_crtc_state)) +if (!is_trans_port_sync_slave (old_crtc_state) && + !intel_dp_mst_is_slave_trans (old_crtc_state))continue ;intel_pre_plane_update (state, crtc);
drivers/gpu/drm/i915/display/intel_display_types.h +3 -0
@@ -1054,6 +1054,9 @@ struct intel_crtc_state {/* Bitmask to indicate slaves attached */ u8 sync_mode_slaves_mask; + +/* Only valid on TGL+ */ +enum transcoder mst_master_transcoder; };struct intel_crtc {
drivers/gpu/drm/i915/display/intel_dp_mst.c +134 -9
202 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_dp_mst.h +5 -0
@@ -6,10 +6,15 @@#ifndef __INTEL_DP_MST_H__#define __INTEL_DP_MST_H__ +#include <linux/types.h> +struct intel_digital_port ; +struct intel_crtc_state ;int intel_dp_mst_encoder_init (struct intel_digital_port *intel_dig_port,int conn_id);void intel_dp_mst_encoder_cleanup (struct intel_digital_port *intel_dig_port);int intel_dp_mst_encoder_active_links (struct intel_digital_port *intel_dig_port); +bool intel_dp_mst_is_master_trans (const struct intel_crtc_state *crtc_state); +bool intel_dp_mst_is_slave_trans (const struct intel_crtc_state *crtc_state);#endif /* __INTEL_DP_MST_H__ */
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 4/8 drm/i915/display: Always enables MST master pipe first
In reply to José Roberto de SouzaDue to DDB overlaps the pipe enabling sequence is not always crescent. As the previous patch selects the smallest pipe/transcoder in the MST stream to be master and it needs to be enabled first, this changes were needed to guarantee that.
So first lets enable all pipes that do not need a fullmodeset as those don't have any external dependency and those are the ones that can overlap with each other.
Then on the second loop it will enable all the pipes that needs a modeset and don't depends on other pipes like MST master pipe/transcoder.
Then finally all the pipes that needs a modeset and have dependency on other pipes, that at this point are alread enabled.
v3: rebased
v4:
- added check for modeset_pipes too to decide if is necessary for a wait a vblank
- added DDB allocation overlap check for pipes that needs a modeset
--- drivers/gpu/drm/i915/display/intel_display.c | 108 ++++++++++++++----- 1 file changed, 83 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +83 -25
@@ -14523,15 +14523,21 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)u8 hw_enabled_slices = dev_priv->wm.skl_hw.ddb.enabled_slices;u8 required_slices = state->wm_results.ddb.enabled_slices;struct skl_ddb_entry entries[I915_MAX_PIPES ] = {}; -u8 dirty_pipes =0 ; +const u8 num_pipes =INTEL_NUM_PIPES (dev_priv); +u8 update_pipes =0 , modeset_pipes =0 ;int i;for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) { +if (!new_crtc_state->hw.active) +continue ; +/* ignore allocations for crtc's that have been turned off. */ -if (!needs_modeset (new_crtc_state) && new_crtc_state->hw.active) +if (!needs_modeset (new_crtc_state)) { entries[i] = old_crtc_state->wm.skl.ddb; -if (new_crtc_state->hw.active) - dirty_pipes |=BIT (crtc->pipe); + update_pipes |=BIT (crtc->pipe); + }else { + modeset_pipes |=BIT (crtc->pipe); + } }/* If 2nd DBuf slice required, enable it here */
@@ -14541,38 +14547,29 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)/* * Whenever the number of active pipes changes, we need to make sure we * update the pipes in the right order so that their ddb allocations -* never overlap with eachother inbetween CRTC updates. Otherwise we'll +* never overlap with each other between CRTC updates. Otherwise we'll * cause pipe underruns and other bad stuff. +* +* So first lets enable all pipes that do not need a fullmodeset as +* those don't have any external dependency. */ -while (dirty_pipes) { +while (update_pipes) {for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {enum pipe pipe = crtc->pipe; -bool modeset =needs_modeset (new_crtc_state); -if ((dirty_pipes &BIT (pipe)) ==0 ) +if ((update_pipes &BIT (pipe)) ==0 )continue ;if (skl_ddb_allocation_overlaps (&new_crtc_state->wm.skl.ddb, - entries, -INTEL_NUM_PIPES (dev_priv), i)) + entries, num_pipes, i))continue ; entries[i] = new_crtc_state->wm.skl.ddb; - dirty_pipes &= ~BIT (pipe); - -if (modeset &&is_trans_port_sync_mode (new_crtc_state)) { -if (is_trans_port_sync_master (new_crtc_state)) -intel_update_trans_port_sync_crtcs (crtc, - state, - old_crtc_state, - new_crtc_state); -else -continue ; - }else { -intel_update_crtc (crtc, state, old_crtc_state, - new_crtc_state); - } + update_pipes &= ~BIT (pipe); + +intel_update_crtc (crtc, state, old_crtc_state, + new_crtc_state);/* * If this is an already active pipe, it's DDB changed,
@@ -14582,11 +14579,72 @@ static void skl_commit_modeset_enables(struct intel_atomic_state *state)*/ if (!skl_ddb_entry_equal (&new_crtc_state->wm.skl.ddb, &old_crtc_state->wm.skl.ddb) && - !modeset && dirty_pipes) + (update_pipes | modeset_pipes))intel_wait_for_vblank (dev_priv, pipe); } } +/* +* Enable all pipes that needs a modeset and do not depends on other +* pipes +*/ +for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, + new_crtc_state, i) { +enum pipe pipe = crtc->pipe; + +if ((modeset_pipes &BIT (pipe)) ==0 ) +continue ; + +if (intel_dp_mst_is_slave_trans (new_crtc_state) || +is_trans_port_sync_slave (new_crtc_state)) +continue ; + +WARN_ON (skl_ddb_allocation_overlaps (&new_crtc_state->wm.skl.ddb, + entries, num_pipes, i)); + + entries[i] = new_crtc_state->wm.skl.ddb; + modeset_pipes &= ~BIT (pipe); + +if (is_trans_port_sync_mode (new_crtc_state)) { +struct intel_crtc *slave_crtc; + +intel_update_trans_port_sync_crtcs (crtc, state, + old_crtc_state, + new_crtc_state); + + slave_crtc =intel_get_slave_crtc (new_crtc_state); +/* TODO: update entries[] of slave */ + modeset_pipes &= ~BIT (slave_crtc->pipe); + + }else { +intel_update_crtc (crtc, state, old_crtc_state, + new_crtc_state); + } + } + +/* +* Finally enable all pipes that needs a modeset and depends on +* other pipes, right now it is only MST slaves as both port sync slave +* and master are enabled together +*/ +for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, + new_crtc_state, i) { +enum pipe pipe = crtc->pipe; + +if ((modeset_pipes &BIT (pipe)) ==0 ) +continue ; + +WARN_ON (skl_ddb_allocation_overlaps (&new_crtc_state->wm.skl.ddb, + entries, num_pipes, i)); + + entries[i] = new_crtc_state->wm.skl.ddb; + modeset_pipes &= ~BIT (pipe); + +intel_update_crtc (crtc, state, old_crtc_state, new_crtc_state); + } + +WARN_ON (modeset_pipes); +/* If 2nd DBuf slice is no more required disable it */ if (INTEL_GEN (dev_priv) >=11 && required_slices < hw_enabled_slices)icl_dbuf_slices_update (dev_priv, required_slices);
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 5/8 drm/i915/dp: Fix MST disable sequence
In reply to José Roberto de SouzaThe disable sequence after wait for transcoder off was not correctly implemented.
The MST disable sequence is basically the same for HSW, SKL, ICL and TGL, with just minor changes for TGL.
With this last patch we finally fixed the hotplugs triggered by MST sinks during the disable/enable sequence, those were causing source to try to do a link training while it was not ready causing CPU pipe FIFO underrrus on TGL.
v2: Only unsetting TGL_TRANS_DDI_PORT_MASK for TGL on the post disable sequence
v4: Rebased, moved MST sequences to intel_mst_post_disable_dp()
BSpec: 4231
BSpec: 4163
BSpec: 22243
BSpec: 49190
--- drivers/gpu/drm/i915/display/intel_ddi.c | 31 +++++++++++++------ drivers/gpu/drm/i915/display/intel_dp_mst.c | 33 +++++++++++++-------- 2 files changed, 42 insertions(+), 22 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi.c +22 -9
@@ -34,6 +34,7 @@#include "intel_ddi.h" #include "intel_display_types.h" #include "intel_dp.h" +#include "intel_dp_mst.h" #include "intel_dp_link_training.h" #include "intel_dpio_phy.h" #include "intel_dsi.h"
@@ -1949,17 +1950,18 @@ void intel_ddi_disable_transcoder_func(const struct intel_crtc_state *crtc_statestruct intel_crtc *crtc =to_intel_crtc (crtc_state->uapi.crtc);struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);enum transcoder cpu_transcoder = crtc_state->cpu_transcoder; -i915_reg_t reg =TRANS_DDI_FUNC_CTL (cpu_transcoder); -u32 val =I915_READ (reg); +u32 val; + + val =I915_READ (TRANS_DDI_FUNC_CTL (cpu_transcoder)); + val &= ~TRANS_DDI_FUNC_ENABLE ;if (INTEL_GEN (dev_priv) >=12 ) { - val &= ~(TRANS_DDI_FUNC_ENABLE |TGL_TRANS_DDI_PORT_MASK | -TRANS_DDI_DP_VC_PAYLOAD_ALLOC ); +if (!intel_dp_mst_is_master_trans (crtc_state)) + val &= ~TGL_TRANS_DDI_PORT_MASK ; }else { - val &= ~(TRANS_DDI_FUNC_ENABLE |TRANS_DDI_PORT_MASK | -TRANS_DDI_DP_VC_PAYLOAD_ALLOC ); + val &= ~TRANS_DDI_PORT_MASK ; } -I915_WRITE (reg, val); +I915_WRITE (TRANS_DDI_FUNC_CTL (cpu_transcoder), val);if (dev_priv->quirks &QUIRK_INCREASE_DDI_DISABLED_TIME &&intel_crtc_has_type (crtc_state,INTEL_OUTPUT_HDMI )) {
@@ -3813,8 +3815,19 @@ static void intel_ddi_post_disable_dp(struct intel_encoder *encoder,*/ intel_dp_sink_dpms (intel_dp,DRM_MODE_DPMS_OFF ); -if (INTEL_GEN (dev_priv) <12 && !is_mst) -intel_ddi_disable_pipe_clock (old_crtc_state); +if (INTEL_GEN (dev_priv) >=12 ) { +if (is_mst) { +enum transcoder cpu_transcoder = old_crtc_state->cpu_transcoder; +u32 val; + + val =I915_READ (TRANS_DDI_FUNC_CTL (cpu_transcoder)); + val &= ~TGL_TRANS_DDI_PORT_MASK ; +I915_WRITE (TRANS_DDI_FUNC_CTL (cpu_transcoder), val); + } + }else { +if (!is_mst) +intel_ddi_disable_pipe_clock (old_crtc_state); + }intel_disable_ddi_buf (encoder, old_crtc_state);
drivers/gpu/drm/i915/display/intel_dp_mst.c +20 -13
@@ -347,6 +347,7 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,to_intel_connector (old_conn_state->connector);struct drm_i915_private *dev_priv =to_i915 (connector->base.dev);bool last_mst_stream; +u32 val; intel_dp->active_mst_links--; last_mst_stream = intel_dp->active_mst_links ==0 ;
@@ -357,6 +358,19 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,intel_disable_pipe (old_crtc_state); +drm_dp_update_payload_part2 (&intel_dp->mst_mgr); + + val =I915_READ (TRANS_DDI_FUNC_CTL (old_crtc_state->cpu_transcoder)); + val &= ~TRANS_DDI_DP_VC_PAYLOAD_ALLOC ; +I915_WRITE (TRANS_DDI_FUNC_CTL (old_crtc_state->cpu_transcoder), val); + +if (intel_de_wait_for_set (dev_priv, intel_dp->regs.dp_tp_status, +DP_TP_STATUS_ACT_SENT ,1 )) +DRM_ERROR ("Timed out waiting for ACT sent when disabling\n" ); +drm_dp_check_act_status (&intel_dp->mst_mgr); + +drm_dp_mst_deallocate_vcpi (&intel_dp->mst_mgr, connector->port); +intel_ddi_disable_transcoder_func (old_crtc_state);if (INTEL_GEN (dev_priv) >=9 )
@@ -364,6 +378,12 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,else ironlake_pfit_disable (old_crtc_state); +/* +* Power down mst path before disabling the port, otherwise we end +* up getting interrupts from the sink upon detecting link loss. +*/ +drm_dp_send_power_updown_phy (&intel_dp->mst_mgr, connector->port, + false);/* * From TGL spec: "If multi-stream slave transcoder: Configure * Transcoder Clock Select to direct no clock to the transcoder"
@@ -374,19 +394,6 @@ static void intel_mst_post_disable_dp(struct intel_encoder *encoder,if (INTEL_GEN (dev_priv) <12 || !last_mst_stream)intel_ddi_disable_pipe_clock (old_crtc_state); -/* this can fail */ -drm_dp_check_act_status (&intel_dp->mst_mgr); -/* and this can also fail */ -drm_dp_update_payload_part2 (&intel_dp->mst_mgr); - -drm_dp_mst_deallocate_vcpi (&intel_dp->mst_mgr, connector->port); - -/* -* Power down mst path before disabling the port, otherwise we end -* up getting interrupts from the sink upon detecting link loss. -*/ -drm_dp_send_power_updown_phy (&intel_dp->mst_mgr, connector->port, - false); intel_mst->connector =NULL ;if (last_mst_stream)
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 6/8 drm/i915/display: Prepare for fastset external dependencies check
In reply to José Roberto de SouzaMST and port sync have master and slaves pipes and it brings dependencies between pipes to allow fastset.
For example if only MST master needs a modeset all of its slaves also needs to do a modeset.
This patch adds the base for external dependencies check, the MST and port sync bits will be added in another patches.
v3:
- moved handling to intel_atomic_check() this way is guarantee that all pipes will have its state computed
v4:
- added a function to return if MST master neeeds modeset to simply code in intel_atomic_check()
v5:
- fixed and moved code to check if MST master needs a modeset
v6:
- previons version of this patch was split into two patches
--- drivers/gpu/drm/i915/display/intel_display.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_display.c +15 -3
@@ -13909,7 +13909,11 @@ static void intel_crtc_check_fastset(const struct intel_crtc_state *old_crtc_sta new_crtc_state->uapi.mode_changed = false; new_crtc_state->update_pipe = true; +} +static void intel_crtc_copy_fastset (const struct intel_crtc_state *old_crtc_state, +struct intel_crtc_state *new_crtc_state) +{/* * If we're not doing the full modeset we want to * keep the current M/N values as they may be
@@ -14070,8 +14074,6 @@ static int intel_atomic_check(struct drm_device *dev,if (!new_crtc_state->uapi.enable) {intel_crtc_copy_uapi_to_hw_state (new_crtc_state); - - any_ms = true;continue ; }
@@ -14084,9 +14086,19 @@ static int intel_atomic_check(struct drm_device *dev, goto fail;intel_crtc_check_fastset (old_crtc_state, new_crtc_state); + } -if (needs_modeset (new_crtc_state)) +for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, + new_crtc_state, i) { +if (needs_modeset (new_crtc_state)) { any_ms = true; +continue ; + } + +if (!new_crtc_state->update_pipe) +continue ; + +intel_crtc_copy_fastset (old_crtc_state, new_crtc_state); }if (any_ms && !check_digital_port_conflicts (state)) {
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 7/8 drm/i915/mst: Force modeset on MST slaves when master needs a modeset
In reply to José Roberto de SouzaMST master can not be disabled while it have attached MST slaves, so it is necessary force a modeset in all of its slaves.
v3:
- moved handling to intel_atomic_check() this way is guarantee that all pipes will have its state computed
v4:
- added a function to return if MST master neeeds modeset to simply code in intel_atomic_check()
v5:
- fixed and moved code to check if MST master needs a modeset
v6:
- previons version of this patch was split into two patches
--- drivers/gpu/drm/i915/display/intel_display.c | 36 ++++++++++++++++++++ 1 file changed, 36 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +36 -0
@@ -14036,6 +14036,20 @@ static int intel_atomic_check_crtcs(struct intel_atomic_state *state)return 0 ; } +static bool intel_cpu_transcoder_needs_modeset (struct intel_atomic_state *state, +enum transcoder transcoder) +{ +struct intel_crtc_state *new_crtc_state; +struct intel_crtc *crtc; +int i; + +for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) +if (new_crtc_state->cpu_transcoder == transcoder) +return needs_modeset (new_crtc_state); + +return false; +} +/** * intel_atomic_check - validate state object * @dev: drm device
@@ -14088,6 +14102,28 @@ static int intel_atomic_check(struct drm_device *dev,intel_crtc_check_fastset (old_crtc_state, new_crtc_state); } +/** +* Check if fastset is allowed by external dependencies like other +* pipes and transcoders. +* +* Right now it only forces a fullmodeset when the MST master +* transcoder did not changed but the pipe of the master transcoder +* needs a fullmodeset so all slaves also needs to do a fullmodeset. +*/ +for_each_new_intel_crtc_in_state (state, crtc, new_crtc_state, i) { +enum transcoder master = new_crtc_state->mst_master_transcoder; + +if (!new_crtc_state->hw.enable || +needs_modeset (new_crtc_state) || + !intel_dp_mst_is_slave_trans (new_crtc_state)) +continue ; + +if (intel_cpu_transcoder_needs_modeset (state, master)) { + new_crtc_state->uapi.mode_changed = true; + new_crtc_state->update_pipe = false; + } + } +for_each_oldnew_intel_crtc_in_state (state, crtc, old_crtc_state, new_crtc_state, i) {if (needs_modeset (new_crtc_state)) {
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v6 8/8 drm/i915/display: Add comment to a function that probably can be removed
In reply to José Roberto de SouzaThis function is only called from port sync and it is identical to what will be executed again in intel_update_crtc() over port sync pipes.
If it is really necessary at least it deserves a better name and a comment, leaving it to people working on port sync.
--- drivers/gpu/drm/i915/display/intel_display.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_display.c +4 -0
@@ -14483,6 +14483,10 @@ static void intel_set_dp_tp_ctl_normal(struct intel_crtc *crtc,intel_dp_stop_link_train (intel_dp); } +/* +* TODO: This is only called from port sync and it is identical to what will be +* executed again in intel_update_crtc() over port sync pipes +*/ static void intel_post_crtc_enable_updates (struct intel_crtc *crtc,struct intel_atomic_state *state) {
Signature · 6 lines
2.24.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for series starting with [v6,1/8] drm/i915: Introduce intel_crtc_state_alloc()
In reply to José Roberto de Souza== Series Details ==
== Series Details ==
Series: series starting with [v6,1/8] drm/i915: Introduce intel_crtc_state_alloc()
URL : https://patchwork.freedesktop.org/series/71229/
State : failure
== Summary ==
Applying: drm/i915: Introduce intel_crtc_state_alloc()
Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/display/intel_display.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/gpu/drm/i915/display/intel_display.c
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/display/intel_display.c
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch' to see the failed patch
Patch failed at 0001 drm/i915: Introduce intel_crtc_state_alloc() When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx