drm/i915: Pass around crtc and connector states for audio
Subsystems (2)
PATCH 1/2 drm/i915: Pass around crtc and connector states for audio
From: Ville Syrjälä <[email protected]>
Explicitly pass the crtc and connector states into the audio code enable/disable hooks, and plumb them all the way down.
This gets rid of almost all crtc->config and encoder->crtc uses. The one place where we still use them is i915_audio_component_sync_audio_rate() since that gets called from the audio driver and we don't have explicit states around then.
--- drivers/gpu/drm/i915/i915_drv.h | 10 +- drivers/gpu/drm/i915/intel_audio.c | 202 ++++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_ddi.c | 6 +- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_dp_mst.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 4 +- drivers/gpu/drm/i915/intel_hdmi.c | 6 +- 7 files changed, 132 insertions(+), 102 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +6 -4
@@ -726,10 +726,12 @@ struct drm_i915_display_funcs {void (*crtc_disable)(struct intel_crtc_state *old_crtc_state,struct drm_atomic_state *old_state);void (*update_crtcs)(struct drm_atomic_state *state); -void (*audio_codec_enable)(struct drm_connector *connector, -struct intel_encoder *encoder, -const struct drm_display_mode *adjusted_mode); -void (*audio_codec_disable)(struct intel_encoder *encoder); +void (*audio_codec_enable)(struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state); +void (*audio_codec_disable)(struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state);void (*fdi_link_train)(struct intel_crtc *crtc,const struct intel_crtc_state *crtc_state);void (*init_clock_gating)(struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_audio.c +111 -91
401 lines not on this page · raw message
drivers/gpu/drm/i915/intel_ddi.c +4 -2
@@ -2425,7 +2425,8 @@ static void intel_disable_ddi_dp(struct intel_encoder *encoder,struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);intel_edp_drrs_disable (intel_dp, old_crtc_state);intel_psr_disable (intel_dp, old_crtc_state);
@@ -2437,7 +2438,8 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector,
drivers/gpu/drm/i915/intel_dp.c +2 -1
@@ -2708,7 +2708,8 @@ static void intel_disable_dp(struct intel_encoder *encoder,struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);/* Make sure the panel is off before trying to change the mode. But also * ensure that we have vdd while we switch off the panel. */
drivers/gpu/drm/i915/intel_dp_mst.c +2 -1
@@ -149,7 +149,8 @@ static void intel_mst_disable_dp(struct intel_encoder *encoder,DRM_ERROR ("failed to update payload %d\n" , ret); }if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); } static void intel_mst_post_disable_dp(struct intel_encoder *encoder,
drivers/gpu/drm/i915/intel_drv.h +3 -1
@@ -1311,7 +1311,9 @@ void intel_init_audio_hooks(struct drm_i915_private *dev_priv);void intel_audio_codec_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state); -void intel_audio_codec_disable (struct intel_encoder *encoder); +void intel_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state);void i915_audio_component_init (struct drm_i915_private *dev_priv);void i915_audio_component_cleanup (struct drm_i915_private *dev_priv);void intel_audio_init (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_hdmi.c +4 -2
@@ -1206,7 +1206,8 @@ static void g4x_disable_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);intel_disable_hdmi (encoder, old_crtc_state, old_conn_state); }
@@ -1216,7 +1217,8 @@ static void pch_disable_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); } static void pch_post_disable_hdmi(struct intel_encoder *encoder,
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: Remove most encoder->type uses from the audio code
From: Ville Syrjälä <[email protected]>
encoder->type isn't genreally safe around DDI ports, so let's replace some uses in the audio code with the crtc state's output_types instead.
Actually in these cases encoder->type would work since the DP SST case is only relevant for VLV/CHV and encoder->type==DP is a thing on those platforms. The DP MST cases would work as well since MST encoder->type==DP_MST always. But I think it's best to try and minimize the encoder->type use in general to avoid showing a bad example to people.
--- drivers/gpu/drm/i915/intel_audio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_audio.c +3 -3
@@ -641,7 +641,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ -if (encoder->type !=INTEL_OUTPUT_DP_MST ) +if (!intel_crtc_has_type (crtc_state,INTEL_OUTPUT_DP_MST )) pipe =-1 ; acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port, (int ) pipe);
@@ -649,7 +649,7 @@ void intel_audio_codec_enable(struct intel_encoder *encoder,intel_lpe_audio_notify (dev_priv, pipe, port, connector->eld, crtc_state->port_clock, - encoder->type ==INTEL_OUTPUT_DP ); +intel_crtc_has_dp_encoder (crtc_state)); }/**
@@ -683,7 +683,7 @@ void intel_audio_codec_disable(struct intel_encoder *encoder,if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ -if (encoder->type !=INTEL_OUTPUT_DP_MST ) +if (!intel_crtc_has_type (old_crtc_state,INTEL_OUTPUT_DP_MST )) pipe =-1 ; acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port, (int ) pipe);
Signature · 6 lines
2.13.6 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
URL : https://patchwork.freedesktop.org/series/32858/
State : success
== Summary ==
Series 32858v1 series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
https://patchwork.freedesktop.org/api/1.0/series/32858/revisions/1/mbox/
Test gem_exec_suspend:
Subgroup basic-s3:
pass -> DMESG-WARN (fi-cfl-s) fdo#103186
Test kms_cursor_legacy:
Subgroup basic-busy-flip-before-cursor-legacy:
pass -> FAIL (fi-gdg-551) fdo#102618
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-c:
incomplete -> PASS (fi-bxt-dsi)
Test pm_rpm:
Subgroup basic-pci-d3-state:
incomplete -> FAIL (fi-bxt-j4205)
Test drv_module_reload:
Subgroup basic-no-display:
dmesg-warn -> PASS (fi-cfl-s) fdo#103206fdo#103186 https://bugs.freedesktop.org/show_bug.cgi?id=103186
fdo#102618 https://bugs.freedesktop.org/show_bug.cgi?id=102618
fdo#103206 https://bugs.freedesktop.org/show_bug.cgi?id=103206
fi-bdw-5557u total:289 pass:266 dwarn:0 dfail:0 fail:2 skip:21 time:459s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:455s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:373s fi-bsw-n3050 total:289 pass:241 dwarn:0 dfail:0 fail:2 skip:46 time:539s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:264s fi-bxt-dsi total:289 pass:257 dwarn:0 dfail:0 fail:2 skip:30 time:516s fi-bxt-j4205 total:289 pass:258 dwarn:0 dfail:0 fail:2 skip:29 time:508s fi-byt-j1900 total:289 pass:251 dwarn:1 dfail:0 fail:2 skip:35 time:525s fi-byt-n2820 total:289 pass:247 dwarn:1 dfail:0 fail:2 skip:39 time:494s fi-cfl-s total:289 pass:252 dwarn:3 dfail:0 fail:2 skip:32 time:565s fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:422s fi-gdg-551 total:289 pass:177 dwarn:1 dfail:0 fail:2 skip:109 time:259s fi-glk-1 total:289 pass:259 dwarn:0 dfail:0 fail:2 skip:28 time:590s fi-hsw-4770 total:289 pass:260 dwarn:0 dfail:0 fail:2 skip:27 time:444s fi-hsw-4770r total:289 pass:260 dwarn:0 dfail:0 fail:2 skip:27 time:444s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:416s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:492s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:458s fi-kbl-7500u total:289 pass:262 dwarn:1 dfail:0 fail:2 skip:24 time:512s fi-kbl-7560u total:289 pass:268 dwarn:0 dfail:0 fail:2 skip:19 time:583s fi-kbl-7567u total:289 pass:267 dwarn:0 dfail:0 fail:2 skip:20 time:490s fi-kbl-r total:289 pass:260 dwarn:0 dfail:0 fail:2 skip:27 time:591s fi-pnv-d510 total:289 pass:222 dwarn:1 dfail:0 fail:0 skip:66 time:539s fi-skl-6260u total:289 pass:267 dwarn:0 dfail:0 fail:2 skip:20 time:470s fi-skl-6600u total:289 pass:260 dwarn:0 dfail:0 fail:2 skip:27 time:602s fi-skl-6700hq total:289 pass:261 dwarn:0 dfail:0 fail:2 skip:26 time:661s fi-skl-6700k total:289 pass:263 dwarn:0 dfail:0 fail:2 skip:24 time:537s fi-skl-6770hq total:289 pass:267 dwarn:0 dfail:0 fail:2 skip:20 time:518s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:458s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:565s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:414s
302b1723bec5e7f43e423c975b9b87705fb9fdd6 drm-tip: 2017y-10m-30d-18h-28m-39s UTC integration manifest a17d63b3d26c drm/i915: Remove most encoder->type uses from the audio code 5f00c190bc76 drm/i915: Pass around crtc and connector states for audio
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6266/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.IGT: warning for series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
URL : https://patchwork.freedesktop.org/series/32858/
State : warning
== Summary ==
Test kms_flip:
Subgroup plain-flip-fb-recreate:
pass -> FAIL (shard-hsw) fdo#100368
Test kms_plane:
Subgroup plane-position-hole-dpms-pipe-B-planes:
pass -> SKIP (shard-hsw)
Test kms_universal_plane:
Subgroup universal-plane-pipe-C-functional:
pass -> SKIP (shard-hsw)
Test kms_cursor_legacy:
Subgroup flip-vs-cursor-crc-atomic:
pass -> SKIP (shard-hsw)fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
shard-hsw total:2539 pass:1388 dwarn:1 dfail:0 fail:53 skip:1097 time:9216s
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6266/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 9 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Explicitly pass the crtc and connector states into the audio code enable/disable hooks, and plumb them all the way down.
This gets rid of almost all
crtc->configandencoder->crtcuses. The one place where we still use them isi915_audio_component_sync_audio_rate()since that gets called from the audio driver and we don't have explicit states around then.
What a tedious patch to review!
On both,
Quoted 548 lines
Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 10 +- drivers/gpu/drm/i915/intel_audio.c | 202 ++++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_ddi.c | 6 +- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_dp_mst.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 4 +- drivers/gpu/drm/i915/intel_hdmi.c | 6 +- 7 files changed, 132 insertions(+), 102 deletions(-)drivers/gpu/drm/i915/i915_drv.h +6
-4@@ -726,10 +726,12 @@ struct drm_i915_display_funcs {void (*crtc_disable)(struct intel_crtc_state *old_crtc_state,struct drm_atomic_state *old_state);void (*update_crtcs)(struct drm_atomic_state *state); -void (*audio_codec_enable)(struct drm_connector *connector, -struct intel_encoder *encoder, -const struct drm_display_mode *adjusted_mode); -void (*audio_codec_disable)(struct intel_encoder *encoder); +void (*audio_codec_enable)(struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state); +void (*audio_codec_disable)(struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state);void (*fdi_link_train)(struct intel_crtc *crtc,const struct intel_crtc_state *crtc_state);void (*init_clock_gating)(struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_audio.c +111
-91@@ -102,13 +102,13 @@ static const struct dp_aud_n_m dp_aud_n_m[] = { };static const struct dp_aud_n_m * -audio_config_dp_get_n_m (struct intel_crtc *intel_crtc,int rate) +audio_config_dp_get_n_m (const struct intel_crtc_state *crtc_state,int rate) {int i;for (i =0 ; i <ARRAY_SIZE (dp_aud_n_m); i++) {if (rate == dp_aud_n_m[i].sample_rate && - intel_crtc->config->port_clock == dp_aud_n_m[i].clock) + crtc_state->port_clock == dp_aud_n_m[i].clock)return &dp_aud_n_m[i]; }@@ -157,8 +157,10 @@ static const struct { };/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ -static u32 audio_config_hdmi_pixel_clock (const struct drm_display_mode *adjusted_mode) +static u32 audio_config_hdmi_pixel_clock (const struct intel_crtc_state *crtc_state) { +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int i;for (i =0 ; i <ARRAY_SIZE (hdmi_audio_clock); i++) {@@ -179,9 +181,11 @@ static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjustedreturn hdmi_audio_clock[i].config; } -static int audio_config_hdmi_get_n (const struct drm_display_mode *adjusted_mode, +static int audio_config_hdmi_get_n (const struct intel_crtc_state *crtc_state,int rate) { +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int i;for (i =0 ; i <ARRAY_SIZE (hdmi_aud_ncts); i++) {@@ -220,7 +224,9 @@ static bool intel_eld_uptodate(struct drm_connector *connector,return true; } -static void g4x_audio_codec_disable (struct intel_encoder *encoder) +static void g4x_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);uint32_t eldv, tmp;@@ -239,11 +245,12 @@ static void g4x_audio_codec_disable(struct intel_encoder *encoder)I915_WRITE (G4X_AUD_CNTL_ST , tmp); } -static void g4x_audio_codec_enable (struct drm_connector *connector, -struct intel_encoder *encoder, -const struct drm_display_mode *adjusted_mode) +static void g4x_audio_codec_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state) { -struct drm_i915_private *dev_priv =to_i915 (connector->dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct drm_connector *connector = conn_state->connector;uint8_t *eld = connector->eld;uint32_t eldv;uint32_t tmp;@@ -279,16 +286,20 @@ static void g4x_audio_codec_enable(struct drm_connector *connector, }static void -hsw_dp_audio_config_update (struct intel_crtc *intel_crtc,enum port port, -const struct drm_display_mode *adjusted_mode) +hsw_dp_audio_config_update (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) { -struct drm_i915_private *dev_priv =to_i915 (intel_crtc->base.dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -int rate = acomp ? acomp->aud_sample_rate[port] :0 ; -const struct dp_aud_n_m *nm =audio_config_dp_get_n_m (intel_crtc, rate); -enum pipe pipe = intel_crtc->pipe; +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +enum port port = encoder->port; +enum pipe pipe = crtc->pipe; +const struct dp_aud_n_m *nm; +int rate;u32 tmp; + rate = acomp ? acomp->aud_sample_rate[port] :0 ; + nm =audio_config_dp_get_n_m (crtc_state, rate);if (nm)DRM_DEBUG_KMS ("using Maud %u, Naud %u\n" , nm->m, nm->n);else @@ -323,23 +334,26 @@ hsw_dp_audio_config_update(struct intel_crtc *intel_crtc, enum port port, }static void -hsw_hdmi_audio_config_update (struct intel_crtc *intel_crtc,enum port port, -const struct drm_display_mode *adjusted_mode) +hsw_hdmi_audio_config_update (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) { -struct drm_i915_private *dev_priv =to_i915 (intel_crtc->base.dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -int rate = acomp ? acomp->aud_sample_rate[port] :0 ; -enum pipe pipe = intel_crtc->pipe; -int n; +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +enum port port = encoder->port; +enum pipe pipe = crtc->pipe; +int n, rate;u32 tmp; + rate = acomp ? acomp->aud_sample_rate[port] :0 ; + tmp =I915_READ (HSW_AUD_CFG (pipe)); tmp &= ~AUD_CONFIG_N_VALUE_INDEX ; tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK ; tmp &= ~AUD_CONFIG_N_PROG_ENABLE ; - tmp |=audio_config_hdmi_pixel_clock (adjusted_mode); + tmp |=audio_config_hdmi_pixel_clock (crtc_state); - n =audio_config_hdmi_get_n (adjusted_mode, rate); + n =audio_config_hdmi_get_n (crtc_state, rate);if (n !=0 ) {DRM_DEBUG_KMS ("using N %d\n" , n);@@ -363,20 +377,22 @@ hsw_hdmi_audio_config_update(struct intel_crtc *intel_crtc, enum port port, }static void -hsw_audio_config_update (struct intel_crtc *intel_crtc,enum port port, -const struct drm_display_mode *adjusted_mode) +hsw_audio_config_update (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) { -if (intel_crtc_has_dp_encoder (intel_crtc->config)) -hsw_dp_audio_config_update (intel_crtc, port, adjusted_mode); +if (intel_crtc_has_dp_encoder (crtc_state)) +hsw_dp_audio_config_update (encoder, crtc_state);else -hsw_hdmi_audio_config_update (intel_crtc, port, adjusted_mode); +hsw_hdmi_audio_config_update (encoder, crtc_state); } -static void hsw_audio_codec_disable (struct intel_encoder *encoder) +static void hsw_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; +struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc); +enum pipe pipe = crtc->pipe;uint32_t tmp;DRM_DEBUG_KMS ("Disable audio codec on pipe %c\n" ,pipe_name (pipe));@@ -389,7 +405,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder) tmp |=AUD_CONFIG_N_PROG_ENABLE ; tmp &= ~AUD_CONFIG_UPPER_N_MASK ; tmp &= ~AUD_CONFIG_LOWER_N_MASK ; -if (intel_crtc_has_dp_encoder (intel_crtc->config)) +if (intel_crtc_has_dp_encoder (old_crtc_state)) tmp |=AUD_CONFIG_N_VALUE_INDEX ;I915_WRITE (HSW_AUD_CFG (pipe), tmp);@@ -402,14 +418,14 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder)mutex_unlock (&dev_priv->av_mutex); } -static void hsw_audio_codec_enable (struct drm_connector *connector, -struct intel_encoder *intel_encoder, -const struct drm_display_mode *adjusted_mode) +static void hsw_audio_codec_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state) { -struct drm_i915_private *dev_priv =to_i915 (connector->dev); -struct intel_crtc *intel_crtc =to_intel_crtc (intel_encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; -enum port port = intel_encoder->port; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_connector *connector = conn_state->connector; +enum pipe pipe = crtc->pipe;const uint8_t *eld = connector->eld;uint32_t tmp;int len, i;@@ -448,17 +464,19 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , tmp);/* Enable timestamps */ -hsw_audio_config_update (intel_crtc, port, adjusted_mode); +hsw_audio_config_update (encoder, crtc_state);mutex_unlock (&dev_priv->av_mutex); } -static void ilk_audio_codec_disable (struct intel_encoder *intel_encoder) +static void ilk_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) { -struct drm_i915_private *dev_priv =to_i915 (intel_encoder->base.dev); -struct intel_crtc *intel_crtc =to_intel_crtc (intel_encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; -enum port port = intel_encoder->port; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc); +enum pipe pipe = crtc->pipe; +enum port port = encoder->port;uint32_t tmp, eldv;i915_reg_t aud_config, aud_cntrl_st2;@@ -485,7 +503,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder) tmp |=AUD_CONFIG_N_PROG_ENABLE ; tmp &= ~AUD_CONFIG_UPPER_N_MASK ; tmp &= ~AUD_CONFIG_LOWER_N_MASK ; -if (intel_crtc_has_dp_encoder (intel_crtc->config)) +if (intel_crtc_has_dp_encoder (old_crtc_state)) tmp |=AUD_CONFIG_N_VALUE_INDEX ;I915_WRITE (aud_config, tmp);@@ -497,14 +515,15 @@ static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder)I915_WRITE (aud_cntrl_st2, tmp); } -static void ilk_audio_codec_enable (struct drm_connector *connector, -struct intel_encoder *intel_encoder, -const struct drm_display_mode *adjusted_mode) +static void ilk_audio_codec_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state) { -struct drm_i915_private *dev_priv =to_i915 (connector->dev); -struct intel_crtc *intel_crtc =to_intel_crtc (intel_encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; -enum port port = intel_encoder->port; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_connector *connector = conn_state->connector; +enum pipe pipe = crtc->pipe; +enum port port = encoder->port;uint8_t *eld = connector->eld;uint32_t tmp, eldv;int len, i;@@ -568,36 +587,36 @@ static void ilk_audio_codec_enable(struct drm_connector *connector, tmp &= ~AUD_CONFIG_N_VALUE_INDEX ; tmp &= ~AUD_CONFIG_N_PROG_ENABLE ; tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK ; -if (intel_crtc_has_dp_encoder (intel_crtc->config)) +if (intel_crtc_has_dp_encoder (crtc_state)) tmp |=AUD_CONFIG_N_VALUE_INDEX ;else - tmp |=audio_config_hdmi_pixel_clock (adjusted_mode); + tmp |=audio_config_hdmi_pixel_clock (crtc_state);I915_WRITE (aud_config, tmp); }/** * intel_audio_codec_enable - Enable the audio codec for HD audio -* @intel_encoder: encoder on which to enable audio +* @encoder: encoder on which to enable audio * @crtc_state: pointer to the current crtc state. * @conn_state: pointer to the current connector state. * * The enable sequences may only be performed after enabling the transcoder and * port, and after completed link training. */ -void intel_audio_codec_enable (struct intel_encoder *intel_encoder, +void intel_audio_codec_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state) { -struct drm_encoder *encoder = &intel_encoder->base; -const struct drm_display_mode *adjusted_mode = &crtc_state->base.adjusted_mode; -struct drm_connector *connector; -struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -enum port port = intel_encoder->port; -enum pipe pipe =to_intel_crtc (crtc_state->base.crtc)->pipe; +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_connector *connector = conn_state->connector; +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode; +enum port port = encoder->port; +enum pipe pipe = crtc->pipe; - connector = conn_state->connector; -if (!connector || !connector->eld[0 ]) +if (!connector->eld[0 ])return ; DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",@@ -609,19 +628,20 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder, connector->eld[6 ] =drm_av_sync_delay (connector, adjusted_mode) /2 ;if (dev_priv->display.audio_codec_enable) - dev_priv->display.audio_codec_enable (connector, intel_encoder, - adjusted_mode); + dev_priv->display.audio_codec_enable (encoder, + crtc_state, + conn_state);mutex_lock (&dev_priv->av_mutex); - intel_encoder->audio_connector = connector; + encoder->audio_connector = connector;/* referred in audio callbacks */ - dev_priv->av_enc_map[pipe] = intel_encoder; + dev_priv->av_enc_map[pipe] = encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ -if (intel_encoder->type !=INTEL_OUTPUT_DP_MST ) +if (encoder->type !=INTEL_OUTPUT_DP_MST ) pipe =-1 ; acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port, (int ) pipe);@@ -629,36 +649,41 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,intel_lpe_audio_notify (dev_priv, pipe, port, connector->eld, crtc_state->port_clock, - intel_encoder->type ==INTEL_OUTPUT_DP ); + encoder->type ==INTEL_OUTPUT_DP ); }/** * intel_audio_codec_disable - Disable the audio codec for HD audio -* @intel_encoder: encoder on which to disable audio +* @encoder: encoder on which to disable audio +* @crtc_state: pointer to the old crtc state. +* @conn_state: pointer to the old connector state. * * The disable sequences must be performed before disabling the transcoder or * port. */ -void intel_audio_codec_disable (struct intel_encoder *intel_encoder) +void intel_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) { -struct drm_encoder *encoder = &intel_encoder->base; -struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -enum port port = intel_encoder->port; -struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc); +enum port port = encoder->port;enum pipe pipe = crtc->pipe;if (dev_priv->display.audio_codec_disable) - dev_priv->display.audio_codec_disable (intel_encoder); + dev_priv->display.audio_codec_disable (encoder, + old_crtc_state, + old_conn_state);mutex_lock (&dev_priv->av_mutex); - intel_encoder->audio_connector =NULL ; + encoder->audio_connector =NULL ; dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ -if (intel_encoder->type !=INTEL_OUTPUT_DP_MST ) +if (encoder->type !=INTEL_OUTPUT_DP_MST ) pipe =-1 ; acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port, (int ) pipe);@@ -793,10 +818,9 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port, int pipe, int rate) {struct drm_i915_private *dev_priv =kdev_to_i915 (kdev); -struct intel_encoder *intel_encoder; -struct intel_crtc *crtc; -struct drm_display_mode *adjusted_mode;struct i915_audio_component *acomp = dev_priv->audio_component; +struct intel_encoder *encoder; +struct intel_crtc *crtc;int err =0 ;if (!HAS_DDI (dev_priv))@@ -806,23 +830,19 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port,mutex_lock (&dev_priv->av_mutex);/* 1. get the pipe */ - intel_encoder =get_saved_enc (dev_priv, port, pipe); -if (!intel_encoder || !intel_encoder->base.crtc) { + encoder =get_saved_enc (dev_priv, port, pipe); +if (!encoder || !encoder->base.crtc) {DRM_DEBUG_KMS ("Not valid for port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } -/* pipe passed from the audio driver will be -1 for Non-MST case */ - crtc =to_intel_crtc (intel_encoder->base.crtc); - pipe = crtc->pipe; - - adjusted_mode = &crtc->config->base.adjusted_mode; + crtc =to_intel_crtc (encoder->base.crtc);/* port must be valid now, otherwise the pipe will be invalid */ acomp->aud_sample_rate[port] = rate; -hsw_audio_config_update (crtc, port, adjusted_mode); +hsw_audio_config_update (encoder, crtc->config); unlock:mutex_unlock (&dev_priv->av_mutex);drivers/gpu/drm/i915/intel_ddi.c +4
-2@@ -2425,7 +2425,8 @@ static void intel_disable_ddi_dp(struct intel_encoder *encoder,struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);intel_edp_drrs_disable (intel_dp, old_crtc_state);intel_psr_disable (intel_dp, old_crtc_state);@@ -2437,7 +2438,8 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector,drivers/gpu/drm/i915/intel_dp.c +2
-1@@ -2708,7 +2708,8 @@ static void intel_disable_dp(struct intel_encoder *encoder,struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);/* Make sure the panel is off before trying to change the mode. But also * ensure that we have vdd while we switch off the panel. */ drivers/gpu/drm/i915/intel_dp_mst.c +2
-1@@ -149,7 +149,8 @@ static void intel_mst_disable_dp(struct intel_encoder *encoder,DRM_ERROR ("failed to update payload %d\n" , ret); }if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); } static void intel_mst_post_disable_dp(struct intel_encoder *encoder,drivers/gpu/drm/i915/intel_drv.h +3
-1@@ -1311,7 +1311,9 @@ void intel_init_audio_hooks(struct drm_i915_private *dev_priv);void intel_audio_codec_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state); -void intel_audio_codec_disable (struct intel_encoder *encoder); +void intel_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state);void i915_audio_component_init (struct drm_i915_private *dev_priv);void i915_audio_component_cleanup (struct drm_i915_private *dev_priv);void intel_audio_init (struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_hdmi.c +4
-2@@ -1206,7 +1206,8 @@ static void g4x_disable_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);intel_disable_hdmi (encoder, old_crtc_state, old_conn_state); }@@ -1216,7 +1217,8 @@ static void pch_disable_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); } static void pch_post_disable_hdmi(struct intel_encoder *encoder,
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 11 lines · Jani Nikula
Quoted 9 lines · Ville Syrjala
From: Ville Syrjälä <[email protected]>
Explicitly pass the crtc and connector states into the audio code enable/disable hooks, and plumb them all the way down.
This gets rid of almost all
crtc->configandencoder->crtcuses. The one place where we still use them isi915_audio_component_sync_audio_rate()since that gets called from the audio driver and we don't have explicit states around then.
Quoted 5 lines
What a tedious patch to review!
On both,
Reviewed-by Jani Nikula <[email protected]>
Thanks for suffering through the tedium. Series pushed to dinq.
Quoted 553 lines
Quoted 550 lines
Cc Jani Nikula <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.h | 10 +- drivers/gpu/drm/i915/intel_audio.c | 202 ++++++++++++++++++++---------------- drivers/gpu/drm/i915/intel_ddi.c | 6 +- drivers/gpu/drm/i915/intel_dp.c | 3 +- drivers/gpu/drm/i915/intel_dp_mst.c | 3 +- drivers/gpu/drm/i915/intel_drv.h | 4 +- drivers/gpu/drm/i915/intel_hdmi.c | 6 +- 7 files changed, 132 insertions(+), 102 deletions(-)drivers/gpu/drm/i915/i915_drv.h +6
-4@@ -726,10 +726,12 @@ struct drm_i915_display_funcs {void (*crtc_disable)(struct intel_crtc_state *old_crtc_state,struct drm_atomic_state *old_state);void (*update_crtcs)(struct drm_atomic_state *state); -void (*audio_codec_enable)(struct drm_connector *connector, -struct intel_encoder *encoder, -const struct drm_display_mode *adjusted_mode); -void (*audio_codec_disable)(struct intel_encoder *encoder); +void (*audio_codec_enable)(struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state); +void (*audio_codec_disable)(struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state);void (*fdi_link_train)(struct intel_crtc *crtc,const struct intel_crtc_state *crtc_state);void (*init_clock_gating)(struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_audio.c +111
-91@@ -102,13 +102,13 @@ static const struct dp_aud_n_m dp_aud_n_m[] = { };static const struct dp_aud_n_m * -audio_config_dp_get_n_m (struct intel_crtc *intel_crtc,int rate) +audio_config_dp_get_n_m (const struct intel_crtc_state *crtc_state,int rate) {int i;for (i =0 ; i <ARRAY_SIZE (dp_aud_n_m); i++) {if (rate == dp_aud_n_m[i].sample_rate && - intel_crtc->config->port_clock == dp_aud_n_m[i].clock) + crtc_state->port_clock == dp_aud_n_m[i].clock)return &dp_aud_n_m[i]; }@@ -157,8 +157,10 @@ static const struct { };/* get AUD_CONFIG_PIXEL_CLOCK_HDMI_* value for mode */ -static u32 audio_config_hdmi_pixel_clock (const struct drm_display_mode *adjusted_mode) +static u32 audio_config_hdmi_pixel_clock (const struct intel_crtc_state *crtc_state) { +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int i;for (i =0 ; i <ARRAY_SIZE (hdmi_audio_clock); i++) {@@ -179,9 +181,11 @@ static u32 audio_config_hdmi_pixel_clock(const struct drm_display_mode *adjustedreturn hdmi_audio_clock[i].config; } -static int audio_config_hdmi_get_n (const struct drm_display_mode *adjusted_mode, +static int audio_config_hdmi_get_n (const struct intel_crtc_state *crtc_state,int rate) { +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int i;for (i =0 ; i <ARRAY_SIZE (hdmi_aud_ncts); i++) {@@ -220,7 +224,9 @@ static bool intel_eld_uptodate(struct drm_connector *connector,return true; } -static void g4x_audio_codec_disable (struct intel_encoder *encoder) +static void g4x_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);uint32_t eldv, tmp;@@ -239,11 +245,12 @@ static void g4x_audio_codec_disable(struct intel_encoder *encoder)I915_WRITE (G4X_AUD_CNTL_ST , tmp); } -static void g4x_audio_codec_enable (struct drm_connector *connector, -struct intel_encoder *encoder, -const struct drm_display_mode *adjusted_mode) +static void g4x_audio_codec_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state) { -struct drm_i915_private *dev_priv =to_i915 (connector->dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct drm_connector *connector = conn_state->connector;uint8_t *eld = connector->eld;uint32_t eldv;uint32_t tmp;@@ -279,16 +286,20 @@ static void g4x_audio_codec_enable(struct drm_connector *connector, }static void -hsw_dp_audio_config_update (struct intel_crtc *intel_crtc,enum port port, -const struct drm_display_mode *adjusted_mode) +hsw_dp_audio_config_update (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) { -struct drm_i915_private *dev_priv =to_i915 (intel_crtc->base.dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -int rate = acomp ? acomp->aud_sample_rate[port] :0 ; -const struct dp_aud_n_m *nm =audio_config_dp_get_n_m (intel_crtc, rate); -enum pipe pipe = intel_crtc->pipe; +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +enum port port = encoder->port; +enum pipe pipe = crtc->pipe; +const struct dp_aud_n_m *nm; +int rate;u32 tmp; + rate = acomp ? acomp->aud_sample_rate[port] :0 ; + nm =audio_config_dp_get_n_m (crtc_state, rate);if (nm)DRM_DEBUG_KMS ("using Maud %u, Naud %u\n" , nm->m, nm->n);else @@ -323,23 +334,26 @@ hsw_dp_audio_config_update(struct intel_crtc *intel_crtc, enum port port, }static void -hsw_hdmi_audio_config_update (struct intel_crtc *intel_crtc,enum port port, -const struct drm_display_mode *adjusted_mode) +hsw_hdmi_audio_config_update (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) { -struct drm_i915_private *dev_priv =to_i915 (intel_crtc->base.dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -int rate = acomp ? acomp->aud_sample_rate[port] :0 ; -enum pipe pipe = intel_crtc->pipe; -int n; +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +enum port port = encoder->port; +enum pipe pipe = crtc->pipe; +int n, rate;u32 tmp; + rate = acomp ? acomp->aud_sample_rate[port] :0 ; + tmp =I915_READ (HSW_AUD_CFG (pipe)); tmp &= ~AUD_CONFIG_N_VALUE_INDEX ; tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK ; tmp &= ~AUD_CONFIG_N_PROG_ENABLE ; - tmp |=audio_config_hdmi_pixel_clock (adjusted_mode); + tmp |=audio_config_hdmi_pixel_clock (crtc_state); - n =audio_config_hdmi_get_n (adjusted_mode, rate); + n =audio_config_hdmi_get_n (crtc_state, rate);if (n !=0 ) {DRM_DEBUG_KMS ("using N %d\n" , n);@@ -363,20 +377,22 @@ hsw_hdmi_audio_config_update(struct intel_crtc *intel_crtc, enum port port, }static void -hsw_audio_config_update (struct intel_crtc *intel_crtc,enum port port, -const struct drm_display_mode *adjusted_mode) +hsw_audio_config_update (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) { -if (intel_crtc_has_dp_encoder (intel_crtc->config)) -hsw_dp_audio_config_update (intel_crtc, port, adjusted_mode); +if (intel_crtc_has_dp_encoder (crtc_state)) +hsw_dp_audio_config_update (encoder, crtc_state);else -hsw_hdmi_audio_config_update (intel_crtc, port, adjusted_mode); +hsw_hdmi_audio_config_update (encoder, crtc_state); } -static void hsw_audio_codec_disable (struct intel_encoder *encoder) +static void hsw_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; +struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc); +enum pipe pipe = crtc->pipe;uint32_t tmp;DRM_DEBUG_KMS ("Disable audio codec on pipe %c\n" ,pipe_name (pipe));@@ -389,7 +405,7 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder) tmp |=AUD_CONFIG_N_PROG_ENABLE ; tmp &= ~AUD_CONFIG_UPPER_N_MASK ; tmp &= ~AUD_CONFIG_LOWER_N_MASK ; -if (intel_crtc_has_dp_encoder (intel_crtc->config)) +if (intel_crtc_has_dp_encoder (old_crtc_state)) tmp |=AUD_CONFIG_N_VALUE_INDEX ;I915_WRITE (HSW_AUD_CFG (pipe), tmp);@@ -402,14 +418,14 @@ static void hsw_audio_codec_disable(struct intel_encoder *encoder)mutex_unlock (&dev_priv->av_mutex); } -static void hsw_audio_codec_enable (struct drm_connector *connector, -struct intel_encoder *intel_encoder, -const struct drm_display_mode *adjusted_mode) +static void hsw_audio_codec_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state) { -struct drm_i915_private *dev_priv =to_i915 (connector->dev); -struct intel_crtc *intel_crtc =to_intel_crtc (intel_encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; -enum port port = intel_encoder->port; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_connector *connector = conn_state->connector; +enum pipe pipe = crtc->pipe;const uint8_t *eld = connector->eld;uint32_t tmp;int len, i;@@ -448,17 +464,19 @@ static void hsw_audio_codec_enable(struct drm_connector *connector,I915_WRITE (HSW_AUD_PIN_ELD_CP_VLD , tmp);/* Enable timestamps */ -hsw_audio_config_update (intel_crtc, port, adjusted_mode); +hsw_audio_config_update (encoder, crtc_state);mutex_unlock (&dev_priv->av_mutex); } -static void ilk_audio_codec_disable (struct intel_encoder *intel_encoder) +static void ilk_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) { -struct drm_i915_private *dev_priv =to_i915 (intel_encoder->base.dev); -struct intel_crtc *intel_crtc =to_intel_crtc (intel_encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; -enum port port = intel_encoder->port; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc); +enum pipe pipe = crtc->pipe; +enum port port = encoder->port;uint32_t tmp, eldv;i915_reg_t aud_config, aud_cntrl_st2;@@ -485,7 +503,7 @@ static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder) tmp |=AUD_CONFIG_N_PROG_ENABLE ; tmp &= ~AUD_CONFIG_UPPER_N_MASK ; tmp &= ~AUD_CONFIG_LOWER_N_MASK ; -if (intel_crtc_has_dp_encoder (intel_crtc->config)) +if (intel_crtc_has_dp_encoder (old_crtc_state)) tmp |=AUD_CONFIG_N_VALUE_INDEX ;I915_WRITE (aud_config, tmp);@@ -497,14 +515,15 @@ static void ilk_audio_codec_disable(struct intel_encoder *intel_encoder)I915_WRITE (aud_cntrl_st2, tmp); } -static void ilk_audio_codec_enable (struct drm_connector *connector, -struct intel_encoder *intel_encoder, -const struct drm_display_mode *adjusted_mode) +static void ilk_audio_codec_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +const struct drm_connector_state *conn_state) { -struct drm_i915_private *dev_priv =to_i915 (connector->dev); -struct intel_crtc *intel_crtc =to_intel_crtc (intel_encoder->base.crtc); -enum pipe pipe = intel_crtc->pipe; -enum port port = intel_encoder->port; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_connector *connector = conn_state->connector; +enum pipe pipe = crtc->pipe; +enum port port = encoder->port;uint8_t *eld = connector->eld;uint32_t tmp, eldv;int len, i;@@ -568,36 +587,36 @@ static void ilk_audio_codec_enable(struct drm_connector *connector, tmp &= ~AUD_CONFIG_N_VALUE_INDEX ; tmp &= ~AUD_CONFIG_N_PROG_ENABLE ; tmp &= ~AUD_CONFIG_PIXEL_CLOCK_HDMI_MASK ; -if (intel_crtc_has_dp_encoder (intel_crtc->config)) +if (intel_crtc_has_dp_encoder (crtc_state)) tmp |=AUD_CONFIG_N_VALUE_INDEX ;else - tmp |=audio_config_hdmi_pixel_clock (adjusted_mode); + tmp |=audio_config_hdmi_pixel_clock (crtc_state);I915_WRITE (aud_config, tmp); }/** * intel_audio_codec_enable - Enable the audio codec for HD audio -* @intel_encoder: encoder on which to enable audio +* @encoder: encoder on which to enable audio * @crtc_state: pointer to the current crtc state. * @conn_state: pointer to the current connector state. * * The enable sequences may only be performed after enabling the transcoder and * port, and after completed link training. */ -void intel_audio_codec_enable (struct intel_encoder *intel_encoder, +void intel_audio_codec_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state) { -struct drm_encoder *encoder = &intel_encoder->base; -const struct drm_display_mode *adjusted_mode = &crtc_state->base.adjusted_mode; -struct drm_connector *connector; -struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -enum port port = intel_encoder->port; -enum pipe pipe =to_intel_crtc (crtc_state->base.crtc)->pipe; +struct intel_crtc *crtc =to_intel_crtc (crtc_state->base.crtc); +struct drm_connector *connector = conn_state->connector; +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode; +enum port port = encoder->port; +enum pipe pipe = crtc->pipe; - connector = conn_state->connector; -if (!connector || !connector->eld[0 ]) +if (!connector->eld[0 ])return ; DRM_DEBUG_DRIVER("ELD on [CONNECTOR:%d:%s], [ENCODER:%d:%s]\n",@@ -609,19 +628,20 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder, connector->eld[6 ] =drm_av_sync_delay (connector, adjusted_mode) /2 ;if (dev_priv->display.audio_codec_enable) - dev_priv->display.audio_codec_enable (connector, intel_encoder, - adjusted_mode); + dev_priv->display.audio_codec_enable (encoder, + crtc_state, + conn_state);mutex_lock (&dev_priv->av_mutex); - intel_encoder->audio_connector = connector; + encoder->audio_connector = connector;/* referred in audio callbacks */ - dev_priv->av_enc_map[pipe] = intel_encoder; + dev_priv->av_enc_map[pipe] = encoder;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ -if (intel_encoder->type !=INTEL_OUTPUT_DP_MST ) +if (encoder->type !=INTEL_OUTPUT_DP_MST ) pipe =-1 ; acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port, (int ) pipe);@@ -629,36 +649,41 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,intel_lpe_audio_notify (dev_priv, pipe, port, connector->eld, crtc_state->port_clock, - intel_encoder->type ==INTEL_OUTPUT_DP ); + encoder->type ==INTEL_OUTPUT_DP ); }/** * intel_audio_codec_disable - Disable the audio codec for HD audio -* @intel_encoder: encoder on which to disable audio +* @encoder: encoder on which to disable audio +* @crtc_state: pointer to the old crtc state. +* @conn_state: pointer to the old connector state. * * The disable sequences must be performed before disabling the transcoder or * port. */ -void intel_audio_codec_disable (struct intel_encoder *intel_encoder) +void intel_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state) { -struct drm_encoder *encoder = &intel_encoder->base; -struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct i915_audio_component *acomp = dev_priv->audio_component; -enum port port = intel_encoder->port; -struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +struct intel_crtc *crtc =to_intel_crtc (old_crtc_state->base.crtc); +enum port port = encoder->port;enum pipe pipe = crtc->pipe;if (dev_priv->display.audio_codec_disable) - dev_priv->display.audio_codec_disable (intel_encoder); + dev_priv->display.audio_codec_disable (encoder, + old_crtc_state, + old_conn_state);mutex_lock (&dev_priv->av_mutex); - intel_encoder->audio_connector =NULL ; + encoder->audio_connector =NULL ; dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex);if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ -if (intel_encoder->type !=INTEL_OUTPUT_DP_MST ) +if (encoder->type !=INTEL_OUTPUT_DP_MST ) pipe =-1 ; acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, (int ) port, (int ) pipe);@@ -793,10 +818,9 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port, int pipe, int rate) {struct drm_i915_private *dev_priv =kdev_to_i915 (kdev); -struct intel_encoder *intel_encoder; -struct intel_crtc *crtc; -struct drm_display_mode *adjusted_mode;struct i915_audio_component *acomp = dev_priv->audio_component; +struct intel_encoder *encoder; +struct intel_crtc *crtc;int err =0 ;if (!HAS_DDI (dev_priv))@@ -806,23 +830,19 @@ static int i915_audio_component_sync_audio_rate(struct device *kdev, int port,mutex_lock (&dev_priv->av_mutex);/* 1. get the pipe */ - intel_encoder =get_saved_enc (dev_priv, port, pipe); -if (!intel_encoder || !intel_encoder->base.crtc) { + encoder =get_saved_enc (dev_priv, port, pipe); +if (!encoder || !encoder->base.crtc) {DRM_DEBUG_KMS ("Not valid for port %c\n" ,port_name (port)); err = -ENODEV ; goto unlock; } -/* pipe passed from the audio driver will be -1 for Non-MST case */ - crtc =to_intel_crtc (intel_encoder->base.crtc); - pipe = crtc->pipe; - - adjusted_mode = &crtc->config->base.adjusted_mode; + crtc =to_intel_crtc (encoder->base.crtc);/* port must be valid now, otherwise the pipe will be invalid */ acomp->aud_sample_rate[port] = rate; -hsw_audio_config_update (crtc, port, adjusted_mode); +hsw_audio_config_update (encoder, crtc->config); unlock:mutex_unlock (&dev_priv->av_mutex);drivers/gpu/drm/i915/intel_ddi.c +4
-2@@ -2425,7 +2425,8 @@ static void intel_disable_ddi_dp(struct intel_encoder *encoder,struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);intel_edp_drrs_disable (intel_dp, old_crtc_state);intel_psr_disable (intel_dp, old_crtc_state);@@ -2437,7 +2438,8 @@ static void intel_disable_ddi_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); intel_hdmi_handle_sink_scrambling(encoder, old_conn_state->connector,drivers/gpu/drm/i915/intel_dp.c +2
-1@@ -2708,7 +2708,8 @@ static void intel_disable_dp(struct intel_encoder *encoder,struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);/* Make sure the panel is off before trying to change the mode. But also * ensure that we have vdd while we switch off the panel. */ drivers/gpu/drm/i915/intel_dp_mst.c +2
-1@@ -149,7 +149,8 @@ static void intel_mst_disable_dp(struct intel_encoder *encoder,DRM_ERROR ("failed to update payload %d\n" , ret); }if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); } static void intel_mst_post_disable_dp(struct intel_encoder *encoder,drivers/gpu/drm/i915/intel_drv.h +3
-1@@ -1311,7 +1311,9 @@ void intel_init_audio_hooks(struct drm_i915_private *dev_priv);void intel_audio_codec_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state,const struct drm_connector_state *conn_state); -void intel_audio_codec_disable (struct intel_encoder *encoder); +void intel_audio_codec_disable (struct intel_encoder *encoder, +const struct intel_crtc_state *old_crtc_state, +const struct drm_connector_state *old_conn_state);void i915_audio_component_init (struct drm_i915_private *dev_priv);void i915_audio_component_cleanup (struct drm_i915_private *dev_priv);void intel_audio_init (struct drm_i915_private *dev_priv);drivers/gpu/drm/i915/intel_hdmi.c +4
-2@@ -1206,7 +1206,8 @@ static void g4x_disable_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state);intel_disable_hdmi (encoder, old_crtc_state, old_conn_state); }@@ -1216,7 +1217,8 @@ static void pch_disable_hdmi(struct intel_encoder *encoder, const struct drm_connector_state *old_conn_state) {if (old_crtc_state->has_audio) -intel_audio_codec_disable (encoder); +intel_audio_codec_disable (encoder, + old_crtc_state, old_conn_state); } static void pch_post_disable_hdmi(struct intel_encoder *encoder,Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
In reply to Ville Syrjala== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
URL : https://patchwork.freedesktop.org/series/32858/
State : success
== Summary ==
Series 32858v1 series starting with [1/2] drm/i915: Pass around crtc and connector states for audio
https://patchwork.freedesktop.org/api/1.0/series/32858/revisions/1/mbox/
Test gem_mmap_gtt:
Subgroup basic-read-no-prefault:
dmesg-warn -> PASS (fi-bsw-n3050)
Test kms_addfb_basic:
Subgroup invalid-set-prop:
incomplete -> PASS (fi-cnl-y)
Test kms_flip:
Subgroup basic-flip-vs-dpms:
notrun -> INCOMPLETE (fi-cnl-y)fi-bdw-5557u total:289 pass:268 dwarn:0 dfail:0 fail:0 skip:21 time:443s fi-bdw-gvtdvm total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:455s fi-blb-e6850 total:289 pass:223 dwarn:1 dfail:0 fail:0 skip:65 time:378s fi-bsw-n3050 total:289 pass:243 dwarn:0 dfail:0 fail:0 skip:46 time:526s fi-bwr-2160 total:289 pass:183 dwarn:0 dfail:0 fail:0 skip:106 time:277s fi-bxt-j4205 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:505s fi-byt-j1900 total:289 pass:253 dwarn:1 dfail:0 fail:0 skip:35 time:506s fi-byt-n2820 total:289 pass:249 dwarn:1 dfail:0 fail:0 skip:39 time:494s fi-cfl-s total:289 pass:253 dwarn:4 dfail:0 fail:0 skip:32 time:550s fi-cnl-y total:217 pass:196 dwarn:0 dfail:0 fail:0 skip:20 fi-elk-e7500 total:289 pass:229 dwarn:0 dfail:0 fail:0 skip:60 time:431s fi-gdg-551 total:289 pass:178 dwarn:1 dfail:0 fail:1 skip:109 time:263s fi-glk-1 total:289 pass:261 dwarn:0 dfail:0 fail:0 skip:28 time:587s fi-glk-dsi total:289 pass:258 dwarn:0 dfail:0 fail:1 skip:30 time:490s fi-hsw-4770 total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:428s fi-hsw-4770r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:429s fi-ilk-650 total:289 pass:228 dwarn:0 dfail:0 fail:0 skip:61 time:427s fi-ivb-3520m total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:498s fi-ivb-3770 total:289 pass:260 dwarn:0 dfail:0 fail:0 skip:29 time:465s fi-kbl-7500u total:289 pass:264 dwarn:1 dfail:0 fail:0 skip:24 time:491s fi-kbl-7560u total:289 pass:270 dwarn:0 dfail:0 fail:0 skip:19 time:574s fi-kbl-7567u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:481s fi-kbl-r total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:589s fi-skl-6260u total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:456s fi-skl-6600u total:289 pass:262 dwarn:0 dfail:0 fail:0 skip:27 time:584s fi-skl-6700hq total:289 pass:263 dwarn:0 dfail:0 fail:0 skip:26 time:649s fi-skl-6700k total:289 pass:265 dwarn:0 dfail:0 fail:0 skip:24 time:518s fi-skl-6770hq total:289 pass:269 dwarn:0 dfail:0 fail:0 skip:20 time:503s fi-skl-gvtdvm total:289 pass:266 dwarn:0 dfail:0 fail:0 skip:23 time:462s fi-snb-2520m total:289 pass:250 dwarn:0 dfail:0 fail:0 skip:39 time:574s fi-snb-2600 total:289 pass:249 dwarn:0 dfail:0 fail:0 skip:40 time:420s
fi-bxt-dsi failed to connect after reboot
fi-pnv-d510 failed to connect after reboot
411ec53a58b3cf22efe7e8c7e6af94945c15568d drm-tip: 2017y-10m-31d-18h-16m-29s UTC integration manifest 756dca3f2f57 drm/i915: Remove most encoder->type uses from the audio code 9204bc274980 drm/i915: Pass around crtc and connector states for audio
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6282/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx