On Tue, 2016-10-25 at 11:47 +0300, Jani Nikula wrote: > On Tue, 25 Oct 2016, Dhinakaran Pandiyan <dhinakaran.pandiyan@xxxxxxxxx> wrote: > > Enabling DP audio stall fix is necessary to play audio over DP HBR2. So, > > let's set this bit right before enabling the audio codec. Playing audio > > without setting this bit results in pipe FIFO underruns. > > > > Signed-off-by: Dhinakaran Pandiyan <dhinakaran.pandiyan@xxxxxxxxx> > > The fix itself looks legit, but please move the enable to beginning of > hsw_audio_codec_enable and disable to end of hsw_audio_codec_disable in > intel_audio.c. Seems to me you don't have to have separate functions for > this, just add it inline there. > I thought of it, but I didn't find any instances reading/writing of non-audio registers in intel_audio.c. So, left these functions outside. > Is there a W/A name for this? > > > BR, > Jani. > > Not yet. -DK > > --- > > drivers/gpu/drm/i915/i915_reg.h | 5 +++++ > > drivers/gpu/drm/i915/intel_ddi.c | 38 ++++++++++++++++++++++++++++++++++++++ > > drivers/gpu/drm/i915/intel_drv.h | 2 ++ > > 3 files changed, 45 insertions(+) > > > > diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h > > index 00efaa1..76dac48 100644 > > --- a/drivers/gpu/drm/i915/i915_reg.h > > +++ b/drivers/gpu/drm/i915/i915_reg.h > > @@ -6236,6 +6236,11 @@ enum { > > #define SLICE_ECO_CHICKEN0 _MMIO(0x7308) > > #define PIXEL_MASK_CAMMING_DISABLE (1 << 14) > > > > +#define _CHICKEN_TRANS_A 0x420C0 > > +#define _CHICKEN_TRANS_B 0x420C4 > > +#define CHICKEN_TRANS(tran) _MMIO_TRANS(tran, _CHICKEN_TRANS_A, _CHICKEN_TRANS_B) > > +#define SPARE_13 (1<<13) > > + > > /* WaCatErrorRejectionIssue */ > > #define GEN7_SQ_CHICKEN_MBCUNIT_CONFIG _MMIO(0x9030) > > #define GEN7_SQ_CHICKEN_MBCUNIT_SQINTMOB (1<<11) > > diff --git a/drivers/gpu/drm/i915/intel_ddi.c b/drivers/gpu/drm/i915/intel_ddi.c > > index fb18d69..84c91c1 100644 > > --- a/drivers/gpu/drm/i915/intel_ddi.c > > +++ b/drivers/gpu/drm/i915/intel_ddi.c > > @@ -1858,6 +1858,38 @@ void intel_ddi_fdi_post_disable(struct intel_encoder *intel_encoder, > > I915_WRITE(FDI_RX_CTL(PIPE_A), val); > > } > > > > +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config) > > +{ > > + struct drm_i915_private *dev_priv = > > + to_i915(pipe_config->base.crtc->dev); > > + enum transcoder cpu_transcoder = pipe_config->cpu_transcoder; > > + uint32_t temp; > > + > > + if (intel_crtc_has_dp_encoder(pipe_config) && > > + pipe_config->port_clock >= 54000) { > > + > > + temp = I915_READ(CHICKEN_TRANS(cpu_transcoder)); > > + temp |= SPARE_13; > > + I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp); > > + } > > +} > > + > > +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config) > > +{ > > + struct drm_i915_private *dev_priv = > > + to_i915(pipe_config->base.crtc->dev); > > + enum transcoder cpu_transcoder = pipe_config->cpu_transcoder; > > + uint32_t temp; > > + > > + if (intel_crtc_has_dp_encoder(pipe_config) && > > + pipe_config->port_clock >= 54000) { > > + > > + temp = I915_READ(CHICKEN_TRANS(cpu_transcoder)); > > + temp &= ~SPARE_13; > > + I915_WRITE(CHICKEN_TRANS(cpu_transcoder), temp); > > + } > > +} > > + > > static void intel_enable_ddi(struct intel_encoder *intel_encoder, > > struct intel_crtc_state *pipe_config, > > struct drm_connector_state *conn_state) > > @@ -1893,6 +1925,9 @@ static void intel_enable_ddi(struct intel_encoder *intel_encoder, > > } > > > > if (intel_crtc->config->has_audio) { > > + if (IS_GEN9(dev_priv)) > > + gen9_enable_dp_audio_stall_fix(pipe_config); > > + > > intel_display_power_get(dev_priv, POWER_DOMAIN_AUDIO); > > intel_audio_codec_enable(intel_encoder); > > } > > @@ -1912,6 +1947,9 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder, > > if (intel_crtc->config->has_audio) { > > intel_audio_codec_disable(intel_encoder); > > intel_display_power_put(dev_priv, POWER_DOMAIN_AUDIO); > > + > > + if (IS_GEN9(dev_priv)) > > + gen9_disable_dp_audio_stall_fix(old_crtc_state); > > } > > > > if (type == INTEL_OUTPUT_EDP) { > > diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h > > index 4e90b07..ef02c62 100644 > > --- a/drivers/gpu/drm/i915/intel_drv.h > > +++ b/drivers/gpu/drm/i915/intel_drv.h > > @@ -1189,6 +1189,8 @@ unsigned int intel_fb_align_height(struct drm_device *dev, > > uint64_t fb_format_modifier); > > u32 intel_fb_stride_alignment(const struct drm_i915_private *dev_priv, > > uint64_t fb_modifier, uint32_t pixel_format); > > +void gen9_enable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config); > > +void gen9_disable_dp_audio_stall_fix(struct intel_crtc_state *pipe_config); > > > > /* intel_audio.c */ > > void intel_init_audio_hooks(struct drm_i915_private *dev_priv); > _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx