modeset interface cleanups
Subsystems (2)
cover modeset interface cleanups
Hi all,
I've figured it's time that we rip out our legacy modeset encoder callbacks from the crtc helpers and only use the new ones. This patch series converts over the last few stragglers of encoder_helper_funcs->mode_set and ->mode_fixup.
As the icing on the cake I've thrown in a conversion of the old timings_set logic to something more natural in our new world where we precompute the entire pipe config and can freely control the code flow in that stage.
Comments, flames and testing highly welcome.
Cheers, Daniel
Daniel Vetter (13):
drm/i915/dvo: use intel_encoder to the upcast macro drm/i915/dvo: switch ->mode_fixup to ->compute_config drm/i915: rip out legacy encoder->mode_fixup logic drm/i915/dvo: use native encoder ->mode_set callback drm/i915/sdvo: use intel_encoder for upcast helper drm/i915/tv: Use native encoder->mode_set callback drm/i915/crt: use native encoder->mode_set callback drm/i915/hdmi: use native encoder mode_set callback drm/i915/dp: use native encoder ->mode_set callback drm/i915/lvds: use the native encoder ->mode_set callback drm/i915/ddi: use the native encoder ->mode_set callback drm/i915: rip out legacy encoder->mode_set callback drm/i915: clean up crtc timings computation
drivers/gpu/drm/i915/intel_crt.c | 34 +++++++++------------- drivers/gpu/drm/i915/intel_ddi.c | 39 +++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 36 ++++------------------- drivers/gpu/drm/i915/intel_dp.c | 19 +++++------- drivers/gpu/drm/i915/intel_drv.h | 4 --- drivers/gpu/drm/i915/intel_dvo.c | 56 +++++++++++++++++------------------- drivers/gpu/drm/i915/intel_hdmi.c | 29 ++++++++----------- drivers/gpu/drm/i915/intel_lvds.c | 16 ++++------- drivers/gpu/drm/i915/intel_panel.c | 3 -- drivers/gpu/drm/i915/intel_sdvo.c | 23 +++++++-------- drivers/gpu/drm/i915/intel_tv.c | 27 ++++++----------- 11 files changed, 105 insertions(+), 181 deletions(-)
Signature · 1 line
1.8.1.4
PATCH 1/13 drm/i915/dvo: use intel_encoder to the upcast macro
More natural and will soon be even better!
--- drivers/gpu/drm/i915/intel_dvo.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_dvo.c +9 -9
@@ -100,9 +100,9 @@ struct intel_dvo {bool panel_wants_dither; }; -static struct intel_dvo *enc_to_intel_dvo (struct drm_encoder *encoder) +static struct intel_dvo *enc_to_dvo (struct intel_encoder *encoder) { - return container_of(encoder, struct intel_dvo, base.base); + return container_of(encoder, struct intel_dvo, base); }static struct intel_dvo *intel_attached_dvo (struct drm_connector *connector)
@@ -123,7 +123,7 @@ static bool intel_dvo_get_hw_state(struct intel_encoder *encoder, {struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_dvo *intel_dvo =enc_to_intel_dvo (&encoder->base); +struct intel_dvo *intel_dvo =enc_to_dvo (encoder);u32 tmp; tmp =I915_READ (intel_dvo->dev.dvo_reg);
@@ -140,7 +140,7 @@ static void intel_dvo_get_config(struct intel_encoder *encoder, struct intel_crtc_config *pipe_config) {struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; -struct intel_dvo *intel_dvo =enc_to_intel_dvo (&encoder->base); +struct intel_dvo *intel_dvo =enc_to_dvo (encoder);u32 tmp, flags =0 ; tmp =I915_READ (intel_dvo->dev.dvo_reg);
@@ -159,7 +159,7 @@ static void intel_dvo_get_config(struct intel_encoder *encoder,static void intel_disable_dvo (struct intel_encoder *encoder) {struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; -struct intel_dvo *intel_dvo =enc_to_intel_dvo (&encoder->base); +struct intel_dvo *intel_dvo =enc_to_dvo (encoder);u32 dvo_reg = intel_dvo->dev.dvo_reg;u32 temp =I915_READ (dvo_reg);
@@ -171,7 +171,7 @@ static void intel_disable_dvo(struct intel_encoder *encoder)static void intel_enable_dvo (struct intel_encoder *encoder) {struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; -struct intel_dvo *intel_dvo =enc_to_intel_dvo (&encoder->base); +struct intel_dvo *intel_dvo =enc_to_dvo (encoder);u32 dvo_reg = intel_dvo->dev.dvo_reg;u32 temp =I915_READ (dvo_reg);
@@ -245,7 +245,7 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder,const struct drm_display_mode *mode, struct drm_display_mode *adjusted_mode) { - struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); + struct intel_dvo *intel_dvo = enc_to_dvo(to_intel_encoder(encoder));/* If we have timings from the BIOS for the panel, put them in * to the adjusted mode. The CRTC will be set up for this mode,
@@ -279,7 +279,7 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,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 intel_dvo *intel_dvo =enc_to_intel_dvo (encoder); +struct intel_dvo *intel_dvo =enc_to_dvo (to_intel_encoder (encoder));int pipe = intel_crtc->pipe;u32 dvo_val;u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg;
@@ -389,7 +389,7 @@ static const struct drm_connector_helper_funcs intel_dvo_connector_helper_funcsstatic void intel_dvo_enc_destroy (struct drm_encoder *encoder) { -struct intel_dvo *intel_dvo =enc_to_intel_dvo (encoder); +struct intel_dvo *intel_dvo =enc_to_dvo (to_intel_encoder (encoder));if (intel_dvo->dev.dev_ops->destroy) intel_dvo->dev.dev_ops->destroy (&intel_dvo->dev);
Signature · 1 line
1.8.1.4
PATCH 2/13 drm/i915/dvo: switch ->mode_fixup to ->compute_config
In reply to Daniel VetterThis is the last encoder ->mode_fixup callback we have left, so convert it.
--- drivers/gpu/drm/i915/intel_dvo.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_dvo.c +8 -6
@@ -241,11 +241,11 @@ static int intel_dvo_mode_valid(struct drm_connector *connector,return intel_dvo->dev.dev_ops->mode_valid (&intel_dvo->dev, mode); } -static bool intel_dvo_mode_fixup (struct drm_encoder *encoder, -const struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static bool intel_dvo_compute_config (struct intel_encoder *encoder, +struct intel_crtc_config *pipe_config) { -struct intel_dvo *intel_dvo =enc_to_dvo (to_intel_encoder (encoder)); +struct intel_dvo *intel_dvo =enc_to_dvo (encoder); +struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;/* If we have timings from the BIOS for the panel, put them in * to the adjusted mode. The CRTC will be set up for this mode,
@@ -267,7 +267,9 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, }if (intel_dvo->dev.dev_ops->mode_fixup) -return intel_dvo->dev.dev_ops->mode_fixup (&intel_dvo->dev, mode, adjusted_mode); +return intel_dvo->dev.dev_ops->mode_fixup (&intel_dvo->dev, + &pipe_config->requested_mode, + adjusted_mode);return true; }
@@ -370,7 +372,6 @@ static void intel_dvo_destroy(struct drm_connector *connector) }static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = { - .mode_fixup = intel_dvo_mode_fixup, .mode_set = intel_dvo_mode_set, };
@@ -468,6 +469,7 @@ void intel_dvo_init(struct drm_device *dev) intel_encoder->enable = intel_enable_dvo; intel_encoder->get_hw_state = intel_dvo_get_hw_state; intel_encoder->get_config = intel_dvo_get_config; + intel_encoder->compute_config = intel_dvo_compute_config; intel_connector->get_hw_state = intel_dvo_connector_get_hw_state;/* Now, try to find a controller */
Signature · 1 line
1.8.1.4
Re: [PATCH 02/13] drm/i915/dvo: switch ->mode_fixup to ->compute_config
Quoted 29 lines · Daniel Vetter
This is the last encoder ->mode_fixup callback we have left, so convert it.
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_dvo.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dvo.c +4
-4@@ -241,11 +241,11 @@ static int intel_dvo_mode_valid(struct drm_connector *connector,return intel_dvo->dev.dev_ops->mode_valid (&intel_dvo->dev, mode); } -static bool intel_dvo_mode_fixup (struct drm_encoder *encoder, -const struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static bool intel_dvo_compute_config (struct intel_encoder *encoder, +struct intel_crtc_config *pipe_config) { -struct intel_dvo *intel_dvo =enc_to_dvo (to_intel_encoder (encoder)); +struct intel_dvo *intel_dvo =enc_to_dvo (encoder); +struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;/* If we have timings from the BIOS for the panel, put them in * to the adjusted mode. The CRTC will be set up for this mode,
drivers/gpu/drm/i915/intel_dvo.c static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, · line 272
Quoted 7 lines
drivers/gpu/drm/i915/intel_dvo.c +3
-1@@ -267,7 +267,9 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, }if (intel_dvo->dev.dev_ops->mode_fixup) -return intel_dvo->dev.dev_ops->mode_fixup (&intel_dvo->dev, mode, adjusted_mode); +return intel_dvo->dev.dev_ops->mode_fixup (&intel_dvo->dev, + &pipe_config->requested_mode, + adjusted_mode);
Since we are completely removing mode_fixup shouldn't we rip this out?
Quoted 26 lines
drivers/gpu/drm/i915/intel_dvo.c +1
-2return true; }@@ -370,7 +372,6 @@ static void intel_dvo_destroy(struct drm_connector *connector) }static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = { - .mode_fixup = intel_dvo_mode_fixup, .mode_set = intel_dvo_mode_set, };@@ -468,6 +469,7 @@ void intel_dvo_init(struct drm_device *dev) intel_encoder->enable = intel_enable_dvo; intel_encoder->get_hw_state = intel_dvo_get_hw_state; intel_encoder->get_config = intel_dvo_get_config; + intel_encoder->compute_config = intel_dvo_compute_config; intel_connector->get_hw_state = intel_dvo_connector_get_hw_state;/* Now, try to find a controller */ --1.8.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Re: [PATCH 02/13] drm/i915/dvo: switch ->mode_fixup to ->compute_config
Quoted 32 lines · Rodrigo Vivi
Quoted 31 lines · Daniel Vetter
This is the last encoder ->mode_fixup callback we have left, so convert it.
Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_dvo.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_dvo.c +4
-4@@ -241,11 +241,11 @@ static int intel_dvo_mode_valid(struct drm_connector *connector,return intel_dvo->dev.dev_ops->mode_valid (&intel_dvo->dev, mode); } -static bool intel_dvo_mode_fixup (struct drm_encoder *encoder, -const struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static bool intel_dvo_compute_config (struct intel_encoder *encoder, +struct intel_crtc_config *pipe_config) { -struct intel_dvo *intel_dvo =enc_to_dvo (to_intel_encoder (encoder)); +struct intel_dvo *intel_dvo =enc_to_dvo (encoder); +struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;/* If we have timings from the BIOS for the panel, put them in * to the adjusted mode. The CRTC will be set up for this mode, @@ -267,7 +267,9 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, }
Quoted 7 lines
drivers/gpu/drm/i915/intel_dvo.c static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, · line 272
Quoted 5 lines
drivers/gpu/drm/i915/intel_dvo.c +3
-1if (intel_dvo->dev.dev_ops->mode_fixup) -return intel_dvo->dev.dev_ops->mode_fixup (&intel_dvo->dev, mode, adjusted_mode); +return intel_dvo->dev.dev_ops->mode_fixup (&intel_dvo->dev, + &pipe_config->requested_mode, + adjusted_mode);Since we are completely removing
mode_fixupshouldn't we rip this out?
We are ripping out the encoder->mode_fixup callback. This here is the dvo_slave->mode_fixup callback. dvo is gen2 only, so we won't ever touch this again. Hence why I didn't go through all 6-7 dvo slave drivers and give them the same treatment. I'll add a note to the commit message about this when merging, presuming there's nothing else in the patch that needs to be fixed up.
-Daniel
Quoted 33 lines
Quoted 27 lines
drivers/gpu/drm/i915/intel_dvo.c +1
-2return true; }@@ -370,7 +372,6 @@ static void intel_dvo_destroy(struct drm_connector *connector) }static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = { - .mode_fixup = intel_dvo_mode_fixup, .mode_set = intel_dvo_mode_set, };@@ -468,6 +469,7 @@ void intel_dvo_init(struct drm_device *dev) intel_encoder->enable = intel_enable_dvo; intel_encoder->get_hw_state = intel_dvo_get_hw_state; intel_encoder->get_config = intel_dvo_get_config; + intel_encoder->compute_config = intel_dvo_compute_config; intel_connector->get_hw_state = intel_dvo_connector_get_hw_state;/* Now, try to find a controller */ --1.8.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
PATCH 3/13 drm/i915: rip out legacy encoder->mode_fixup logic
In reply to Daniel VetterEveryone is now using our own ->compute_config callback, which means we can now also make that callback mandatory.
--- drivers/gpu/drm/i915/intel_display.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -16
@@ -4109,7 +4109,7 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc, }/* All interlaced capable intel hw wants timings in frames. Note though -* that intel_lvds_mode_fixup does some funny tricks with the crtc +* that intel_lvds_compute_config does some funny tricks with the crtc * timings, so we need to be careful not to clobber these.*/ if (!pipe_config->timings_set)drm_mode_set_crtcinfo (adjusted_mode,0 );
@@ -7856,7 +7856,6 @@ intel_modeset_pipe_config(struct drm_crtc *crtc, struct drm_display_mode *mode) {struct drm_device *dev = crtc->dev; -struct drm_encoder_helper_funcs *encoder_funcs;struct intel_encoder *encoder;struct intel_crtc_config *pipe_config;int plane_bpp, ret = -EINVAL ;
@@ -7901,20 +7900,8 @@ encoder_retry:if (&encoder->new_crtc->base != crtc)continue ; -if (encoder->compute_config) { -if (!(encoder->compute_config (encoder, pipe_config))) { -DRM_DEBUG_KMS ("Encoder config failure\n" ); - goto fail; - } - -continue ; - } - - encoder_funcs = encoder->base.helper_private; -if (!(encoder_funcs->mode_fixup (&encoder->base, - &pipe_config->requested_mode, - &pipe_config->adjusted_mode))) { -DRM_DEBUG_KMS ("Encoder fixup failed\n" ); +if (!(encoder->compute_config (encoder, pipe_config))) { +DRM_DEBUG_KMS ("Encoder config failure\n" ); goto fail; } }
Signature · 1 line
1.8.1.4
PATCH 4/13 drm/i915/dvo: use native encoder ->mode_set callback
In reply to Daniel Vetter--- drivers/gpu/drm/i915/intel_dvo.c | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/intel_dvo.c +11 -17
@@ -107,8 +107,7 @@ static struct intel_dvo *enc_to_dvo(struct intel_encoder *encoder)static struct intel_dvo *intel_attached_dvo (struct drm_connector *connector) { -return container_of (intel_attached_encoder (connector), - struct intel_dvo, base); +return enc_to_dvo (intel_attached_encoder (connector)); }static bool intel_dvo_connector_get_hw_state (struct intel_connector *connector)
@@ -274,15 +273,14 @@ static bool intel_dvo_compute_config(struct intel_encoder *encoder,return true; } -static void intel_dvo_mode_set (struct drm_encoder *encoder, -struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static void intel_dvo_mode_set (struct intel_encoder *encoder) { -struct drm_device *dev = encoder->dev; +struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); -struct intel_dvo *intel_dvo =enc_to_dvo (to_intel_encoder (encoder)); -int pipe = intel_crtc->pipe; +struct intel_crtc *crtc =to_intel_crtc (encoder->base.crtc); +struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode; +struct intel_dvo *intel_dvo =enc_to_dvo (encoder); +int pipe = crtc->pipe;u32 dvo_val;u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg;
@@ -299,7 +297,9 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,break ; } - intel_dvo->dev.dev_ops->mode_set (&intel_dvo->dev, mode, adjusted_mode); + intel_dvo->dev.dev_ops->mode_set (&intel_dvo->dev, + &crtc->config.requested_mode, + adjusted_mode);/* Save the data order, since I don't know what it should be set to. */ dvo_val = I915_READ(dvo_reg) &
@@ -371,10 +371,6 @@ static void intel_dvo_destroy(struct drm_connector *connector)kfree (connector); } -static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = { - .mode_set = intel_dvo_mode_set, -}; -static const struct drm_connector_funcs intel_dvo_connector_funcs = { .dpms = intel_dvo_dpms, .detect = intel_dvo_detect,
@@ -470,6 +466,7 @@ void intel_dvo_init(struct drm_device *dev) intel_encoder->get_hw_state = intel_dvo_get_hw_state; intel_encoder->get_config = intel_dvo_get_config; intel_encoder->compute_config = intel_dvo_compute_config; + intel_encoder->mode_set = intel_dvo_mode_set; intel_connector->get_hw_state = intel_dvo_connector_get_hw_state;/* Now, try to find a controller */
@@ -536,9 +533,6 @@ void intel_dvo_init(struct drm_device *dev) connector->interlace_allowed = false; connector->doublescan_allowed = false; -drm_encoder_helper_add (&intel_encoder->base, - &intel_dvo_helper_funcs); -intel_connector_attach_encoder (intel_connector, intel_encoder);if (dvo->type ==INTEL_DVO_CHIP_LVDS ) {/* For our LVDS chipsets, we should hopefully be able
Signature · 1 line
1.8.1.4
PATCH 5/13 drm/i915/sdvo: use intel_encoder for upcast helper
In reply to Daniel VetterIt's what all callers (except for the destroy callback which is called from drm core) actually want.
--- drivers/gpu/drm/i915/intel_sdvo.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +11 -12
@@ -202,15 +202,14 @@ struct intel_sdvo_connector {u32 cur_dot_crawl, max_dot_crawl; }; -static struct intel_sdvo *to_intel_sdvo (struct drm_encoder *encoder) +static struct intel_sdvo *to_sdvo (struct intel_encoder *encoder) { - return container_of(encoder, struct intel_sdvo, base.base); + return container_of(encoder, struct intel_sdvo, base); }static struct intel_sdvo *intel_attached_sdvo (struct drm_connector *connector) { -return container_of (intel_attached_encoder (connector), - struct intel_sdvo, base); +return to_sdvo (intel_attached_encoder (connector)); }static struct intel_sdvo_connector *to_intel_sdvo_connector (struct drm_connector *connector)
@@ -1084,7 +1083,7 @@ static void i9xx_adjust_sdvo_tv_clock(struct intel_crtc_config *pipe_config)static bool intel_sdvo_compute_config (struct intel_encoder *encoder,struct intel_crtc_config *pipe_config) { -struct intel_sdvo *intel_sdvo =to_intel_sdvo (&encoder->base); +struct intel_sdvo *intel_sdvo =to_sdvo (encoder);struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode;struct drm_display_mode *mode = &pipe_config->requested_mode;
@@ -1154,7 +1153,7 @@ static void intel_sdvo_mode_set(struct intel_encoder *intel_encoder)struct drm_display_mode *adjusted_mode = &intel_crtc->config.adjusted_mode;struct drm_display_mode *mode = &intel_crtc->config.requested_mode; -struct intel_sdvo *intel_sdvo =to_intel_sdvo (&intel_encoder->base); +struct intel_sdvo *intel_sdvo =to_sdvo (intel_encoder);u32 sdvox;struct intel_sdvo_in_out_map in_out;struct intel_sdvo_dtd input_dtd, output_dtd;
@@ -1292,7 +1291,7 @@ static bool intel_sdvo_get_hw_state(struct intel_encoder *encoder, {struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_sdvo *intel_sdvo =to_intel_sdvo (&encoder->base); +struct intel_sdvo *intel_sdvo =to_sdvo (encoder);u16 active_outputs =0 ;u32 tmp;
@@ -1315,7 +1314,7 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder, {struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_sdvo *intel_sdvo =to_intel_sdvo (&encoder->base); +struct intel_sdvo *intel_sdvo =to_sdvo (encoder);struct intel_sdvo_dtd dtd;int encoder_pixel_multiplier =0 ;u32 flags =0 , sdvox;
@@ -1380,7 +1379,7 @@ static void intel_sdvo_get_config(struct intel_encoder *encoder,static void intel_disable_sdvo (struct intel_encoder *encoder) {struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; -struct intel_sdvo *intel_sdvo =to_intel_sdvo (&encoder->base); +struct intel_sdvo *intel_sdvo =to_sdvo (encoder);u32 temp;intel_sdvo_set_active_outputs (intel_sdvo,0 );
@@ -1422,7 +1421,7 @@ static void intel_enable_sdvo(struct intel_encoder *encoder) {struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_sdvo *intel_sdvo =to_intel_sdvo (&encoder->base); +struct intel_sdvo *intel_sdvo =to_sdvo (encoder);struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc);u32 temp;bool input1, input2;
@@ -1583,7 +1582,7 @@ static uint16_t intel_sdvo_get_hotplug_support(struct intel_sdvo *intel_sdvo)static void intel_sdvo_enable_hotplug (struct intel_encoder *encoder) { -struct intel_sdvo *intel_sdvo =to_intel_sdvo (&encoder->base); +struct intel_sdvo *intel_sdvo =to_sdvo (encoder);intel_sdvo_write_cmd (intel_sdvo,SDVO_CMD_SET_ACTIVE_HOT_PLUG , &intel_sdvo->hotplug_active,2 );
@@ -2187,7 +2186,7 @@ static const struct drm_connector_helper_funcs intel_sdvo_connector_helper_funcsstatic void intel_sdvo_enc_destroy (struct drm_encoder *encoder) { -struct intel_sdvo *intel_sdvo =to_intel_sdvo (encoder); +struct intel_sdvo *intel_sdvo =to_sdvo (to_intel_encoder (encoder));if (intel_sdvo->sdvo_lvds_fixed_mode !=NULL ) drm_mode_destroy(encoder->dev,
Signature · 1 line
1.8.1.4
PATCH 6/13 drm/i915/tv: Use native encoder->mode_set callback
In reply to Daniel VetterAlso switch to intel_encoder for the upcast helper while at it.
--- drivers/gpu/drm/i915/intel_tv.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_tv.c +9 -18
@@ -823,16 +823,14 @@ static const struct tv_mode tv_modes[] = { }, }; -static struct intel_tv *enc_to_intel_tv (struct drm_encoder *encoder) +static struct intel_tv *enc_to_tv (struct intel_encoder *encoder) { - return container_of(encoder, struct intel_tv, base.base); + return container_of(encoder, struct intel_tv, base); }static struct intel_tv *intel_attached_tv (struct drm_connector *connector) { -return container_of (intel_attached_encoder (connector), - struct intel_tv, - base); +return enc_to_tv (intel_attached_encoder (connector)); } static bool
@@ -908,7 +906,7 @@ static bool intel_tv_compute_config(struct intel_encoder *encoder, struct intel_crtc_config *pipe_config) { - struct intel_tv *intel_tv = enc_to_intel_tv(&encoder->base); + struct intel_tv *intel_tv = enc_to_tv(encoder);const struct tv_mode *tv_mode =intel_tv_mode_find (intel_tv);if (!tv_mode)
@@ -921,15 +919,12 @@ intel_tv_compute_config(struct intel_encoder *encoder,return true; } -static void -intel_tv_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static void intel_tv_mode_set (struct intel_encoder *encoder) { -struct drm_device *dev = encoder->dev; +struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct drm_crtc *crtc = encoder->crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_tv *intel_tv =enc_to_intel_tv (encoder); +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +struct intel_tv *intel_tv =enc_to_tv (encoder);const struct tv_mode *tv_mode =intel_tv_mode_find (intel_tv);u32 tv_ctl;u32 hctl1, hctl2, hctl3;
@@ -1483,10 +1478,6 @@ out:return ret; } -static const struct drm_encoder_helper_funcs intel_tv_helper_funcs = { - .mode_set = intel_tv_mode_set, -}; -static const struct drm_connector_funcs intel_tv_connector_funcs = { .dpms = intel_connector_dpms, .detect = intel_tv_detect,
@@ -1619,6 +1610,7 @@ intel_tv_init(struct drm_device *dev) DRM_MODE_ENCODER_TVDAC); intel_encoder->compute_config = intel_tv_compute_config; + intel_encoder->mode_set = intel_tv_mode_set; intel_encoder->enable = intel_enable_tv; intel_encoder->disable = intel_disable_tv; intel_encoder->get_hw_state = intel_tv_get_hw_state;
@@ -1640,7 +1632,6 @@ intel_tv_init(struct drm_device *dev) intel_tv->tv_format = tv_modes[initial_mode].name; -drm_encoder_helper_add (&intel_encoder->base, &intel_tv_helper_funcs);drm_connector_helper_add (connector, &intel_tv_connector_helper_funcs); connector->interlace_allowed = false; connector->doublescan_allowed = false;
Signature · 1 line
1.8.1.4
PATCH 7/13 drm/i915/crt: use native encoder->mode_set callback
In reply to Daniel VetterAlso drop the intel_ prefix from the local intel_crtc variable and reorder the upcast macros a bit for more reuse.
--- drivers/gpu/drm/i915/intel_crt.c | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_crt.c +13 -21
@@ -52,15 +52,14 @@ struct intel_crt {u32 adpa_reg; }; -static struct intel_crt *intel_attached_crt (struct drm_connector *connector) +static struct intel_crt *intel_encoder_to_crt (struct intel_encoder *encoder) { -return container_of (intel_attached_encoder (connector), - struct intel_crt, base); + return container_of(encoder, struct intel_crt, base); } -static struct intel_crt *intel_encoder_to_crt (struct intel_encoder *encoder) +static struct intel_crt *intel_attached_crt (struct drm_connector *connector) { - return container_of(encoder, struct intel_crt, base); +return intel_encoder_to_crt (intel_attached_encoder (connector)); } static bool intel_crt_get_hw_state(struct intel_encoder *encoder,
@@ -238,17 +237,14 @@ static bool intel_crt_compute_config(struct intel_encoder *encoder,return true; } -static void intel_crt_mode_set (struct drm_encoder *encoder, -struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static void intel_crt_mode_set (struct intel_encoder *encoder) { -struct drm_device *dev = encoder->dev; -struct drm_crtc *crtc = encoder->crtc; -struct intel_crt *crt = -intel_encoder_to_crt (to_intel_encoder (encoder)); -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); +struct drm_device *dev = encoder->base.dev; +struct intel_crt *crt =intel_encoder_to_crt (encoder); +struct intel_crtc *crtc =to_intel_crtc (encoder->base.crtc);struct drm_i915_private *dev_priv = dev->dev_private; +struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;u32 adpa;if (HAS_PCH_SPLIT (dev))
@@ -265,14 +261,14 @@ static void intel_crt_mode_set(struct drm_encoder *encoder,if (HAS_PCH_LPT (dev)) ;/* Those bits don't exist here */ else if (HAS_PCH_CPT (dev)) - adpa |=PORT_TRANS_SEL_CPT (intel_crtc->pipe); -else if (intel_crtc->pipe ==0 ) + adpa |=PORT_TRANS_SEL_CPT (crtc->pipe); +else if (crtc->pipe ==0 ) adpa |=ADPA_PIPE_A_SELECT ;else adpa |=ADPA_PIPE_B_SELECT ;if (!HAS_PCH_SPLIT (dev)) -I915_WRITE (BCLRPAT (intel_crtc->pipe),0 ); +I915_WRITE (BCLRPAT (crtc->pipe),0 );I915_WRITE (crt->adpa_reg, adpa); }
@@ -707,10 +703,6 @@ static void intel_crt_reset(struct drm_connector *connector)* Routines for controlling stuff on the analog port */ -static const struct drm_encoder_helper_funcs crt_encoder_funcs = { - .mode_set = intel_crt_mode_set, -}; -static const struct drm_connector_funcs intel_crt_connector_funcs = { .reset = intel_crt_reset, .dpms = intel_crt_dpms,
@@ -800,6 +792,7 @@ void intel_crt_init(struct drm_device *dev) crt->adpa_reg =ADPA ; crt->base.compute_config = intel_crt_compute_config; + crt->base.mode_set = intel_crt_mode_set; crt->base.disable = intel_disable_crt; crt->base.enable = intel_enable_crt; crt->base.get_config = intel_crt_get_config;
@@ -811,7 +804,6 @@ void intel_crt_init(struct drm_device *dev) crt->base.get_hw_state = intel_crt_get_hw_state; intel_connector->get_hw_state = intel_connector_get_hw_state; -drm_encoder_helper_add (&crt->base.base, &crt_encoder_funcs);drm_connector_helper_add (connector, &intel_crt_connector_helper_funcs);drm_sysfs_connector_add (connector);
Signature · 1 line
1.8.1.4
PATCH 8/13 drm/i915/hdmi: use native encoder mode_set callback
In reply to Daniel VetterAgain drop the intel_ prefix from the intel_crtc local variable to save a bit of space. But here I didn't switch the upcast macros to intel_encoder since all our infoframe interfaces still use drm_encoder. That needs to be changed first.
--- drivers/gpu/drm/i915/intel_hdmi.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +12 -17
@@ -591,14 +591,13 @@ static void hsw_set_infoframes(struct drm_encoder *encoder,intel_hdmi_set_spd_infoframe (encoder); } -static void intel_hdmi_mode_set (struct drm_encoder *encoder, -struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static void intel_hdmi_mode_set (struct intel_encoder *encoder) { -struct drm_device *dev = encoder->dev; +struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crtc *intel_crtc =to_intel_crtc (encoder->crtc); -struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (encoder); +struct intel_crtc *crtc =to_intel_crtc (encoder->base.crtc); +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base); +struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;u32 hdmi_val; hdmi_val =SDVO_ENCODING_HDMI ;
@@ -609,7 +608,7 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,if (adjusted_mode->flags &DRM_MODE_FLAG_PHSYNC ) hdmi_val |=SDVO_HSYNC_ACTIVE_HIGH ; -if (intel_crtc->config.pipe_bpp >24 ) +if (crtc->config.pipe_bpp >24 ) hdmi_val |= HDMI_COLOR_FORMAT_12bpc;else hdmi_val |= SDVO_COLOR_FORMAT_8bpc;
@@ -620,21 +619,21 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,if (intel_hdmi->has_audio) {DRM_DEBUG_DRIVER ("Enabling HDMI audio on pipe %c\n" , -pipe_name (intel_crtc->pipe)); +pipe_name (crtc->pipe)); hdmi_val |=SDVO_AUDIO_ENABLE ; hdmi_val |=HDMI_MODE_SELECT_HDMI ; -intel_write_eld (encoder, adjusted_mode); +intel_write_eld (&encoder->base, adjusted_mode); }if (HAS_PCH_CPT (dev)) - hdmi_val |=SDVO_PIPE_SEL_CPT (intel_crtc->pipe); + hdmi_val |=SDVO_PIPE_SEL_CPT (crtc->pipe);else - hdmi_val |=SDVO_PIPE_SEL (intel_crtc->pipe); + hdmi_val |=SDVO_PIPE_SEL (crtc->pipe);I915_WRITE (intel_hdmi->hdmi_reg, hdmi_val);POSTING_READ (intel_hdmi->hdmi_reg); - intel_hdmi->set_infoframes (encoder, adjusted_mode); + intel_hdmi->set_infoframes (&encoder->base, adjusted_mode); } static bool intel_hdmi_get_hw_state(struct intel_encoder *encoder,
@@ -1100,10 +1099,6 @@ static void intel_hdmi_destroy(struct drm_connector *connector)kfree (connector); } -static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = { - .mode_set = intel_hdmi_mode_set, -}; -static const struct drm_connector_funcs intel_hdmi_connector_funcs = { .dpms = intel_connector_dpms, .detect = intel_hdmi_detect,
@@ -1226,9 +1221,9 @@ void intel_hdmi_init(struct drm_device *dev, int hdmi_reg, enum port port)drm_encoder_init (dev, &intel_encoder->base, &intel_hdmi_enc_funcs,DRM_MODE_ENCODER_TMDS ); -drm_encoder_helper_add (&intel_encoder->base, &intel_hdmi_helper_funcs); intel_encoder->compute_config = intel_hdmi_compute_config; + intel_encoder->mode_set = intel_hdmi_mode_set; intel_encoder->enable = intel_enable_hdmi; intel_encoder->disable = intel_disable_hdmi; intel_encoder->get_hw_state = intel_hdmi_get_hw_state;
Signature · 1 line
1.8.1.4
PATCH 9/13 drm/i915/dp: use native encoder ->mode_set callback
In reply to Daniel VetterUsual drill applies. Again I've not switched the upcast helpers to use intel_encoder instead of drm_encoder since that's much more invasive and will change also the hdmi and ddi encoders.
--- drivers/gpu/drm/i915/intel_dp.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_dp.c +7 -12
@@ -823,15 +823,14 @@ static void ironlake_set_pll_cpu_edp(struct intel_dp *intel_dp)udelay (500 ); } -static void -intel_dp_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static void intel_dp_mode_set (struct intel_encoder *encoder) { -struct drm_device *dev = encoder->dev; +struct drm_device *dev = encoder->base.dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_dp *intel_dp =enc_to_intel_dp (encoder); +struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);enum port port =dp_to_dig_port (intel_dp)->port; -struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +struct intel_crtc *crtc =to_intel_crtc (encoder->base.crtc); +struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;/* * There are four kinds of DP registers:
@@ -863,7 +862,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,DRM_DEBUG_DRIVER ("Enabling DP audio on pipe %c\n" ,pipe_name (crtc->pipe)); intel_dp->DP |=DP_AUDIO_OUTPUT_ENABLE ; -intel_write_eld (encoder, adjusted_mode); +intel_write_eld (&encoder->base, adjusted_mode); }intel_dp_init_link_config (intel_dp);
@@ -3013,10 +3012,6 @@ void intel_dp_encoder_destroy(struct drm_encoder *encoder)kfree (intel_dig_port); } -static const struct drm_encoder_helper_funcs intel_dp_helper_funcs = { - .mode_set = intel_dp_mode_set, -}; -static const struct drm_connector_funcs intel_dp_connector_funcs = { .dpms = intel_connector_dpms, .detect = intel_dp_detect,
@@ -3496,9 +3491,9 @@ intel_dp_init(struct drm_device *dev, int output_reg, enum port port)drm_encoder_init (dev, &intel_encoder->base, &intel_dp_enc_funcs,DRM_MODE_ENCODER_TMDS ); -drm_encoder_helper_add (&intel_encoder->base, &intel_dp_helper_funcs); intel_encoder->compute_config = intel_dp_compute_config; + intel_encoder->mode_set = intel_dp_mode_set; intel_encoder->enable = intel_enable_dp; intel_encoder->pre_enable = intel_pre_enable_dp; intel_encoder->disable = intel_disable_dp;
Signature · 1 line
1.8.1.4
PATCH 10/13 drm/i915/lvds: use the native encoder ->mode_set callback
In reply to Daniel VetterDoes nothing, so trivial conversion. But update the outdated comment while at it.
--- drivers/gpu/drm/i915/intel_lvds.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/intel_lvds.c +5 -11
@@ -319,14 +319,12 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder,return true; } -static void intel_lvds_mode_set (struct drm_encoder *encoder, -struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static void intel_lvds_mode_set (struct intel_encoder *encoder) {/* -* The LVDS pin pair will already have been turned on in the -* intel_crtc_mode_set since it has a large impact on the DPLL -* settings. +* We don't do anything here, the LVDS port is fully set up in the pre +* enable hook - the ordering constraints for enabling the lvds port vs. +* enabling the display pll are too strict. */ }
@@ -504,10 +502,6 @@ static int intel_lvds_set_property(struct drm_connector *connector,return 0 ; } -static const struct drm_encoder_helper_funcs intel_lvds_helper_funcs = { - .mode_set = intel_lvds_mode_set, -}; -static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs = { .get_modes = intel_lvds_get_modes, .mode_valid = intel_lvds_mode_valid,
@@ -952,6 +946,7 @@ void intel_lvds_init(struct drm_device *dev) intel_encoder->enable = intel_enable_lvds; intel_encoder->pre_enable = intel_pre_enable_lvds; intel_encoder->compute_config = intel_lvds_compute_config; + intel_encoder->mode_set = intel_lvds_mode_set; intel_encoder->disable = intel_disable_lvds; intel_encoder->get_hw_state = intel_lvds_get_hw_state; intel_encoder->get_config = intel_lvds_get_config;
@@ -968,7 +963,6 @@ void intel_lvds_init(struct drm_device *dev)else intel_encoder->crtc_mask = (1 <<1 ); -drm_encoder_helper_add (encoder, &intel_lvds_helper_funcs);drm_connector_helper_add (connector, &intel_lvds_connector_helper_funcs); connector->display_info.subpixel_order = SubPixelHorizontalRGB; connector->interlace_allowed = false;
Signature · 1 line
1.8.1.4
PATCH 11/13 drm/i915/ddi: use the native encoder ->mode_set callback
In reply to Daniel VetterSame conversion as for hdmi/dp.
--- drivers/gpu/drm/i915/intel_ddi.c | 39 ++++++++++++++++----------------------- 1 file changed, 16 insertions(+), 23 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +16 -23
@@ -281,25 +281,22 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)DRM_ERROR ("FDI link training failed!\n" ); } -static void intel_ddi_mode_set (struct drm_encoder *encoder, -struct drm_display_mode *mode, -struct drm_display_mode *adjusted_mode) +static void intel_ddi_mode_set (struct intel_encoder *encoder) { -struct drm_crtc *crtc = encoder->crtc; -struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct intel_encoder *intel_encoder =to_intel_encoder (encoder); -int port =intel_ddi_get_encoder_port (intel_encoder); -int pipe = intel_crtc->pipe; -int type = intel_encoder->type; +struct intel_crtc *crtc =to_intel_crtc (encoder->base.crtc); +int port =intel_ddi_get_encoder_port (encoder); +int pipe = crtc->pipe; +int type = encoder->type; +struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;DRM_DEBUG_KMS ("Preparing DDI mode on port %c, pipe %c\n" ,port_name (port),pipe_name (pipe)); - intel_crtc->eld_vld = false; + crtc->eld_vld = false;if (type ==INTEL_OUTPUT_DISPLAYPORT || type ==INTEL_OUTPUT_EDP ) { -struct intel_dp *intel_dp =enc_to_intel_dp (encoder); +struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base);struct intel_digital_port *intel_dig_port = -enc_to_dig_port (encoder); +enc_to_dig_port (&encoder->base); intel_dp->DP = intel_dig_port->saved_port_bits |DDI_BUF_CTL_ENABLE |DDI_BUF_EMP_400MV_0DB_HSW ;
@@ -307,17 +304,17 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,if (intel_dp->has_audio) {DRM_DEBUG_DRIVER ("DP audio on pipe %c on DDI\n" , -pipe_name (intel_crtc->pipe)); +pipe_name (crtc->pipe));/* write eld */ DRM_DEBUG_DRIVER ("DP audio: write eld information\n" ); -intel_write_eld (encoder, adjusted_mode); +intel_write_eld (&encoder->base, adjusted_mode); }intel_dp_init_link_config (intel_dp); }else if (type ==INTEL_OUTPUT_HDMI ) { -struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (encoder); +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base);if (intel_hdmi->has_audio) {/* Proper support for digital audio needs a new logic
@@ -325,14 +322,14 @@ static void intel_ddi_mode_set(struct drm_encoder *encoder,* patch bombing. */ DRM_DEBUG_DRIVER ("HDMI audio on pipe %c on DDI\n" , -pipe_name (intel_crtc->pipe)); +pipe_name (crtc->pipe));/* write eld */ DRM_DEBUG_DRIVER ("HDMI audio: write eld information\n" ); -intel_write_eld (encoder, adjusted_mode); +intel_write_eld (&encoder->base, adjusted_mode); } - intel_hdmi->set_infoframes (encoder, adjusted_mode); + intel_hdmi->set_infoframes (&encoder->base, adjusted_mode); } }
@@ -1311,10 +1308,6 @@ static const struct drm_encoder_funcs intel_ddi_funcs = { .destroy = intel_ddi_destroy, }; -static const struct drm_encoder_helper_funcs intel_ddi_helper_funcs = { - .mode_set = intel_ddi_mode_set, -}; -void intel_ddi_init (struct drm_device *dev,enum port port) {struct drm_i915_private *dev_priv = dev->dev_private;
@@ -1339,9 +1332,9 @@ void intel_ddi_init(struct drm_device *dev, enum port port)drm_encoder_init (dev, encoder, &intel_ddi_funcs,DRM_MODE_ENCODER_TMDS ); -drm_encoder_helper_add (encoder, &intel_ddi_helper_funcs); intel_encoder->compute_config = intel_ddi_compute_config; + intel_encoder->mode_set = intel_ddi_mode_set; intel_encoder->enable = intel_enable_ddi; intel_encoder->pre_enable = intel_ddi_pre_enable; intel_encoder->disable = intel_disable_ddi;
Signature · 1 line
1.8.1.4
PATCH 12/13 drm/i915: rip out legacy encoder->mode_set callback
In reply to Daniel VetterThe encoder->mode_set callback from the crtc helpers is now completely unused in our driver. Good riddance!
--- drivers/gpu/drm/i915/intel_display.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -9
@@ -6015,11 +6015,8 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, {struct drm_device *dev = crtc->dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct drm_encoder_helper_funcs *encoder_funcs;struct intel_encoder *encoder;struct intel_crtc *intel_crtc =to_intel_crtc (crtc); -struct drm_display_mode *adjusted_mode = - &intel_crtc->config.adjusted_mode;struct drm_display_mode *mode = &intel_crtc->config.requested_mode;int pipe = intel_crtc->pipe;int ret;
@@ -6038,12 +6035,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc, encoder->base.base.id,drm_get_encoder_name (&encoder->base), mode->base.id, mode->name); -if (encoder->mode_set) { - encoder->mode_set (encoder); - }else { - encoder_funcs = encoder->base.helper_private; - encoder_funcs->mode_set (&encoder->base, mode, adjusted_mode); - } + encoder->mode_set (encoder); }return 0 ;
Signature · 1 line
1.8.1.4
PATCH 13/13 drm/i915: clean up crtc timings computation
In reply to Daniel VetterIn the old days of the crtc helpers we've only had the encoder and crtc ->mode_fixup callbacks. So when the lvds connector wanted to adjust the crtc timings it had to set a driver-private mode flag to tell the crtc mode fixup code to not overwrite them with the generic ones.
When converting things to the new infrastructure I've kept the entire logic and only moved the flag to pipe_config->timings_set. But this logic is pretty tricky and already caused regressions:
commit 21d8a4756af5fdf4a42e79a77cf3b6f52678d443
Author: Daniel Vetter <[email protected]> Date: Fri Jul 12 08:07:30 2013 +0200
drm/i915: fix pfit regression for non-autoscaled resolutions
So take advantage of the flexibility our own modeset infrastructure affords us and prefill default crtc timings. This allows us to rip out ->timings_set. Note that we overwrite things again when retrying the pipe config computation due to bandwidth constraints to avoid bogus crtc timings if the encoder only does relative adjustments (which is how the pfit code works). Only a theoretical concern though since platforms where we retry (pch-split platforms) do not need adjustements (since only the old gmch pfit needs that). But let's better be safe than sorry.
--- drivers/gpu/drm/i915/intel_display.c | 9 +++------ drivers/gpu/drm/i915/intel_drv.h | 4 ---- drivers/gpu/drm/i915/intel_panel.c | 3 --- 3 files changed, 3 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -6
@@ -4108,12 +4108,6 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,return -EINVAL ; } -/* All interlaced capable intel hw wants timings in frames. Note though -* that intel_lvds_compute_config does some funny tricks with the crtc -* timings, so we need to be careful not to clobber these.*/ -if (!pipe_config->timings_set) -drm_mode_set_crtcinfo (adjusted_mode,0 ); -/* Cantiga+ cannot handle modes with a hsync front porch of 0. * WaPruneModeWithIncorrectHsyncOffset:ctg,elk,ilk,snb,ivb,vlv,hsw. */
@@ -7882,6 +7876,9 @@ encoder_retry: pipe_config->port_clock =0 ; pipe_config->pixel_multiplier =1 ; +/* Fill in default crtc timings, allow encoders to overwrite them. */ +drm_mode_set_crtcinfo (&pipe_config->adjusted_mode,0 ); +/* Pass our mode to the connectors and the CRTC to give them a chance to * adjust it according to limitations or connector properties, and also * a chance to reject the mode entirely.
drivers/gpu/drm/i915/intel_drv.h +0 -4
@@ -208,10 +208,6 @@ struct intel_crtc_config {struct drm_display_mode requested_mode;struct drm_display_mode adjusted_mode; -/* This flag must be set by the encoder's compute_config callback if it -* changes the crtc timings in the mode to prevent the crtc fixup from -* overwriting them. Currently only lvds needs that. */ -bool timings_set;/* Whether to set up the PCH/FDI. Note that we never allow sharing * between pch encoders and cpu encoders. */ bool has_pch_encoder;
drivers/gpu/drm/i915/intel_panel.c +0 -3
@@ -194,9 +194,6 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, adjusted_mode->vdisplay == mode->vdisplay) goto out; -drm_mode_set_crtcinfo (adjusted_mode,0 ); - pipe_config->timings_set = true; -switch (fitting_mode) {case DRM_MODE_SCALE_CENTER :/*
Signature · 1 line
1.8.1.4
Re: [PATCH 13/13] drm/i915: clean up crtc timings computation
Quoted 82 lines · Daniel Vetter
In the old days of the crtc helpers we've only had the encoder and crtc ->mode_fixup callbacks. So when the lvds connector wanted to adjust the crtc timings it had to set a driver-private mode flag to tell the crtc mode fixup code to not overwrite them with the generic ones.
When converting things to the new infrastructure I've kept the entire logic and only moved the flag to
pipe_config->timings_set. But this logic is pretty tricky and already caused regressions:commit
21d8a4756af5fdf4a42e79a77cf3b6f52678d443Author: Daniel Vetter <[email protected]> Date: Fri Jul 12 08:07:30 2013 +0200drm/i915: fix pfit regression for non-autoscaled resolutions
So take advantage of the flexibility our own modeset infrastructure affords us and prefill default crtc timings. This allows us to rip out ->timings_set. Note that we overwrite things again when retrying the pipe config computation due to bandwidth constraints to avoid bogus crtc timings if the encoder only does relative adjustments (which is how the pfit code works). Only a theoretical concern though since platforms where we retry (pch-split platforms) do not need adjustements (since only the old gmch pfit needs that). But let's better be safe than sorry.
Cc Jesse Barnes <[email protected]>Cc Mika Kuoppala <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 9 +++------ drivers/gpu/drm/i915/intel_drv.h | 4 ---- drivers/gpu/drm/i915/intel_panel.c | 3 --- 3 files changed, 3 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/intel_display.c +3
-6@@ -4108,12 +4108,6 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,return -EINVAL ; } -/* All interlaced capable intel hw wants timings in frames. Note though -* that intel_lvds_compute_config does some funny tricks with the crtc -* timings, so we need to be careful not to clobber these.*/ -if (!pipe_config->timings_set) -drm_mode_set_crtcinfo (adjusted_mode,0 ); -/* Cantiga+ cannot handle modes with a hsync front porch of 0. * WaPruneModeWithIncorrectHsyncOffset:ctg,elk,ilk,snb,ivb,vlv,hsw. */ @@ -7882,6 +7876,9 @@ encoder_retry: pipe_config->port_clock =0 ; pipe_config->pixel_multiplier =1 ; +/* Fill in default crtc timings, allow encoders to overwrite them. */ +drm_mode_set_crtcinfo (&pipe_config->adjusted_mode,0 ); +/* Pass our mode to the connectors and the CRTC to give them a chance to * adjust it according to limitations or connector properties, and also * a chance to reject the mode entirely. drivers/gpu/drm/i915/intel_drv.h +0
-4@@ -208,10 +208,6 @@ struct intel_crtc_config {struct drm_display_mode requested_mode;struct drm_display_mode adjusted_mode; -/* This flag must be set by the encoder's compute_config callback if it -* changes the crtc timings in the mode to prevent the crtc fixup from -* overwriting them. Currently only lvds needs that. */ -bool timings_set;/* Whether to set up the PCH/FDI. Note that we never allow sharing * between pch encoders and cpu encoders. */ bool has_pch_encoder;drivers/gpu/drm/i915/intel_panel.c +0
-0
drivers/gpu/drm/i915/intel_panel.c void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, · line 197
Quoted 4 lines
drivers/gpu/drm/i915/intel_panel.c +0
-1@@ -194,9 +194,6 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, adjusted_mode->vdisplay == mode->vdisplay) goto out; -drm_mode_set_crtcinfo (adjusted_mode,0 );
I didn't get why this set here isn't needed anymore..
Quoted 12 lines
drivers/gpu/drm/i915/intel_panel.c +0
-3- pipe_config->timings_set = true; -switch (fitting_mode) {case DRM_MODE_SCALE_CENTER :/* -- 1.8.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Re: [PATCH 13/13] drm/i915: clean up crtc timings computation
Quoted 86 lines · Rodrigo Vivi
Quoted 85 lines · Daniel Vetter
In the old days of the crtc helpers we've only had the encoder and crtc ->mode_fixup callbacks. So when the lvds connector wanted to adjust the crtc timings it had to set a driver-private mode flag to tell the crtc mode fixup code to not overwrite them with the generic ones.
When converting things to the new infrastructure I've kept the entire logic and only moved the flag to
pipe_config->timings_set. But this logic is pretty tricky and already caused regressions:commit
21d8a4756af5fdf4a42e79a77cf3b6f52678d443Author: Daniel Vetter <[email protected]> Date: Fri Jul 12 08:07:30 2013 +0200drm/i915: fix pfit regression for non-autoscaled resolutions
So take advantage of the flexibility our own modeset infrastructure affords us and prefill default crtc timings. This allows us to rip out ->timings_set. Note that we overwrite things again when retrying the pipe config computation due to bandwidth constraints to avoid bogus crtc timings if the encoder only does relative adjustments (which is how the pfit code works). Only a theoretical concern though since platforms where we retry (pch-split platforms) do not need adjustements (since only the old gmch pfit needs that). But let's better be safe than sorry.
Cc Jesse Barnes <[email protected]>Cc Mika Kuoppala <[email protected]>Signed-off-by Daniel Vetter <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 9 +++------ drivers/gpu/drm/i915/intel_drv.h | 4 ---- drivers/gpu/drm/i915/intel_panel.c | 3 --- 3 files changed, 3 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/intel_display.c +3
-6@@ -4108,12 +4108,6 @@ static int intel_crtc_compute_config(struct intel_crtc *crtc,return -EINVAL ; } -/* All interlaced capable intel hw wants timings in frames. Note though -* that intel_lvds_compute_config does some funny tricks with the crtc -* timings, so we need to be careful not to clobber these.*/ -if (!pipe_config->timings_set) -drm_mode_set_crtcinfo (adjusted_mode,0 ); -/* Cantiga+ cannot handle modes with a hsync front porch of 0. * WaPruneModeWithIncorrectHsyncOffset:ctg,elk,ilk,snb,ivb,vlv,hsw. */ @@ -7882,6 +7876,9 @@ encoder_retry: pipe_config->port_clock =0 ; pipe_config->pixel_multiplier =1 ; +/* Fill in default crtc timings, allow encoders to overwrite them. */ +drm_mode_set_crtcinfo (&pipe_config->adjusted_mode,0 ); +/* Pass our mode to the connectors and the CRTC to give them a chance to * adjust it according to limitations or connector properties, and also * a chance to reject the mode entirely. drivers/gpu/drm/i915/intel_drv.h +0
-4@@ -208,10 +208,6 @@ struct intel_crtc_config {struct drm_display_mode requested_mode;struct drm_display_mode adjusted_mode; -/* This flag must be set by the encoder's compute_config callback if it -* changes the crtc timings in the mode to prevent the crtc fixup from -* overwriting them. Currently only lvds needs that. */ -bool timings_set;/* Whether to set up the PCH/FDI. Note that we never allow sharing * between pch encoders and cpu encoders. */ bool has_pch_encoder;drivers/gpu/drm/i915/intel_panel.c +0
-0@@ -194,9 +194,6 @@ void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, adjusted_mode->vdisplay == mode->vdisplay) goto out;
Quoted 3 lines
drivers/gpu/drm/i915/intel_panel.c void intel_gmch_panel_fitting(struct intel_crtc *intel_crtc, · line 197
Quoted 1 line
drivers/gpu/drm/i915/intel_panel.c +0
-1-drm_mode_set_crtcinfo (adjusted_mode,0 );I didn't get why this set here isn't needed anymore..
The drm_mode_set_crtcinfo in intel_crtc_compute_config happens before we call down into encoder->compute_config functions. Since the gmch pfit code here is only called from those callbacks (for lvds + edp on vlv) we can drop this one here and simplify the logic a bit.
-Daniel
Quoted 19 lines
Quoted 13 lines
drivers/gpu/drm/i915/intel_panel.c +0
-3- pipe_config->timings_set = true; -switch (fitting_mode) {case DRM_MODE_SCALE_CENTER :/* -- 1.8.1.4
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch
Although I had those 2 doubts and aren't 100% sure this wont cause any regression I'm confortable in give my rv-b to full series.
So,
Quoted 49 lines · Daniel Vetter
Hi all,
I've figured it's time that we rip out our legacy modeset encoder callbacks from the crtc helpers and only use the new ones. This patch series converts over the last few stragglers of
encoder_helper_funcs->mode_setand ->mode_fixup.As the icing on the cake I've thrown in a conversion of the old
timings_setlogic to something more natural in our new world where we precompute the entire pipe config and can freely control the code flow in that stage.Comments, flames and testing highly welcome.
Cheers, Daniel
Daniel Vetter (13):
drm/i915/dvo: useintel_encoderto the upcast macro drm/i915/dvo: switch ->mode_fixup to ->compute_config drm/i915: rip out legacyencoder->mode_fixuplogic drm/i915/dvo: use native encoder ->mode_set callback drm/i915/sdvo: useintel_encoderfor upcast helper drm/i915/tv: Use nativeencoder->mode_setcallback drm/i915/crt: use nativeencoder->mode_setcallback drm/i915/hdmi: use native encodermode_setcallback drm/i915/dp: use native encoder ->mode_set callback drm/i915/lvds: use the native encoder ->mode_set callback drm/i915/ddi: use the native encoder ->mode_set callback drm/i915: rip out legacyencoder->mode_setcallback drm/i915: clean up crtc timings computationdrivers/gpu/drm/i915/intel_crt.c | 34 +++++++++------------- drivers/gpu/drm/i915/intel_ddi.c | 39 +++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 36 ++++------------------- drivers/gpu/drm/i915/intel_dp.c | 19 +++++------- drivers/gpu/drm/i915/intel_drv.h | 4 --- drivers/gpu/drm/i915/intel_dvo.c | 56 +++++++++++++++++------------------- drivers/gpu/drm/i915/intel_hdmi.c | 29 ++++++++----------- drivers/gpu/drm/i915/intel_lvds.c | 16 ++++------- drivers/gpu/drm/i915/intel_panel.c | 3 -- drivers/gpu/drm/i915/intel_sdvo.c | 23 +++++++-------- drivers/gpu/drm/i915/intel_tv.c | 27 ++++++----------- 11 files changed, 105 insertions(+), 181 deletions(-)--
1.8.1.4_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Quoted 2 lines · Rodrigo Vivi
Although I had those 2 doubts and aren't 100% sure this wont cause any regression I'm confortable in give my rv-b to full series.
I've added my answers to both questions to the commit messages.
Quoted 4 lines
So,
Reviewed-by Rodrigo Vivi <[email protected]>
Entire series merged to dinq, thanks for the review. -Daniel
Quoted 59 lines · Daniel Vetter
Quoted 49 lines
Hi all,
I've figured it's time that we rip out our legacy modeset encoder callbacks from the crtc helpers and only use the new ones. This patch series converts over the last few stragglers of
encoder_helper_funcs->mode_setand ->mode_fixup.As the icing on the cake I've thrown in a conversion of the old
timings_setlogic to something more natural in our new world where we precompute the entire pipe config and can freely control the code flow in that stage.Comments, flames and testing highly welcome.
Cheers, Daniel
Daniel Vetter (13):
drm/i915/dvo: useintel_encoderto the upcast macro drm/i915/dvo: switch ->mode_fixup to ->compute_config drm/i915: rip out legacyencoder->mode_fixuplogic drm/i915/dvo: use native encoder ->mode_set callback drm/i915/sdvo: useintel_encoderfor upcast helper drm/i915/tv: Use nativeencoder->mode_setcallback drm/i915/crt: use nativeencoder->mode_setcallback drm/i915/hdmi: use native encodermode_setcallback drm/i915/dp: use native encoder ->mode_set callback drm/i915/lvds: use the native encoder ->mode_set callback drm/i915/ddi: use the native encoder ->mode_set callback drm/i915: rip out legacyencoder->mode_setcallback drm/i915: clean up crtc timings computationdrivers/gpu/drm/i915/intel_crt.c | 34 +++++++++------------- drivers/gpu/drm/i915/intel_ddi.c | 39 +++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 36 ++++------------------- drivers/gpu/drm/i915/intel_dp.c | 19 +++++------- drivers/gpu/drm/i915/intel_drv.h | 4 --- drivers/gpu/drm/i915/intel_dvo.c | 56 +++++++++++++++++------------------- drivers/gpu/drm/i915/intel_hdmi.c | 29 ++++++++----------- drivers/gpu/drm/i915/intel_lvds.c | 16 ++++------- drivers/gpu/drm/i915/intel_panel.c | 3 -- drivers/gpu/drm/i915/intel_sdvo.c | 23 +++++++-------- drivers/gpu/drm/i915/intel_tv.c | 27 ++++++----------- 11 files changed, 105 insertions(+), 181 deletions(-)--
1.8.1.4_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfxSignature · 2 lines
Rodrigo Vivi Blog: http://blog.vivi.eng.br
Signature · 3 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch