drm/i915: Remove crtc->config usage from intel_modeset_readout_hw_state()
Subsystems (2)
PATCH 1/2 drm/i915: Remove crtc->config usage from intel_modeset_readout_hw_state()
From: Ville Syrjälä <[email protected]>
crtc->config is on its way out. Let's reduce our dependence on it a little bit by removing it from intel_modeset_readout_hw_state().
Also replace crtc->acttive checks with crtc_state->base.active checks.
--- drivers/gpu/drm/i915/intel_display.c | 38 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/intel_display.c +24 -14
@@ -17032,7 +17032,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) dev_priv->active_crtcs =0 ;for_each_intel_crtc (dev, crtc) { -struct intel_crtc_state *crtc_state = crtc->config; +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state);__drm_atomic_helper_crtc_destroy_state (&crtc_state->base);memset (crtc_state,0 ,sizeof (*crtc_state));
@@ -17051,7 +17052,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)DRM_DEBUG_KMS ("[CRTC:%d:%s] hw state readout: %s\n" , crtc->base.base.id, crtc->base.name, -enableddisabled (crtc->active)); +enableddisabled (crtc_state->base.active)); }for (i =0 ; i < dev_priv->num_shared_dpll; i++) {
@@ -17061,7 +17062,11 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) &pll->config.hw_state); pll->config.crtc_mask =0 ;for_each_intel_crtc (dev, crtc) { -if (crtc->active && crtc->config->shared_dpll == pll) +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state); + +if (crtc_state->base.active && + crtc_state->shared_dpll == pll) pll->config.crtc_mask |=1 << crtc->pipe; } pll->active_mask = pll->config.crtc_mask;
@@ -17074,11 +17079,14 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) pipe =0 ;if (encoder->get_hw_state (encoder, &pipe)) { +struct intel_crtc_state *crtc_state; + crtc =intel_get_crtc_for_pipe (dev_priv, pipe); + crtc_state =to_intel_crtc_state (crtc->base.state); encoder->base.crtc = &crtc->base; - crtc->config->output_types |=1 << encoder->type; - encoder->get_config (encoder, crtc->config); + crtc_state->output_types |=1 << encoder->type; + encoder->get_config (encoder, crtc_state); }else { encoder->base.crtc =NULL ; }
@@ -17119,14 +17127,16 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) }for_each_intel_crtc (dev, crtc) { +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state);int pixclk =0 ; - crtc->base.hwmode = crtc->config->base.adjusted_mode; + crtc->base.hwmode = crtc_state->base.adjusted_mode;memset (&crtc->base.mode,0 ,sizeof (crtc->base.mode)); -if (crtc->base.state->active) { -intel_mode_from_pipe_config (&crtc->base.mode, crtc->config); -intel_mode_from_pipe_config (&crtc->base.state->adjusted_mode, crtc->config); +if (crtc_state->base.active) { +intel_mode_from_pipe_config (&crtc->base.mode, crtc_state); +intel_mode_from_pipe_config (&crtc_state->base.adjusted_mode, crtc_state);WARN_ON (drm_atomic_set_mode_for_crtc (crtc->base.state, &crtc->base.mode));/*
@@ -17146,17 +17156,17 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)* mode change, which means it's safe to do a full * recalculation. */ - crtc->base.state->mode.private_flags =I915_MODE_FLAG_INHERITED ; + crtc_state->base.mode.private_flags =I915_MODE_FLAG_INHERITED ;if (INTEL_GEN (dev_priv) >=9 ||IS_BROADWELL (dev_priv)) - pixclk =ilk_pipe_pixel_rate (crtc->config); + pixclk =ilk_pipe_pixel_rate (crtc_state);else if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) - pixclk = crtc->config->base.adjusted_mode.crtc_clock; + pixclk = crtc_state->base.adjusted_mode.crtc_clock;else WARN_ON (dev_priv->display.modeset_calc_cdclk);/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ -if (IS_BROADWELL (dev_priv) && crtc->config->ips_enabled) +if (IS_BROADWELL (dev_priv) && crtc_state->ips_enabled) pixclk =DIV_ROUND_UP (pixclk *100 ,95 );drm_calc_timestamping_constants (&crtc->base, &crtc->base.hwmode);
@@ -17165,7 +17175,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) dev_priv->min_pixclk[crtc->pipe] = pixclk; -intel_pipe_config_sanity_check (dev_priv, crtc->config); +intel_pipe_config_sanity_check (dev_priv, crtc_state); } }
Signature · 6 lines
2.10.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/2 drm/i915: Remove the double handling of 'flags from intel_mode_from_pipe_config()
From: Ville Syrjälä <[email protected]>
We're trying to copy the flags from the adjusted mode to the passed in mode twice. Once is enough.
--- drivers/gpu/drm/i915/intel_display.c | 1 - 1 file changed, 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +0 -1
@@ -8404,7 +8404,6 @@ void intel_mode_from_pipe_config(struct drm_display_mode *mode, mode->type =DRM_MODE_TYPE_DRIVER ; mode->clock = pipe_config->base.adjusted_mode.crtc_clock; - mode->flags |= pipe_config->base.adjusted_mode.flags; mode->hsync =drm_mode_hsync (mode); mode->vrefresh =drm_mode_vrefresh (mode);
Signature · 6 lines
2.10.2 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: Remove the double handling of 'flags from intel_mode_from_pipe_config()
Quoted 6 lines · On Thu, Dec 22, 2016 at 04:04:42PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
We're trying to copy the flags from the adjusted mode to the passed in mode twice. Once is enough.
Signed-off-by Ville Syrjälä <[email protected]>
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ 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: Remove crtc->config usage from intel_modeset_readout_hw_state()
In reply to [email protected]== Series Details ==
== Series Details ==
Series: series starting with [1/2] drm/i915: Remove crtc->config usage from intel_modeset_readout_hw_state()
URL : https://patchwork.freedesktop.org/series/17135/
State : success
== Summary ==
Series 17135v1 Series without cover letter
https://patchwork.freedesktop.org/api/1.0/series/17135/revisions/1/mbox/
fi-bdw-5557u total:246 pass:232 dwarn:0 dfail:0 fail:0 skip:14 fi-bsw-n3050 total:246 pass:207 dwarn:0 dfail:0 fail:0 skip:39 fi-bxt-j4205 total:246 pass:224 dwarn:0 dfail:0 fail:0 skip:22 fi-bxt-t5700 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-j1900 total:246 pass:219 dwarn:0 dfail:0 fail:0 skip:27 fi-byt-n2820 total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-hsw-4770 total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-hsw-4770r total:246 pass:227 dwarn:0 dfail:0 fail:0 skip:19 fi-ilk-650 total:246 pass:194 dwarn:0 dfail:0 fail:0 skip:52 fi-ivb-3520m total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-ivb-3770 total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-kbl-7500u total:246 pass:225 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6260u total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-skl-6700hq total:246 pass:226 dwarn:0 dfail:0 fail:0 skip:20 fi-skl-6700k total:246 pass:222 dwarn:3 dfail:0 fail:0 skip:21 fi-skl-6770hq total:246 pass:233 dwarn:0 dfail:0 fail:0 skip:13 fi-snb-2520m total:246 pass:215 dwarn:0 dfail:0 fail:0 skip:31 fi-snb-2600 total:246 pass:214 dwarn:0 dfail:0 fail:0 skip:32
5486838e15ec59a57aa9a62f049f383cc3968e3f drm-tip: 2016y-12m-22d-13h-47m-26s UTC integration manifest 1374e5b drm/i915: Remove the double handling of 'flags from intel_mode_from_pipe_config() 1f38e87 drm/i915: Remove crtc->config usage from intel_modeset_readout_hw_state()
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3376/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 10 lines · On Thu, Dec 22, 2016 at 04:04:41PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
crtc->configis on its way out. Let's reduce our dependence on it a little bit by removing it fromintel_modeset_readout_hw_state().Also replace
crtc->acttivechecks withcrtc_state->base.activechecks.Cc Maarten Lankhorst <[email protected]>Suggested-by Maarten Lankhorst <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
Idling musing: I wonder whether we should convert the readout code to use an entirely free-standing atomic static tracked in drm_atomic_commit. And then apply it with a directly call to swap_state. That way we could reuse all the neat iterators.
Not sure that's a good idea though.
-Daniel
Quoted 116 lines
--- drivers/gpu/drm/i915/intel_display.c | 38 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_display.c +24
-14@@ -17032,7 +17032,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) dev_priv->active_crtcs =0 ;for_each_intel_crtc (dev, crtc) { -struct intel_crtc_state *crtc_state = crtc->config; +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state);__drm_atomic_helper_crtc_destroy_state (&crtc_state->base);memset (crtc_state,0 ,sizeof (*crtc_state));@@ -17051,7 +17052,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)DRM_DEBUG_KMS ("[CRTC:%d:%s] hw state readout: %s\n" , crtc->base.base.id, crtc->base.name, -enableddisabled (crtc->active)); +enableddisabled (crtc_state->base.active)); }for (i =0 ; i < dev_priv->num_shared_dpll; i++) {@@ -17061,7 +17062,11 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) &pll->config.hw_state); pll->config.crtc_mask =0 ;for_each_intel_crtc (dev, crtc) { -if (crtc->active && crtc->config->shared_dpll == pll) +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state); + +if (crtc_state->base.active && + crtc_state->shared_dpll == pll) pll->config.crtc_mask |=1 << crtc->pipe; } pll->active_mask = pll->config.crtc_mask;@@ -17074,11 +17079,14 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) pipe =0 ;if (encoder->get_hw_state (encoder, &pipe)) { +struct intel_crtc_state *crtc_state; + crtc =intel_get_crtc_for_pipe (dev_priv, pipe); + crtc_state =to_intel_crtc_state (crtc->base.state); encoder->base.crtc = &crtc->base; - crtc->config->output_types |=1 << encoder->type; - encoder->get_config (encoder, crtc->config); + crtc_state->output_types |=1 << encoder->type; + encoder->get_config (encoder, crtc_state); }else { encoder->base.crtc =NULL ; }@@ -17119,14 +17127,16 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) }for_each_intel_crtc (dev, crtc) { +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state);int pixclk =0 ; - crtc->base.hwmode = crtc->config->base.adjusted_mode; + crtc->base.hwmode = crtc_state->base.adjusted_mode;memset (&crtc->base.mode,0 ,sizeof (crtc->base.mode)); -if (crtc->base.state->active) { -intel_mode_from_pipe_config (&crtc->base.mode, crtc->config); -intel_mode_from_pipe_config (&crtc->base.state->adjusted_mode, crtc->config); +if (crtc_state->base.active) { +intel_mode_from_pipe_config (&crtc->base.mode, crtc_state); +intel_mode_from_pipe_config (&crtc_state->base.adjusted_mode, crtc_state);WARN_ON (drm_atomic_set_mode_for_crtc (crtc->base.state, &crtc->base.mode));/* @@ -17146,17 +17156,17 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)* mode change, which means it's safe to do a full * recalculation. */ - crtc->base.state->mode.private_flags =I915_MODE_FLAG_INHERITED ; + crtc_state->base.mode.private_flags =I915_MODE_FLAG_INHERITED ;if (INTEL_GEN (dev_priv) >=9 ||IS_BROADWELL (dev_priv)) - pixclk =ilk_pipe_pixel_rate (crtc->config); + pixclk =ilk_pipe_pixel_rate (crtc_state);else if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) - pixclk = crtc->config->base.adjusted_mode.crtc_clock; + pixclk = crtc_state->base.adjusted_mode.crtc_clock;else WARN_ON (dev_priv->display.modeset_calc_cdclk);/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ -if (IS_BROADWELL (dev_priv) && crtc->config->ips_enabled) +if (IS_BROADWELL (dev_priv) && crtc_state->ips_enabled) pixclk =DIV_ROUND_UP (pixclk *100 ,95 );drm_calc_timestamping_constants (&crtc->base, &crtc->base.hwmode);@@ -17165,7 +17175,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) dev_priv->min_pixclk[crtc->pipe] = pixclk; -intel_pipe_config_sanity_check (dev_priv, crtc->config); +intel_pipe_config_sanity_check (dev_priv, crtc_state); } }Signature · 6 lines
2.10.2 _______________________________________________ Intel-gfx mailing list [email protected] https://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] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Daniel Vetter
Quoted 5 lines · On Thu, Dec 22, 2016 at 04:04:41PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
crtc->configis on its way out. Let's reduce our dependence on it a little bit by removing it fromintel_modeset_readout_hw_state().
Quoted 7 lines
Quoted 5 lines
Also replace
crtc->acttivechecks withcrtc_state->base.activechecks.Cc Maarten Lankhorst <[email protected]>Suggested-by Maarten Lankhorst <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Daniel Vetter <[email protected]>
Pushed both patches to dinq. Thanks for the reviews.
Quoted 7 lines
Idling musing: I wonder whether we should convert the readout code to use an entirely free-standing atomic static tracked in
drm_atomic_commit. And then apply it with a directly call toswap_state. That way we could reuse all the neat iterators.Not sure that's a good idea though.
Hmm. Maybe.
At some point I was toying with the idea of making the old LVDS/DVO intel_crtc_mode_get() thing use the normal readout paths, but I was slightly worried that the lack of the top level atomic state could have been a problem. I don't think it actually was for the platforms where that codepath can be taken, but I did have to think about it a bit at least.
Quoted 123 lines
-Daniel
Quoted 116 lines
--- drivers/gpu/drm/i915/intel_display.c | 38 +++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 14 deletions(-)drivers/gpu/drm/i915/intel_display.c +24
-14@@ -17032,7 +17032,8 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) dev_priv->active_crtcs =0 ;for_each_intel_crtc (dev, crtc) { -struct intel_crtc_state *crtc_state = crtc->config; +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state);__drm_atomic_helper_crtc_destroy_state (&crtc_state->base);memset (crtc_state,0 ,sizeof (*crtc_state));@@ -17051,7 +17052,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)DRM_DEBUG_KMS ("[CRTC:%d:%s] hw state readout: %s\n" , crtc->base.base.id, crtc->base.name, -enableddisabled (crtc->active)); +enableddisabled (crtc_state->base.active)); }for (i =0 ; i < dev_priv->num_shared_dpll; i++) {@@ -17061,7 +17062,11 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) &pll->config.hw_state); pll->config.crtc_mask =0 ;for_each_intel_crtc (dev, crtc) { -if (crtc->active && crtc->config->shared_dpll == pll) +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state); + +if (crtc_state->base.active && + crtc_state->shared_dpll == pll) pll->config.crtc_mask |=1 << crtc->pipe; } pll->active_mask = pll->config.crtc_mask;@@ -17074,11 +17079,14 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) pipe =0 ;if (encoder->get_hw_state (encoder, &pipe)) { +struct intel_crtc_state *crtc_state; + crtc =intel_get_crtc_for_pipe (dev_priv, pipe); + crtc_state =to_intel_crtc_state (crtc->base.state); encoder->base.crtc = &crtc->base; - crtc->config->output_types |=1 << encoder->type; - encoder->get_config (encoder, crtc->config); + crtc_state->output_types |=1 << encoder->type; + encoder->get_config (encoder, crtc_state); }else { encoder->base.crtc =NULL ; }@@ -17119,14 +17127,16 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) }for_each_intel_crtc (dev, crtc) { +struct intel_crtc_state *crtc_state = +to_intel_crtc_state (crtc->base.state);int pixclk =0 ; - crtc->base.hwmode = crtc->config->base.adjusted_mode; + crtc->base.hwmode = crtc_state->base.adjusted_mode;memset (&crtc->base.mode,0 ,sizeof (crtc->base.mode)); -if (crtc->base.state->active) { -intel_mode_from_pipe_config (&crtc->base.mode, crtc->config); -intel_mode_from_pipe_config (&crtc->base.state->adjusted_mode, crtc->config); +if (crtc_state->base.active) { +intel_mode_from_pipe_config (&crtc->base.mode, crtc_state); +intel_mode_from_pipe_config (&crtc_state->base.adjusted_mode, crtc_state);WARN_ON (drm_atomic_set_mode_for_crtc (crtc->base.state, &crtc->base.mode));/* @@ -17146,17 +17156,17 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev)* mode change, which means it's safe to do a full * recalculation. */ - crtc->base.state->mode.private_flags =I915_MODE_FLAG_INHERITED ; + crtc_state->base.mode.private_flags =I915_MODE_FLAG_INHERITED ;if (INTEL_GEN (dev_priv) >=9 ||IS_BROADWELL (dev_priv)) - pixclk =ilk_pipe_pixel_rate (crtc->config); + pixclk =ilk_pipe_pixel_rate (crtc_state);else if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) - pixclk = crtc->config->base.adjusted_mode.crtc_clock; + pixclk = crtc_state->base.adjusted_mode.crtc_clock;else WARN_ON (dev_priv->display.modeset_calc_cdclk);/* pixel rate mustn't exceed 95% of cdclk with IPS on BDW */ -if (IS_BROADWELL (dev_priv) && crtc->config->ips_enabled) +if (IS_BROADWELL (dev_priv) && crtc_state->ips_enabled) pixclk =DIV_ROUND_UP (pixclk *100 ,95 );drm_calc_timestamping_constants (&crtc->base, &crtc->base.hwmode);@@ -17165,7 +17175,7 @@ static void intel_modeset_readout_hw_state(struct drm_device *dev) dev_priv->min_pixclk[crtc->pipe] = pixclk; -intel_pipe_config_sanity_check (dev_priv, crtc->config); +intel_pipe_config_sanity_check (dev_priv, crtc_state); } }Signature · 6 lines
2.10.2 _______________________________________________ Intel-gfx mailing list [email protected] https://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] https://lists.freedesktop.org/mailman/listinfo/intel-gfx