drm/i915: Don't use crtc->config when reading out infoframe state
Subsystems (2)
PATCH 1/1 drm/i915: Don't use crtc->config when reading out infoframe state
From: Ville Syrjälä <[email protected]>
The .get_config() hooks should not reference anything in crtc->config, everything should be based on the passed in pipe_config instead. So don't dig out the cpu_transcoder from crtc->config on ddi platfforms, and also avoid using the encoder->crtc link and instead look up the pipe via pipe_config->base.crtc.
I don't think this will actually fix anything since during the initial state readout we set up the encoder->crtc link prior to calling .get_config(), and during the modeset state check the encoder->crtc ought to be correct anyway since it's that state we just programmed. But this seems the right thing to do anyway.
While at it, do some house cleaning on the local variables in the .infoframe_enabled() hooks.
--- drivers/gpu/drm/i915/intel_ddi.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 3 ++- drivers/gpu/drm/i915/intel_hdmi.c | 47 +++++++++++++++++++-------------------- 3 files changed, 26 insertions(+), 26 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +1 -1
@@ -3151,7 +3151,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder, pipe_config->has_hdmi_sink = true; intel_hdmi =enc_to_intel_hdmi (&encoder->base); -if (intel_hdmi->infoframe_enabled (&encoder->base)) +if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true;break ;case TRANS_DDI_MODE_SELECT_DVI :
drivers/gpu/drm/i915/intel_drv.h +2 -1
@@ -711,7 +711,8 @@ struct intel_hdmi {void (*set_infoframes)(struct drm_encoder *encoder,bool enable,const struct drm_display_mode *adjusted_mode); -bool (*infoframe_enabled)(struct drm_encoder *encoder); +bool (*infoframe_enabled)(struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config); };struct intel_dp_mst_encoder ;
drivers/gpu/drm/i915/intel_hdmi.c +23 -24
90 lines not on this page · raw message
Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerNot strictly related to this patch.
Quoted 2 lines · On Thu, 26 Nov 2015, [email protected] wrote:
The .get_config() hooks should not reference anything in
crtc->config, everything should be based on the passed inpipe_configinstead.
This is the kind of authoritative comment that I would appreciate seeing in the kernel-doc for the hooks in struct intel_encoder. We have practically nothing of the sort. We still seem to rely more on oral tradition than actual documentation. (Not that there's anything wrong with oral tradition per se, it's just that we don't regularly sit around campfires reciting encoder hook rules or make folk songs about them.)
BR,
Jani.
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · On Thu, Nov 26, 2015 at 06:27:07PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The .get_config() hooks should not reference anything in
crtc->config, everything should be based on the passed inpipe_configinstead. So don't dig out thecpu_transcoderfromcrtc->configon ddi platfforms, and also avoid using theencoder->crtclink and instead look up the pipe viapipe_config->base.crtc.I don't think this will actually fix anything since during the initial state readout we set up the
encoder->crtclink prior to calling .get_config(), and during the modeset state check theencoder->crtcought to be correct anyway since it's that state we just programmed. But this seems the right thing to do anyway.
Quoted 4 lines
While at it, do some house cleaning on the local variables in the .infoframe_enabled() hooks.
Signed-off-by Ville Syrjälä <[email protected]>
Quoted 140 lines
--- drivers/gpu/drm/i915/intel_ddi.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 3 ++- drivers/gpu/drm/i915/intel_hdmi.c | 47 +++++++++++++++++++-------------------- 3 files changed, 26 insertions(+), 26 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +1
-1@@ -3151,7 +3151,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder, pipe_config->has_hdmi_sink = true; intel_hdmi =enc_to_intel_hdmi (&encoder->base); -if (intel_hdmi->infoframe_enabled (&encoder->base)) +if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true;break ;case TRANS_DDI_MODE_SELECT_DVI :drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -711,7 +711,8 @@ struct intel_hdmi {void (*set_infoframes)(struct drm_encoder *encoder,bool enable,const struct drm_display_mode *adjusted_mode); -bool (*infoframe_enabled)(struct drm_encoder *encoder); +bool (*infoframe_enabled)(struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config); };struct intel_dp_mst_encoder ;drivers/gpu/drm/i915/intel_hdmi.c +23
-24@@ -169,10 +169,10 @@ static void g4x_write_infoframe(struct drm_encoder *encoder,POSTING_READ (VIDEO_DIP_CTL ); } -static bool g4x_infoframe_enabled (struct drm_encoder *encoder) +static bool g4x_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_private *dev_priv =to_i915 (encoder->dev);struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);u32 val =I915_READ (VIDEO_DIP_CTL );@@ -225,13 +225,13 @@ static void ibx_write_infoframe(struct drm_encoder *encoder,POSTING_READ (reg); } -static bool ibx_infoframe_enabled (struct drm_encoder *encoder) +static bool ibx_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev);struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder); -i915_reg_t reg =TVIDEO_DIP_CTL (intel_crtc->pipe); +enum pipe pipe =to_intel_crtc (pipe_config->base.crtc)->pipe; +i915_reg_t reg =TVIDEO_DIP_CTL (pipe);u32 val =I915_READ (reg);if ((val &VIDEO_DIP_ENABLE ) ==0 )@@ -287,12 +287,12 @@ static void cpt_write_infoframe(struct drm_encoder *encoder,POSTING_READ (reg); } -static bool cpt_infoframe_enabled (struct drm_encoder *encoder) +static bool cpt_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); -u32 val =I915_READ (TVIDEO_DIP_CTL (intel_crtc->pipe)); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +enum pipe pipe =to_intel_crtc (pipe_config->base.crtc)->pipe; +u32 val =I915_READ (TVIDEO_DIP_CTL (pipe));if ((val &VIDEO_DIP_ENABLE ) ==0 )return false;@@ -341,13 +341,13 @@ static void vlv_write_infoframe(struct drm_encoder *encoder,POSTING_READ (reg); } -static bool vlv_infoframe_enabled (struct drm_encoder *encoder) +static bool vlv_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev);struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder); -u32 val =I915_READ (VLV_TVIDEO_DIP_CTL (intel_crtc->pipe)); +enum pipe pipe =to_intel_crtc (pipe_config->base.crtc)->pipe; +u32 val =I915_READ (VLV_TVIDEO_DIP_CTL (pipe));if ((val &VIDEO_DIP_ENABLE ) ==0 )return false;@@ -398,12 +398,11 @@ static void hsw_write_infoframe(struct drm_encoder *encoder,POSTING_READ (ctl_reg); } -static bool hsw_infoframe_enabled (struct drm_encoder *encoder) +static bool hsw_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); -u32 val =I915_READ (HSW_TVIDEO_DIP_CTL (intel_crtc->config->cpu_transcoder)); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +u32 val =I915_READ (HSW_TVIDEO_DIP_CTL (pipe_config->cpu_transcoder)); return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW | VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |@@ -927,7 +926,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,if (tmp &HDMI_MODE_SELECT_HDMI ) pipe_config->has_hdmi_sink = true; -if (intel_hdmi->infoframe_enabled (&encoder->base)) +if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true;if (tmp &SDVO_AUDIO_ENABLE )Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ville Syrjälä
AppliedQuoted 15 lines · Daniel Vetter
Quoted 14 lines · On Thu, Nov 26, 2015 at 06:27:07PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
The .get_config() hooks should not reference anything in
crtc->config, everything should be based on the passed inpipe_configinstead. So don't dig out thecpu_transcoderfromcrtc->configon ddi platfforms, and also avoid using theencoder->crtclink and instead look up the pipe viapipe_config->base.crtc.I don't think this will actually fix anything since during the initial state readout we set up the
encoder->crtclink prior to calling .get_config(), and during the modeset state check theencoder->crtcought to be correct anyway since it's that state we just programmed. But this seems the right thing to do anyway.
Quoted 6 lines
Quoted 4 lines
While at it, do some house cleaning on the local variables in the .infoframe_enabled() hooks.
Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>
Pushed to dinq. Thanks for the review.
Quoted 146 lines
Quoted 141 lines
--- drivers/gpu/drm/i915/intel_ddi.c | 2 +- drivers/gpu/drm/i915/intel_drv.h | 3 ++- drivers/gpu/drm/i915/intel_hdmi.c | 47 +++++++++++++++++++-------------------- 3 files changed, 26 insertions(+), 26 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +1
-1@@ -3151,7 +3151,7 @@ void intel_ddi_get_config(struct intel_encoder *encoder, pipe_config->has_hdmi_sink = true; intel_hdmi =enc_to_intel_hdmi (&encoder->base); -if (intel_hdmi->infoframe_enabled (&encoder->base)) +if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true;break ;case TRANS_DDI_MODE_SELECT_DVI :drivers/gpu/drm/i915/intel_drv.h +2
-1@@ -711,7 +711,8 @@ struct intel_hdmi {void (*set_infoframes)(struct drm_encoder *encoder,bool enable,const struct drm_display_mode *adjusted_mode); -bool (*infoframe_enabled)(struct drm_encoder *encoder); +bool (*infoframe_enabled)(struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config); };struct intel_dp_mst_encoder ;drivers/gpu/drm/i915/intel_hdmi.c +23
-24@@ -169,10 +169,10 @@ static void g4x_write_infoframe(struct drm_encoder *encoder,POSTING_READ (VIDEO_DIP_CTL ); } -static bool g4x_infoframe_enabled (struct drm_encoder *encoder) +static bool g4x_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_i915_private *dev_priv =to_i915 (encoder->dev);struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);u32 val =I915_READ (VIDEO_DIP_CTL );@@ -225,13 +225,13 @@ static void ibx_write_infoframe(struct drm_encoder *encoder,POSTING_READ (reg); } -static bool ibx_infoframe_enabled (struct drm_encoder *encoder) +static bool ibx_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev);struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder); -i915_reg_t reg =TVIDEO_DIP_CTL (intel_crtc->pipe); +enum pipe pipe =to_intel_crtc (pipe_config->base.crtc)->pipe; +i915_reg_t reg =TVIDEO_DIP_CTL (pipe);u32 val =I915_READ (reg);if ((val &VIDEO_DIP_ENABLE ) ==0 )@@ -287,12 +287,12 @@ static void cpt_write_infoframe(struct drm_encoder *encoder,POSTING_READ (reg); } -static bool cpt_infoframe_enabled (struct drm_encoder *encoder) +static bool cpt_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); -u32 val =I915_READ (TVIDEO_DIP_CTL (intel_crtc->pipe)); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +enum pipe pipe =to_intel_crtc (pipe_config->base.crtc)->pipe; +u32 val =I915_READ (TVIDEO_DIP_CTL (pipe));if ((val &VIDEO_DIP_ENABLE ) ==0 )return false;@@ -341,13 +341,13 @@ static void vlv_write_infoframe(struct drm_encoder *encoder,POSTING_READ (reg); } -static bool vlv_infoframe_enabled (struct drm_encoder *encoder) +static bool vlv_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev);struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder); -u32 val =I915_READ (VLV_TVIDEO_DIP_CTL (intel_crtc->pipe)); +enum pipe pipe =to_intel_crtc (pipe_config->base.crtc)->pipe; +u32 val =I915_READ (VLV_TVIDEO_DIP_CTL (pipe));if ((val &VIDEO_DIP_ENABLE ) ==0 )return false;@@ -398,12 +398,11 @@ static void hsw_write_infoframe(struct drm_encoder *encoder,POSTING_READ (ctl_reg); } -static bool hsw_infoframe_enabled (struct drm_encoder *encoder) +static bool hsw_infoframe_enabled (struct drm_encoder *encoder, +const struct intel_crtc_state *pipe_config) { -struct drm_device *dev = encoder->dev; -struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); -u32 val =I915_READ (HSW_TVIDEO_DIP_CTL (intel_crtc->config->cpu_transcoder)); +struct drm_i915_private *dev_priv =to_i915 (encoder->dev); +u32 val =I915_READ (HSW_TVIDEO_DIP_CTL (pipe_config->cpu_transcoder)); return val & (VIDEO_DIP_ENABLE_VSC_HSW | VIDEO_DIP_ENABLE_AVI_HSW | VIDEO_DIP_ENABLE_GCP_HSW | VIDEO_DIP_ENABLE_VS_HSW |@@ -927,7 +926,7 @@ static void intel_hdmi_get_config(struct intel_encoder *encoder,if (tmp &HDMI_MODE_SELECT_HDMI ) pipe_config->has_hdmi_sink = true; -if (intel_hdmi->infoframe_enabled (&encoder->base)) +if (intel_hdmi->infoframe_enabled (&encoder->base, pipe_config)) pipe_config->has_infoframe = true;if (tmp &SDVO_AUDIO_ENABLE )Signature · 6 lines
2.4.10 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx