drm/i915: VLV/CHV atomic wm prep work
Subsystems (2)
cover drm/i915: VLV/CHV atomic wm prep work
From: Ville Syrjälä <[email protected]>
A decent pile of prep work split off from my VLV/CHV atomic watermark work. Mostly VLV/CHV specific stuff, but there are a few small things in there that touch other platforms as well.
Entire series available here:git://github.com/vsyrjala/linux.git vlv_atomic_wm_prep
Ville Syrjälä (15):
drm/i915: Drop the nop intel_update_watermarks() call from
haswell_crtc_enable()
drm/i915: Use the ilk_disable_lp_wm() return value drm/i915: Fix the level 0 max_wm hack on VLV/CHV
drm/i915: Clean up VLV/CHV maxfifo watermark setup drm/i915: Remove duplicated wm setup for vlv and chv drm/i915: Organize vlv/chv watermarks by plane_id drm/i915: Introduce vlv_invert_wm_value()
drm/i915: Pass around dev_priv in vlv wm functions drm/i915: Protect cxsr state with wm_mutex
drm/i915: Skip vblank wait if cxsr was already off drm/i915: Protect DSPARB registers with a spinlock drm/i915: Zero out HOWM registers before writing new WM/HOWM register
values
drm/i915: Write all DDL registers in one go
drm/i915: Clean up vlv_program_watermarks()
drm/i915: Pass crtc state to vlv_compute_wm_level()
drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 21 +- drivers/gpu/drm/i915/intel_display.c | 21 +- drivers/gpu/drm/i915/intel_pm.c | 394 ++++++++++++++++++----------------- 4 files changed, 218 insertions(+), 219 deletions(-)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/15 drm/i915: Drop the nop intel_update_watermarks() call from haswell_crtc_enable()
From: Ville Syrjälä <[email protected]>
HSW+ all use the .initial_watermarks() hook, so there's no point in calling intel_update_watermarks() from HSW+ specific code. We'll still hang on to the .initial_watermarks NULL check since theoretically if the memory latencies are not populated we would not populate the function pointer either.
--- drivers/gpu/drm/i915/intel_display.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -4
@@ -5465,10 +5465,7 @@ static void haswell_crtc_enable(struct intel_crtc_state *pipe_config,intel_ddi_enable_transcoder_func (crtc);if (dev_priv->display.initial_watermarks !=NULL ) - dev_priv->display.initial_watermarks (old_intel_state, - pipe_config); -else -intel_update_watermarks (intel_crtc); + dev_priv->display.initial_watermarks (old_intel_state, pipe_config);/* XXX: Do the pipe assertions at the right place for BXT DSI. */ if (!transcoder_is_dsi (cpu_transcoder))
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/15 drm/i915: Use the ilk_disable_lp_wm() return value
In reply to [email protected]From: Ville Syrjälä <[email protected]>
ilk_disable_lp_wm() will tell us whether the LP1+ watermarks were disabled or not, and hence whether we need to for the vblank wait or not. Let's use that information to eliminate some useless vblank waits.
--- drivers/gpu/drm/i915/intel_display.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +1 -3
@@ -5114,10 +5114,8 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state)* * WaCxSRDisabledForSpriteScaling:ivb */ -if (pipe_config->disable_lp_wm) { -ilk_disable_lp_wm (dev); +if (pipe_config->disable_lp_wm &&ilk_disable_lp_wm (dev))intel_wait_for_vblank (dev_priv, crtc->pipe); - }/* * If we're doing a modeset, we're done. No need to do any pre-vblank
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/15 drm/i915: Fix the level 0 max_wm hack on VLV/CHV
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The watermark should never exceed the FIFO size, so we need to check against the current FIFO size instead of the theoretical maximum when we clamp the level 0 watermark.
--- drivers/gpu/drm/i915/intel_pm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -2
@@ -1132,13 +1132,13 @@ static void vlv_compute_wm(struct intel_crtc *crtc)/* normal watermarks */ for (level =0 ; level < wm_state->num_levels; level++) {int wm =vlv_compute_wm_level (plane, crtc, state, level); -int max_wm = plane->base.type ==DRM_PLANE_TYPE_CURSOR ?63 :511 ; +int max_wm = plane->wm.fifo_size;/* hack */ if (WARN_ON (level ==0 && wm > max_wm)) wm = max_wm; -if (wm > plane->wm.fifo_size) +if (wm > max_wm)break ;switch (plane->base.type) {
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/15 drm/i915: Clean up VLV/CHV maxfifo watermark setup
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Let's compute the maxfifo watermarks using max() instead of min(). Can't even recall why I did it the other way originally. Anyways using max() avoids having to initialize the watermarks to the max value first.
--- drivers/gpu/drm/i915/intel_pm.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +2 -10
@@ -1100,7 +1100,6 @@ static void vlv_compute_wm(struct intel_crtc *crtc)struct drm_i915_private *dev_priv =to_i915 (dev);struct vlv_wm_state *wm_state = &crtc->wm_state;struct intel_plane *plane; -int sr_fifo_size =INTEL_INFO (dev_priv)->num_pipes *512 -1 ;int level;memset (wm_state,0 ,sizeof (*wm_state));
@@ -1115,13 +1114,6 @@ static void vlv_compute_wm(struct intel_crtc *crtc)if (wm_state->num_active_planes !=1 ) wm_state->cxsr = false; -if (wm_state->cxsr) { -for (level =0 ; level < wm_state->num_levels; level++) { - wm_state->sr[level].plane = sr_fifo_size; - wm_state->sr[level].cursor =63 ; - } - } -for_each_intel_plane_on_crtc (dev, crtc, plane) {struct intel_plane_state *state =to_intel_plane_state (plane->base.state);
@@ -1172,14 +1164,14 @@ static void vlv_compute_wm(struct intel_crtc *crtc)case DRM_PLANE_TYPE_PRIMARY :for (level =0 ; level < wm_state->num_levels; level++) wm_state->sr[level].plane = -min (wm_state->sr[level].plane, +max (wm_state->sr[level].plane, wm_state->wm[level].primary);break ;case DRM_PLANE_TYPE_OVERLAY : sprite =vlv_sprite_id (plane->id);for (level =0 ; level < wm_state->num_levels; level++) wm_state->sr[level].plane = -min (wm_state->sr[level].plane, +max (wm_state->sr[level].plane, wm_state->wm[level].sprite[sprite]);break ; }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/15 drm/i915: Remove duplicated wm setup for vlv and chv
In reply to [email protected]From: Ville Syrjälä <[email protected]>
The code for vlv and chv wm latency/function pointer setup is identical. Drop one of the copies.
--- drivers/gpu/drm/i915/intel_pm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +1 -4
@@ -7683,10 +7683,7 @@ void intel_init_pm(struct drm_i915_private *dev_priv)DRM_DEBUG_KMS ("Failed to read display plane latency. " "Disable CxSR\n" ); } - }else if (IS_CHERRYVIEW (dev_priv)) { -vlv_setup_wm_latency (dev_priv); - dev_priv->display.update_wm = vlv_update_wm; - }else if (IS_VALLEYVIEW (dev_priv)) { + }else if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) {vlv_setup_wm_latency (dev_priv); dev_priv->display.update_wm = vlv_update_wm; }else if (IS_PINEVIEW (dev_priv)) {
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/15 drm/i915: Organize vlv/chv watermarks by plane_id
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Store the vlv/chv watermark values in straight up arrays indexed by enum plane_id. Avoids a lot of useless checks for the plane type when we don't have to think which structure member we need to access.
--- drivers/gpu/drm/i915/i915_drv.h | 16 ++- drivers/gpu/drm/i915/intel_pm.c | 209 ++++++++++++++++------------------------ 2 files changed, 92 insertions(+), 133 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +7 -9
@@ -1657,24 +1657,22 @@ struct ilk_wm_values { };struct vlv_pipe_wm { -uint16_t primary; -uint16_t sprite[2 ]; -uint8_t cursor; +uint16_t plane[I915_MAX_PLANES ]; };struct vlv_sr_wm {uint16_t plane; -uint8_t cursor; +uint16_t cursor; +}; + +struct vlv_wm_ddl_values { +uint8_t plane[I915_MAX_PLANES ]; };struct vlv_wm_values {struct vlv_pipe_wm pipe[3 ];struct vlv_sr_wm sr; -struct { -uint8_t cursor; -uint8_t sprite[2 ]; -uint8_t primary; - } ddl[3 ]; +struct vlv_wm_ddl_values ddl[3 ];uint8_t level;bool cxsr; };
drivers/gpu/drm/i915/intel_pm.c +85 -124
319 lines not on this page · raw message
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/15 drm/i915: Introduce vlv_invert_wm_value()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add a small helper to do invert the vlv/chv values. Less fragile perhaps, and let's us clearly mark all overlarge wateramarks as disabled (by just making them all USHRT_MAX).
--- drivers/gpu/drm/i915/intel_pm.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +17 -4
@@ -1053,6 +1053,14 @@ static void vlv_compute_fifo(struct intel_crtc *crtc)WARN_ON (fifo_left !=0 ); } +static u16 vlv_invert_wm_value (u16 wm,u16 fifo_size) +{ +if (wm > fifo_size) +return USHRT_MAX ; +else +return fifo_size - wm; +} +static void vlv_invert_wms (struct intel_crtc *crtc) {struct vlv_wm_state *wm_state = &crtc->wm_state;
@@ -1064,12 +1072,17 @@ static void vlv_invert_wms(struct intel_crtc *crtc)INTEL_INFO (to_i915 (dev))->num_pipes *512 -1 ;struct intel_plane *plane; - wm_state->sr[level].plane = sr_fifo_size - wm_state->sr[level].plane; - wm_state->sr[level].cursor =63 - wm_state->sr[level].cursor; + wm_state->sr[level].plane = +vlv_invert_wm_value (wm_state->sr[level].plane, + sr_fifo_size); + wm_state->sr[level].cursor = +vlv_invert_wm_value (wm_state->sr[level].cursor, +63 );for_each_intel_plane_on_crtc (dev, crtc, plane) { - wm_state->wm[level].plane[plane->id] = plane->wm.fifo_size - - wm_state->wm[level].plane[plane->id]; + wm_state->wm[level].plane[plane->id] = +vlv_invert_wm_value (wm_state->wm[level].plane[plane->id], + plane->wm.fifo_size); } } }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/15 drm/i915: Pass around dev_priv in vlv wm functions
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Pasing dev_priv instead of dev is the future. Let's make the vlv/chv wm functions respect that idea.
--- drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +11 -13
@@ -1067,9 +1067,9 @@ static void vlv_invert_wms(struct intel_crtc *crtc)int level;for (level =0 ; level < wm_state->num_levels; level++) { -struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);const int sr_fifo_size = -INTEL_INFO (to_i915 (dev))->num_pipes *512 -1 ; +INTEL_INFO (dev_priv)->num_pipes *512 -1 ;struct intel_plane *plane; wm_state->sr[level].plane =
@@ -1079,7 +1079,7 @@ static void vlv_invert_wms(struct intel_crtc *crtc)vlv_invert_wm_value (wm_state->sr[level].cursor,63 ); -for_each_intel_plane_on_crtc (dev, crtc, plane) { +for_each_intel_plane_on_crtc (&dev_priv->drm, crtc, plane) { wm_state->wm[level].plane[plane->id] =vlv_invert_wm_value (wm_state->wm[level].plane[plane->id], plane->wm.fifo_size);
@@ -1089,8 +1089,7 @@ static void vlv_invert_wms(struct intel_crtc *crtc)static void vlv_compute_wm (struct intel_crtc *crtc) { -struct drm_device *dev = crtc->base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);struct vlv_wm_state *wm_state = &crtc->wm_state;struct intel_plane *plane;int level;
@@ -1107,7 +1106,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)if (wm_state->num_active_planes !=1 ) wm_state->cxsr = false; -for_each_intel_plane_on_crtc (dev, crtc, plane) { +for_each_intel_plane_on_crtc (&dev_priv->drm, crtc, plane) {struct intel_plane_state *state =to_intel_plane_state (plane->base.state);int level;
@@ -1253,16 +1252,16 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)#undef VLV_FIFO -static void vlv_merge_wm (struct drm_device *dev, +static void vlv_merge_wm (struct drm_i915_private *dev_priv,struct vlv_wm_values *wm) {struct intel_crtc *crtc;int num_active_crtcs =0 ; - wm->level =to_i915 (dev)->wm.max_level; + wm->level = dev_priv->wm.max_level; wm->cxsr = true; -for_each_intel_crtc (dev, crtc) { +for_each_intel_crtc (&dev_priv->drm, crtc) {const struct vlv_wm_state *wm_state = &crtc->wm_state;if (!crtc->active)
@@ -1281,7 +1280,7 @@ static void vlv_merge_wm(struct drm_device *dev,if (num_active_crtcs >1 ) wm->level =VLV_WM_LEVEL_PM2 ; -for_each_intel_crtc (dev, crtc) { +for_each_intel_crtc (&dev_priv->drm, crtc) {struct vlv_wm_state *wm_state = &crtc->wm_state;enum pipe pipe = crtc->pipe;
@@ -1301,13 +1300,12 @@ static void vlv_merge_wm(struct drm_device *dev,static void vlv_update_wm (struct intel_crtc *crtc) { -struct drm_device *dev = crtc->base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);enum pipe pipe = crtc->pipe;struct vlv_wm_values wm = {};vlv_compute_wm (crtc); -vlv_merge_wm (dev, &wm); +vlv_merge_wm (dev_priv, &wm);if (memcmp (&dev_priv->wm.vlv, &wm,sizeof (wm)) ==0 ) {/* FIXME should be part of crtc atomic commit */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 08/15] drm/i915: Pass around dev_priv in vlv wm functions
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 4 lines
From: Ville Syrjälä <[email protected]>
Pasing
dev_privinstead of dev is the future. Let's make the vlv/chv wm functions respect that idea.
^Passing
With that fixed, patch 1-10
When I was looking at converting VLV/CHV watermarks to atomic, I came up with a lot of these fixes too, so they just make sense. :)
Quoted 85 lines
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-)drivers/gpu/drm/i915/intel_pm.c +9
-12@@ -1067,9 +1067,9 @@ static void vlv_invert_wms(struct intel_crtc *crtc)int level;for (level =0 ; level < wm_state->num_levels; level++) { -struct drm_device *dev = crtc->base.dev; +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);const int sr_fifo_size = -INTEL_INFO (to_i915 (dev))->num_pipes *512 -1 ; +INTEL_INFO (dev_priv)->num_pipes *512 -1 ;struct intel_plane *plane; wm_state->sr[level].plane =@@ -1079,7 +1079,7 @@ static void vlv_invert_wms(struct intel_crtc *crtc)vlv_invert_wm_value (wm_state->sr[level].cursor,63 ); -for_each_intel_plane_on_crtc (dev, crtc, plane) { +for_each_intel_plane_on_crtc (&dev_priv->drm, crtc, plane) { wm_state->wm[level].plane[plane->id] =vlv_invert_wm_value (wm_state->wm[level].plane[plane->id], plane->wm.fifo_size);@@ -1089,8 +1089,7 @@ static void vlv_invert_wms(struct intel_crtc *crtc)static void vlv_compute_wm (struct intel_crtc *crtc) { -struct drm_device *dev = crtc->base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev); +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);struct vlv_wm_state *wm_state = &crtc->wm_state;struct intel_plane *plane;int level;@@ -1107,7 +1106,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)if (wm_state->num_active_planes !=1 ) wm_state->cxsr = false; -for_each_intel_plane_on_crtc (dev, crtc, plane) { +for_each_intel_plane_on_crtc (&dev_priv->drm, crtc, plane) {struct intel_plane_state *state =to_intel_plane_state (plane->base.state);int level;@@ -1253,16 +1252,16 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)#undef VLV_FIFO -static void vlv_merge_wm (struct drm_device *dev, +static void vlv_merge_wm (struct drm_i915_private *dev_priv,struct vlv_wm_values *wm) {struct intel_crtc *crtc;int num_active_crtcs =0 ; - wm->level =to_i915 (dev)->wm.max_level; + wm->level = dev_priv->wm.max_level; wm->cxsr = true; -for_each_intel_crtc (dev, crtc) { +for_each_intel_crtc (&dev_priv->drm, crtc) {const struct vlv_wm_state *wm_state = &crtc->wm_state;if (!crtc->active)@@ -1281,7 +1280,7 @@ static void vlv_merge_wm(struct drm_device *dev,if (num_active_crtcs >1 ) wm->level =VLV_WM_LEVEL_PM2 ; -for_each_intel_crtc (dev, crtc) { +for_each_intel_crtc (&dev_priv->drm, crtc) {struct vlv_wm_state *wm_state = &crtc->wm_state;enum pipe pipe = crtc->pipe;@@ -1301,13 +1300,12 @@ static void vlv_merge_wm(struct drm_device *dev,static void vlv_update_wm (struct intel_crtc *crtc) { -struct drm_device *dev = crtc->base.dev; -struct drm_i915_private *dev_priv =to_i915 (dev);
drivers/gpu/drm/i915/intel_pm.c static void vlv_merge_wm(struct drm_device *dev, · line 1311
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +2
-1+struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);enum pipe pipe = crtc->pipe;struct vlv_wm_values wm = {};vlv_compute_wm (crtc); -vlv_merge_wm (dev, &wm); +vlv_merge_wm (dev_priv, &wm);if (memcmp (&dev_priv->wm.vlv, &wm,sizeof (wm)) ==0 ) {/* FIXME should be part of crtc atomic commit */
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/15 drm/i915: Protect cxsr state with wm_mutex
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Let's protect the cxsr state with the wm_mutex, since it might get poked from multiple places if there's a parallel plane update happening with a pipe getting enable/disabled.
It's still pretty racy for the old platforms, but for vlv/chv it should work, I think. If not, we'll improve it later anyway.
--- drivers/gpu/drm/i915/intel_display.c | 2 -- drivers/gpu/drm/i915/intel_pm.c | 14 ++++++++++---- 2 files changed, 10 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_display.c +0 -2
@@ -5023,7 +5023,6 @@ intel_pre_disable_primary_noatomic(struct drm_crtc *crtc)*/ if (HAS_GMCH_DISPLAY (dev_priv)) {intel_set_memory_cxsr (dev_priv, false); - dev_priv->wm.vlv.cxsr = false;intel_wait_for_vblank (dev_priv, pipe); } }
@@ -5102,7 +5101,6 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state)*/ if (old_crtc_state->base.active) {intel_set_memory_cxsr (dev_priv, false); - dev_priv->wm.vlv.cxsr = false;intel_wait_for_vblank (dev_priv, crtc->pipe); } }
drivers/gpu/drm/i915/intel_pm.c +10 -4
@@ -312,14 +312,13 @@ static void chv_set_memory_pm5(struct drm_i915_private *dev_priv, bool enable)#define FW_WM (value, plane) \ (((value) << DSPFW_ ## plane ## _SHIFT) & DSPFW_ ## plane ## _MASK) -void intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable) +static void _intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable) {u32 val;if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) {I915_WRITE (FW_BLC_SELF_VLV , enable ?FW_CSPWRDWNEN :0 );POSTING_READ (FW_BLC_SELF_VLV ); - dev_priv->wm.vlv.cxsr = enable; }else if (IS_G4X (dev_priv) ||IS_CRESTLINE (dev_priv)) {I915_WRITE (FW_BLC_SELF , enable ?FW_BLC_SELF_EN :0 );POSTING_READ (FW_BLC_SELF );
@@ -350,6 +349,13 @@ void intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enable)DRM_DEBUG_KMS ("memory self-refresh is %s\n" ,enableddisabled (enable)); } +void intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable) +{ +mutex_lock (&dev_priv->wm.wm_mutex); +_intel_set_memory_cxsr (dev_priv, enable); + dev_priv->wm.vlv.cxsr = enable; +mutex_unlock (&dev_priv->wm.wm_mutex); +}/* * Latency for FIFO fetches is dependent on several factors:
@@ -1322,7 +1328,7 @@ static void vlv_update_wm(struct intel_crtc *crtc)chv_set_memory_pm5 (dev_priv, false);if (!wm.cxsr && dev_priv->wm.vlv.cxsr) -intel_set_memory_cxsr (dev_priv, false); +_intel_set_memory_cxsr (dev_priv, false);/* FIXME should be part of crtc atomic commit */ vlv_pipe_set_fifo_size (crtc);
@@ -1336,7 +1342,7 @@ static void vlv_update_wm(struct intel_crtc *crtc) wm.sr.plane, wm.sr.cursor, wm.level, wm.cxsr);if (wm.cxsr && !dev_priv->wm.vlv.cxsr) -intel_set_memory_cxsr (dev_priv, true); +_intel_set_memory_cxsr (dev_priv, true);if (wm.level >=VLV_WM_LEVEL_PM5 && dev_priv->wm.vlv.level <VLV_WM_LEVEL_PM5 )
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 10/15 drm/i915: Skip vblank wait if cxsr was already off
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Before we attempt to turn any planes on or off we must first exit csxr. That's due to cxsr effectively making the plane enable bits read-only. Currently we achieve that with a vblank wait right after toggling the cxsr enable bit. We do the vblank wait even if cxsr was already off, which seems wasteful, so let's try to only do it when absolutely necessary.
We could start tracking the cxsr state fully somewhere, but for now it seems easiest to just have intel_set_memory_cxsr() return the previous cxsr state.
--- drivers/gpu/drm/i915/i915_drv.h | 2 +- drivers/gpu/drm/i915/intel_display.c | 10 ++++------ drivers/gpu/drm/i915/intel_pm.c | 31 ++++++++++++++++++++++++------- 3 files changed, 29 insertions(+), 14 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -3571,7 +3571,7 @@ extern void i915_redisable_vga_power_on(struct drm_i915_private *dev_priv);extern bool ironlake_set_drps (struct drm_i915_private *dev_priv,u8 val);extern void intel_init_pch_refclk (struct drm_i915_private *dev_priv);extern void intel_set_rps (struct drm_i915_private *dev_priv,u8 val); -extern void intel_set_memory_cxsr (struct drm_i915_private *dev_priv, +extern bool intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable); int i915_reg_read_ioctl(struct drm_device *dev, void *data,
drivers/gpu/drm/i915/intel_display.c +4 -6
@@ -5021,10 +5021,9 @@ intel_pre_disable_primary_noatomic(struct drm_crtc *crtc)* event which is after the vblank start event, so we need to have a * wait-for-vblank between disabling the plane and the pipe. */ -if (HAS_GMCH_DISPLAY (dev_priv)) { -intel_set_memory_cxsr (dev_priv, false); +if (HAS_GMCH_DISPLAY (dev_priv) && +intel_set_memory_cxsr (dev_priv, false))intel_wait_for_vblank (dev_priv, pipe); - } }static void intel_post_plane_update (struct intel_crtc_state *old_crtc_state)
@@ -5099,10 +5098,9 @@ static void intel_pre_plane_update(struct intel_crtc_state *old_crtc_state)* event which is after the vblank start event, so we need to have a * wait-for-vblank between disabling the plane and the pipe. */ -if (old_crtc_state->base.active) { -intel_set_memory_cxsr (dev_priv, false); +if (old_crtc_state->base.active && +intel_set_memory_cxsr (dev_priv, false))intel_wait_for_vblank (dev_priv, crtc->pipe); - } }/*
drivers/gpu/drm/i915/intel_pm.c +24 -7
@@ -312,22 +312,30 @@ static void chv_set_memory_pm5(struct drm_i915_private *dev_priv, bool enable)#define FW_WM (value, plane) \ (((value) << DSPFW_ ## plane ## _SHIFT) & DSPFW_ ## plane ## _MASK) -static void _intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable) +static bool _intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable) { +bool was_enabled;u32 val;if (IS_VALLEYVIEW (dev_priv) ||IS_CHERRYVIEW (dev_priv)) { + was_enabled =I915_READ (FW_BLC_SELF_VLV ) &FW_CSPWRDWNEN ;I915_WRITE (FW_BLC_SELF_VLV , enable ?FW_CSPWRDWNEN :0 );POSTING_READ (FW_BLC_SELF_VLV ); }else if (IS_G4X (dev_priv) ||IS_CRESTLINE (dev_priv)) { + was_enabled =I915_READ (FW_BLC_SELF ) &FW_BLC_SELF_EN ;I915_WRITE (FW_BLC_SELF , enable ?FW_BLC_SELF_EN :0 );POSTING_READ (FW_BLC_SELF ); }else if (IS_PINEVIEW (dev_priv)) { - val =I915_READ (DSPFW3 ) & ~PINEVIEW_SELF_REFRESH_EN ; - val |= enable ?PINEVIEW_SELF_REFRESH_EN :0 ; + val =I915_READ (DSPFW3 ); + was_enabled = val &PINEVIEW_SELF_REFRESH_EN ; +if (enable) + val |=PINEVIEW_SELF_REFRESH_EN ; +else + val &= ~PINEVIEW_SELF_REFRESH_EN ;I915_WRITE (DSPFW3 , val);POSTING_READ (DSPFW3 ); }else if (IS_I945G (dev_priv) ||IS_I945GM (dev_priv)) { + was_enabled =I915_READ (FW_BLC_SELF ) &FW_BLC_SELF_EN ; val = enable ?_MASKED_BIT_ENABLE (FW_BLC_SELF_EN ) :_MASKED_BIT_DISABLE (FW_BLC_SELF_EN );I915_WRITE (FW_BLC_SELF , val);
@@ -338,23 +346,32 @@ static void _intel_set_memory_cxsr(struct drm_i915_private *dev_priv, bool enabl* and yet it does have the related watermark in * FW_BLC_SELF. What's going on? */ + was_enabled =I915_READ (INSTPM ) &INSTPM_SELF_EN ; val = enable ?_MASKED_BIT_ENABLE (INSTPM_SELF_EN ) :_MASKED_BIT_DISABLE (INSTPM_SELF_EN );I915_WRITE (INSTPM , val);POSTING_READ (INSTPM ); }else { -return ; +return false; } -DRM_DEBUG_KMS ("memory self-refresh is %s\n" ,enableddisabled (enable)); +DRM_DEBUG_KMS ("memory self-refresh is %s (was %s)\n" , +enableddisabled (enable), +enableddisabled (was_enabled)); + +return was_enabled; } -void intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable) +bool intel_set_memory_cxsr (struct drm_i915_private *dev_priv,bool enable) { +bool ret; +mutex_lock (&dev_priv->wm.wm_mutex); -_intel_set_memory_cxsr (dev_priv, enable); + ret =_intel_set_memory_cxsr (dev_priv, enable); dev_priv->wm.vlv.cxsr = enable;mutex_unlock (&dev_priv->wm.wm_mutex); + +return ret; }/*
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 11/15 drm/i915: Protect DSPARB registers with a spinlock
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -811,6 +811,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,spin_lock_init (&dev_priv->uncore.lock);spin_lock_init (&dev_priv->mm.object_stat_lock);spin_lock_init (&dev_priv->mmio_flip_lock); +spin_lock_init (&dev_priv->wm.dsparb_lock);mutex_init (&dev_priv->sb_lock);mutex_init (&dev_priv->modeset_restore_lock);mutex_init (&dev_priv->av_mutex);
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2169,6 +2169,9 @@ struct drm_i915_private { } sagv_status;struct { +/* protects DSPARB registers on pre-g4x/vlv/chv */ +spinlock_t dsparb_lock; +/* * Raw watermark latency values: * in 0.1us units for WM0,
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -1215,6 +1215,8 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)pipe_name (crtc->pipe), sprite0_start, sprite1_start, fifo_size); +spin_lock (&dev_priv->wm.dsparb_lock); +switch (crtc->pipe) {uint32_t dsparb, dsparb2, dsparb3;case PIPE_A :
@@ -1271,6 +1273,10 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)default :break ; } + +POSTING_READ (DSPARB ); + +spin_unlock (&dev_priv->wm.dsparb_lock); }#undef VLV_FIFO
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/15] drm/i915: Protect DSPARB registers with a spinlock
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 19 lines
From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 10 insertions(+)drivers/gpu/drm/i915/i915_drv.c +0
-0
drivers/gpu/drm/i915/i915_drv.c static int i915_driver_init_early(struct drm_i915_private *dev_priv, · line 814
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -811,6 +811,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,spin_lock_init (&dev_priv->uncore.lock);spin_lock_init (&dev_priv->mm.object_stat_lock);spin_lock_init (&dev_priv->mmio_flip_lock); +spin_lock_init (&dev_priv->wm.dsparb_lock);
Can we make sure all wm updates are done with dev_priv->wm.wm_mutex held instead?
gen9 wm's and ilk wm's use that mutex, for similar reasons.
Quoted 31 lines
drivers/gpu/drm/i915/i915_drv.c +0
-0mutex_init (&dev_priv->sb_lock);mutex_init (&dev_priv->modeset_restore_lock);mutex_init (&dev_priv->av_mutex);drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2169,6 +2169,9 @@ struct drm_i915_private { } sagv_status;struct { +/* protects DSPARB registers on pre-g4x/vlv/chv */ +spinlock_t dsparb_lock; +/* * Raw watermark latency values: * in 0.1us units for WM0, drivers/gpu/drm/i915/intel_pm.c +2
-0@@ -1215,6 +1215,8 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)pipe_name (crtc->pipe), sprite0_start, sprite1_start, fifo_size); +spin_lock (&dev_priv->wm.dsparb_lock); +switch (crtc->pipe) {uint32_t dsparb, dsparb2, dsparb3;case PIPE_A :
drivers/gpu/drm/i915/intel_pm.c static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc) · line 1282
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +4
-0@@ -1271,6 +1273,10 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)default :break ; } + +POSTING_READ (DSPARB ); + +spin_unlock (&dev_priv->wm.dsparb_lock); }#undef VLV_FIFO
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/15] drm/i915: Protect DSPARB registers with a spinlock
Quoted 15 lines · Maarten Lankhorst
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 14 lines
From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 10 insertions(+)
Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c static int i915_driver_init_early(struct drm_i915_private *dev_priv, · line 814
Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -811,6 +811,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,spin_lock_init (&dev_priv->uncore.lock);spin_lock_init (&dev_priv->mm.object_stat_lock);spin_lock_init (&dev_priv->mmio_flip_lock); +spin_lock_init (&dev_priv->wm.dsparb_lock);Can we make sure all wm updates are done with
dev_priv->wm.wm_mutexheld instead?
We can't grab a mutex from the vblank evade critical section. We'd have to hold the mutex across the whole thing then. Not sure if that would be a good or a bad thing.
Quoted 44 lines
gen9 wm's and ilk wm's use that mutex, for similar reasons.
Quoted 41 lines
drivers/gpu/drm/i915/i915_drv.c +0
-0mutex_init (&dev_priv->sb_lock);mutex_init (&dev_priv->modeset_restore_lock);mutex_init (&dev_priv->av_mutex);drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2169,6 +2169,9 @@ struct drm_i915_private { } sagv_status;struct { +/* protects DSPARB registers on pre-g4x/vlv/chv */ +spinlock_t dsparb_lock; +/* * Raw watermark latency values: * in 0.1us units for WM0, drivers/gpu/drm/i915/intel_pm.c +6
-0@@ -1215,6 +1215,8 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)pipe_name (crtc->pipe), sprite0_start, sprite1_start, fifo_size); +spin_lock (&dev_priv->wm.dsparb_lock); +switch (crtc->pipe) {uint32_t dsparb, dsparb2, dsparb3;case PIPE_A :@@ -1271,6 +1273,10 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)default :break ; } + +POSTING_READ (DSPARB ); + +spin_unlock (&dev_priv->wm.dsparb_lock); }#undef VLV_FIFO
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/15] drm/i915: Protect DSPARB registers with a spinlock
Op 01-12-16 om 14:13 schreef Ville Syrjälä:
Quoted 26 lines · Maarten Lankhorst
Quoted 15 lines
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 14 lines
From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 10 insertions(+)Quoted 10 lines
drivers/gpu/drm/i915/i915_drv.c static int i915_driver_init_early(struct drm_i915_private *dev_priv, · line 814
Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -811,6 +811,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,spin_lock_init (&dev_priv->uncore.lock);spin_lock_init (&dev_priv->mm.object_stat_lock);spin_lock_init (&dev_priv->mmio_flip_lock); +spin_lock_init (&dev_priv->wm.dsparb_lock);Can we make sure all wm updates are done with
dev_priv->wm.wm_mutexheld instead?
Quoted 3 lines
We can't grab a mutex from the vblank evade critical section. We'd have to hold the mutex across the whole thing then. Not sure if that would be a good or a bad thing.
Ah right, I missed that part since it didn't happen in the patches yet, might be worth pointing out in the commit message.
Will vlv_wm_values also be updated with that lock in the future? Looks like it could be a fun race otherwise.
Quoted 41 lines
Quoted 41 lines
gen9 wm's and ilk wm's use that mutex, for similar reasons.
Quoted 40 lines
drivers/gpu/drm/i915/i915_drv.c +0
-0mutex_init (&dev_priv->sb_lock);mutex_init (&dev_priv->modeset_restore_lock);mutex_init (&dev_priv->av_mutex);drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2169,6 +2169,9 @@ struct drm_i915_private { } sagv_status;struct { +/* protects DSPARB registers on pre-g4x/vlv/chv */ +spinlock_t dsparb_lock; +/* * Raw watermark latency values: * in 0.1us units for WM0, drivers/gpu/drm/i915/intel_pm.c +6
-0@@ -1215,6 +1215,8 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)pipe_name (crtc->pipe), sprite0_start, sprite1_start, fifo_size); +spin_lock (&dev_priv->wm.dsparb_lock); +switch (crtc->pipe) {uint32_t dsparb, dsparb2, dsparb3;case PIPE_A :@@ -1271,6 +1273,10 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)default :break ; } + +POSTING_READ (DSPARB ); + +spin_unlock (&dev_priv->wm.dsparb_lock); }
Quoted 1 line
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc) · line 1282
Quoted 1 line
drivers/gpu/drm/i915/intel_pm.c +0
-0#undef VLV_FIFO
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 11/15] drm/i915: Protect DSPARB registers with a spinlock
Quoted 27 lines · Maarten Lankhorst
Op 01-12-16 om 14:13 schreef Ville Syrjälä:
Quoted 26 lines · Maarten Lankhorst
Quoted 25 lines
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 19 lines
From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 10 insertions(+)drivers/gpu/drm/i915/i915_drv.c +0
-0drivers/gpu/drm/i915/i915_drv.c static int i915_driver_init_early(struct drm_i915_private *dev_priv, · line 814
Quoted 4 lines
drivers/gpu/drm/i915/i915_drv.c +1
-0@@ -811,6 +811,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,spin_lock_init (&dev_priv->uncore.lock);spin_lock_init (&dev_priv->mm.object_stat_lock);spin_lock_init (&dev_priv->mmio_flip_lock); +spin_lock_init (&dev_priv->wm.dsparb_lock);Can we make sure all wm updates are done with
dev_priv->wm.wm_mutexheld instead?
Quoted 4 lines
Quoted 3 lines
We can't grab a mutex from the vblank evade critical section. We'd have to hold the mutex across the whole thing then. Not sure if that would be a good or a bad thing.
Ah right, I missed that part since it didn't happen in the patches yet, might be worth pointing out in the commit message.
Right. A bit of tunnel vision on my part here. I'll plop in a note about it.
Quoted 2 lines
Will
vlv_wm_valuesalso be updated with that lock in the future? Looks like it could be a fun race otherwise.
Yes, wm_mutex will be protecting all the global wm state.
Quoted 43 lines
Quoted 42 lines
Quoted 42 lines
gen9 wm's and ilk wm's use that mutex, for similar reasons.
Quoted 41 lines
drivers/gpu/drm/i915/i915_drv.c +0
-0mutex_init (&dev_priv->sb_lock);mutex_init (&dev_priv->modeset_restore_lock);mutex_init (&dev_priv->av_mutex);drivers/gpu/drm/i915/i915_drv.h +3
-0@@ -2169,6 +2169,9 @@ struct drm_i915_private { } sagv_status;struct { +/* protects DSPARB registers on pre-g4x/vlv/chv */ +spinlock_t dsparb_lock; +/* * Raw watermark latency values: * in 0.1us units for WM0, drivers/gpu/drm/i915/intel_pm.c +6
-0@@ -1215,6 +1215,8 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)pipe_name (crtc->pipe), sprite0_start, sprite1_start, fifo_size); +spin_lock (&dev_priv->wm.dsparb_lock); +switch (crtc->pipe) {uint32_t dsparb, dsparb2, dsparb3;case PIPE_A :@@ -1271,6 +1273,10 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)default :break ; } + +POSTING_READ (DSPARB ); + +spin_unlock (&dev_priv->wm.dsparb_lock); }#undef VLV_FIFO
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 11/15 drm/i915: Protect DSPARB registers with a spinlock
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
We'll use a new spinlock for this instead of the wm_mutex since we'll have to move the DSPARB programming to happen from the vblank evade critical section, and we can't use mutexes in there.
v2: Document why we use a spinlock instead of a mutex (Maarten)
--- drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 3 +++ drivers/gpu/drm/i915/intel_pm.c | 6 ++++++ 3 files changed, 10 insertions(+)
drivers/gpu/drm/i915/i915_drv.c +1 -0
@@ -811,6 +811,7 @@ static int i915_driver_init_early(struct drm_i915_private *dev_priv,spin_lock_init (&dev_priv->uncore.lock);spin_lock_init (&dev_priv->mm.object_stat_lock);spin_lock_init (&dev_priv->mmio_flip_lock); +spin_lock_init (&dev_priv->wm.dsparb_lock);mutex_init (&dev_priv->sb_lock);mutex_init (&dev_priv->modeset_restore_lock);mutex_init (&dev_priv->av_mutex);
drivers/gpu/drm/i915/i915_drv.h +3 -0
@@ -2169,6 +2169,9 @@ struct drm_i915_private { } sagv_status;struct { +/* protects DSPARB registers on pre-g4x/vlv/chv */ +spinlock_t dsparb_lock; +/* * Raw watermark latency values: * in 0.1us units for WM0,
drivers/gpu/drm/i915/intel_pm.c +6 -0
@@ -1215,6 +1215,8 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)pipe_name (crtc->pipe), sprite0_start, sprite1_start, fifo_size); +spin_lock (&dev_priv->wm.dsparb_lock); +switch (crtc->pipe) {uint32_t dsparb, dsparb2, dsparb3;case PIPE_A :
@@ -1271,6 +1273,10 @@ static void vlv_pipe_set_fifo_size(struct intel_crtc *crtc)default :break ; } + +POSTING_READ (DSPARB ); + +spin_unlock (&dev_priv->wm.dsparb_lock); }#undef VLV_FIFO
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 11/15] drm/i915: Protect DSPARB registers with a spinlock
Op 05-12-16 om 15:13 schreef [email protected]:
Quoted 7 lines
From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
Quoted 8 lines
We'll use a new spinlock for this instead of the
wm_mutexsince we'll have to move the DSPARB programming to happen from the vblank evade critical section, and we can't use mutexes in there.v2: Document why we use a spinlock instead of a mutex (Maarten)
Cc Maarten Lankhorst <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH v2 11/15] drm/i915: Protect DSPARB registers with a spinlock
Quoted 12 lines · Maarten Lankhorst
Op 05-12-16 om 15:13 schreef [email protected]:
Quoted 11 lines
From: Ville Syrjälä <[email protected]>
Each DSPARB register can house bits for two separate pipes, hence we must protect the registers during reprogramming so that parallel FIFO reconfigurations happening simultaneosly on multiple pipes won't corrupt each others values.
We'll use a new spinlock for this instead of the
wm_mutexsince we'll have to move the DSPARB programming to happen from the vblank evade critical section, and we can't use mutexes in there.
Quoted 5 lines
Quoted 4 lines
v2: Document why we use a spinlock instead of a mutex (Maarten)
Cc Maarten Lankhorst <[email protected]>Signed-off-by Ville Syrjälä <[email protected]>Reviewed-by Maarten Lankhorst <[email protected]>
Thanks. Pushed to dinq.
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 12/15 drm/i915: Zero out HOWM registers before writing new WM/HOWM register values
In reply to [email protected]From: Ville Syrjälä <[email protected]>
On VLV/CHV some of the watermark values are split across two registers:
low order bits in one, and high order bits in another. So we may not be able to update a single watermark value atomically, and thus we must be careful that we don't temporarily introduce out of bounds values during the reprogramming. To prevent this we can simply zero out all the high order bits initially, then we update the low order bits, and finally we update the high order bits with the final value.
--- drivers/gpu/drm/i915/intel_pm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +11 -6
@@ -877,6 +877,17 @@ static void vlv_write_wm_values(struct intel_crtc *crtc, (wm->ddl[pipe].plane[PLANE_SPRITE0 ] <<DDL_SPRITE_SHIFT (0 )) | (wm->ddl[pipe].plane[PLANE_PRIMARY] << DDL_PLANE_SHIFT)); +/* +* Zero the (unused) WM1 watermarks, and also clear all the +* high order bits so that there are no out of bounds values +* present in the registers during the reprogramming. +*/ +I915_WRITE (DSPHOWM ,0 ); +I915_WRITE (DSPHOWM1 ,0 ); +I915_WRITE (DSPFW4 ,0 ); +I915_WRITE (DSPFW5 ,0 ); +I915_WRITE (DSPFW6 ,0 ); + I915_WRITE(DSPFW1, FW_WM(wm->sr.plane, SR) | FW_WM(wm->pipe[PIPE_B].plane[PLANE_CURSOR], CURSORB) |
@@ -924,12 +935,6 @@ static void vlv_write_wm_values(struct intel_crtc *crtc, FW_WM(wm->pipe[PIPE_A].plane[PLANE_PRIMARY] >> 8, PLANEA_HI)); } -/* zero (unused) WM1 watermarks */ -I915_WRITE (DSPFW4 ,0 ); -I915_WRITE (DSPFW5 ,0 ); -I915_WRITE (DSPFW6 ,0 ); -I915_WRITE (DSPHOWM1 ,0 ); -POSTING_READ (DSPFW1 ); }
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/15] drm/i915: Zero out HOWM registers before writing new WM/HOWM register values
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 23 lines
From: Ville Syrjälä <[email protected]>
On VLV/CHV some of the watermark values are split across two registers:
low order bits in one, and high order bits in another. So we may not be able to update a single watermark value atomically, and thus we must be careful that we don't temporarily introduce out of bounds values during the reprogramming. To prevent this we can simply zero out all the high order bits initially, then we update the low order bits, and finally we update the high order bits with the final value.Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -877,6 +877,17 @@ static void vlv_write_wm_values(struct intel_crtc *crtc, (wm->ddl[pipe].plane[PLANE_SPRITE0 ] <<DDL_SPRITE_SHIFT (0 )) | (wm->ddl[pipe].plane[PLANE_PRIMARY] << DDL_PLANE_SHIFT));
drivers/gpu/drm/i915/intel_pm.c static void vlv_write_wm_values(struct intel_crtc *crtc, · line 889
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+/* +* Zero the (unused) WM1 watermarks, and also clear all the +* high order bits so that there are no out of bounds values +* present in the registers during the reprogramming. +*/ +I915_WRITE (DSPHOWM ,0 ); +I915_WRITE (DSPHOWM1 ,0 ); +I915_WRITE (DSPFW4 ,0 ); +I915_WRITE (DSPFW5 ,0 ); +I915_WRITE (DSPFW6 ,0 );
Watermarks for DSPHOWM are inverted right? And lower values just mean more wakeups? Should be harmless then.
Quoted 6 lines
drivers/gpu/drm/i915/intel_pm.c +0
-0I915_WRITE(DSPFW1, FW_WM(wm->sr.plane, SR) | FW_WM(wm->pipe[PIPE_B].plane[PLANE_CURSOR], CURSORB) |@@ -924,12 +935,6 @@ static void vlv_write_wm_values(struct intel_crtc *crtc, FW_WM(wm->pipe[PIPE_A].plane[PLANE_PRIMARY] >> 8, PLANEA_HI)); }
drivers/gpu/drm/i915/intel_pm.c static void vlv_write_wm_values(struct intel_crtc *crtc, · line 940
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +0
-6-/* zero (unused) WM1 watermarks */ -I915_WRITE (DSPFW4 ,0 ); -I915_WRITE (DSPFW5 ,0 ); -I915_WRITE (DSPFW6 ,0 ); -I915_WRITE (DSPHOWM1 ,0 ); -POSTING_READ (DSPFW1 ); }
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 12/15] drm/i915: Zero out HOWM registers before writing new WM/HOWM register values
Quoted 24 lines · Maarten Lankhorst
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 23 lines
From: Ville Syrjälä <[email protected]>
On VLV/CHV some of the watermark values are split across two registers:
low order bits in one, and high order bits in another. So we may not be able to update a single watermark value atomically, and thus we must be careful that we don't temporarily introduce out of bounds values during the reprogramming. To prevent this we can simply zero out all the high order bits initially, then we update the low order bits, and finally we update the high order bits with the final value.Signed-off-by Ville Syrjälä <[email protected]>--- drivers/gpu/drm/i915/intel_pm.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_pm.c +0
-0@@ -877,6 +877,17 @@ static void vlv_write_wm_values(struct intel_crtc *crtc, (wm->ddl[pipe].plane[PLANE_SPRITE0 ] <<DDL_SPRITE_SHIFT (0 )) | (wm->ddl[pipe].plane[PLANE_PRIMARY] << DDL_PLANE_SHIFT));
Quoted 11 lines
drivers/gpu/drm/i915/intel_pm.c static void vlv_write_wm_values(struct intel_crtc *crtc, · line 889
Quoted 10 lines
drivers/gpu/drm/i915/intel_pm.c +10
-0+/* +* Zero the (unused) WM1 watermarks, and also clear all the +* high order bits so that there are no out of bounds values +* present in the registers during the reprogramming. +*/ +I915_WRITE (DSPHOWM ,0 ); +I915_WRITE (DSPHOWM1 ,0 ); +I915_WRITE (DSPFW4 ,0 ); +I915_WRITE (DSPFW5 ,0 ); +I915_WRITE (DSPFW6 ,0 );Watermarks for DSPHOWM are inverted right? And lower values just mean more wakeups?
Yes, it's all inverted.
Quoted 20 lines
Should be harmless then.
Reviewed-by Maarten Lankhorst <[email protected]>Quoted 16 lines
drivers/gpu/drm/i915/intel_pm.c +0
-6I915_WRITE(DSPFW1, FW_WM(wm->sr.plane, SR) | FW_WM(wm->pipe[PIPE_B].plane[PLANE_CURSOR], CURSORB) |@@ -924,12 +935,6 @@ static void vlv_write_wm_values(struct intel_crtc *crtc, FW_WM(wm->pipe[PIPE_A].plane[PLANE_PRIMARY] >> 8, PLANEA_HI)); } -/* zero (unused) WM1 watermarks */ -I915_WRITE (DSPFW4 ,0 ); -I915_WRITE (DSPFW5 ,0 ); -I915_WRITE (DSPFW6 ,0 ); -I915_WRITE (DSPHOWM1 ,0 ); -POSTING_READ (DSPFW1 ); }
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 13/15 drm/i915: Write all DDL registers in one go
In reply to [email protected]From: Ville Syrjälä <[email protected]>
We'll want to decouple the vlv/chv wm register reprogramming from any single pipe. So let's just write all the DDL registers in one go. We already write all the wm registers anyway since the bits are sprinkled all over the place and so writing them for just a single pipe would have been too messy anyway.
--- drivers/gpu/drm/i915/intel_pm.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +10 -9
@@ -865,17 +865,18 @@ static bool g4x_compute_srwm(struct drm_i915_private *dev_priv,#define FW_WM_VLV (value, plane) \ (((value) << DSPFW_ ## plane ## _SHIFT) & DSPFW_ ## plane ## _MASK_VLV) -static void vlv_write_wm_values (struct intel_crtc *crtc, +static void vlv_write_wm_values (struct drm_i915_private *dev_priv,const struct vlv_wm_values *wm) { -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -enum pipe pipe = crtc->pipe; +enum pipe pipe; -I915_WRITE (VLV_DDL (pipe), - (wm->ddl[pipe].plane[PLANE_CURSOR ] <<DDL_CURSOR_SHIFT ) | - (wm->ddl[pipe].plane[PLANE_SPRITE1 ] <<DDL_SPRITE_SHIFT (1 )) | - (wm->ddl[pipe].plane[PLANE_SPRITE0 ] <<DDL_SPRITE_SHIFT (0 )) | - (wm->ddl[pipe].plane[PLANE_PRIMARY ] <<DDL_PLANE_SHIFT )); +for_each_pipe (dev_priv, pipe) { +I915_WRITE (VLV_DDL (pipe), + (wm->ddl[pipe].plane[PLANE_CURSOR ] <<DDL_CURSOR_SHIFT ) | + (wm->ddl[pipe].plane[PLANE_SPRITE1 ] <<DDL_SPRITE_SHIFT (1 )) | + (wm->ddl[pipe].plane[PLANE_SPRITE0 ] <<DDL_SPRITE_SHIFT (0 )) | + (wm->ddl[pipe].plane[PLANE_PRIMARY ] <<DDL_PLANE_SHIFT )); + }/* * Zero the (unused) WM1 watermarks, and also clear all the
@@ -1361,7 +1362,7 @@ static void vlv_update_wm(struct intel_crtc *crtc)/* FIXME should be part of crtc atomic commit */ vlv_pipe_set_fifo_size (crtc); -vlv_write_wm_values (crtc, &wm); +vlv_write_wm_values (dev_priv, &wm); DRM_DEBUG_KMS("Setting FIFO watermarks - %c: plane=%d, cursor=%d, " "sprite0=%d, sprite1=%d, SR: plane=%d, cursor=%d level=%d cxsr=%d\n",
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 14/15 drm/i915: Clean up vlv_program_watermarks()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Add small helpers to make the intent of the staggered enable/disable sequence in vlv_program_watermarks() easier on the eyes.
--- drivers/gpu/drm/i915/intel_pm.c | 44 ++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +26 -18
@@ -1333,55 +1333,63 @@ static void vlv_merge_wm(struct drm_i915_private *dev_priv, } } +static bool is_disabling (int old,int new,int threshold) +{ +return old >= threshold && new < threshold; +} + +static bool is_enabling (int old,int new,int threshold) +{ +return old < threshold && new >= threshold; +} +static void vlv_update_wm (struct intel_crtc *crtc) {struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);enum pipe pipe = crtc->pipe; -struct vlv_wm_values wm = {}; +struct vlv_wm_values *old_wm = &dev_priv->wm.vlv; +struct vlv_wm_values new_wm = {};vlv_compute_wm (crtc); -vlv_merge_wm (dev_priv, &wm); +vlv_merge_wm (dev_priv, &new_wm); -if (memcmp (&dev_priv->wm.vlv, &wm,sizeof (wm)) ==0 ) { +if (memcmp (old_wm, &new_wm,sizeof (new_wm)) ==0 ) {/* FIXME should be part of crtc atomic commit */ vlv_pipe_set_fifo_size (crtc); +return ; } -if (wm.level <VLV_WM_LEVEL_DDR_DVFS && - dev_priv->wm.vlv.level >=VLV_WM_LEVEL_DDR_DVFS ) +if (is_disabling (old_wm->level, new_wm.level,VLV_WM_LEVEL_DDR_DVFS ))chv_set_memory_dvfs (dev_priv, false); -if (wm.level <VLV_WM_LEVEL_PM5 && - dev_priv->wm.vlv.level >=VLV_WM_LEVEL_PM5 ) +if (is_disabling (old_wm->level, new_wm.level,VLV_WM_LEVEL_PM5 ))chv_set_memory_pm5 (dev_priv, false); -if (!wm.cxsr && dev_priv->wm.vlv.cxsr) +if (is_disabling (old_wm->cxsr, new_wm.cxsr, true))_intel_set_memory_cxsr (dev_priv, false);/* FIXME should be part of crtc atomic commit */ vlv_pipe_set_fifo_size (crtc); -vlv_write_wm_values (dev_priv, &wm); +vlv_write_wm_values (dev_priv, &new_wm);DRM_DEBUG_KMS ("Setting FIFO watermarks - %c: plane=%d, cursor=%d, " "sprite0=%d, sprite1=%d, SR: plane=%d, cursor=%d level=%d cxsr=%d\n" , -pipe_name (pipe), wm.pipe[pipe].plane[PLANE_PRIMARY ], wm.pipe[pipe].plane[PLANE_CURSOR ], - wm.pipe[pipe].plane[PLANE_SPRITE0 ], wm.pipe[pipe].plane[PLANE_SPRITE1 ], - wm.sr.plane, wm.sr.cursor, wm.level, wm.cxsr); +pipe_name (pipe), new_wm.pipe[pipe].plane[PLANE_PRIMARY ], new_wm.pipe[pipe].plane[PLANE_CURSOR ], + new_wm.pipe[pipe].plane[PLANE_SPRITE0 ], new_wm.pipe[pipe].plane[PLANE_SPRITE1 ], + new_wm.sr.plane, new_wm.sr.cursor, new_wm.level, new_wm.cxsr); -if (wm.cxsr && !dev_priv->wm.vlv.cxsr) +if (is_enabling (old_wm->cxsr, new_wm.cxsr, true))_intel_set_memory_cxsr (dev_priv, true); -if (wm.level >=VLV_WM_LEVEL_PM5 && - dev_priv->wm.vlv.level <VLV_WM_LEVEL_PM5 ) +if (is_enabling (old_wm->level, new_wm.level,VLV_WM_LEVEL_PM5 ))chv_set_memory_pm5 (dev_priv, true); -if (wm.level >=VLV_WM_LEVEL_DDR_DVFS && - dev_priv->wm.vlv.level <VLV_WM_LEVEL_DDR_DVFS ) +if (is_enabling (old_wm->level, new_wm.level,VLV_WM_LEVEL_DDR_DVFS ))chv_set_memory_dvfs (dev_priv, true); - dev_priv->wm.vlv = wm; + *old_wm = new_wm; }#define single_plane_enabled (mask) is_power_of_2(mask)
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 15/15 drm/i915: Pass crtc state to vlv_compute_wm_level()
In reply to [email protected]From: Ville Syrjälä <[email protected]>
Rather than accessing crtc->config in vlv_compute_wm_level() let's pass in the crtc state explicitly. One step closer to atomic.
--- drivers/gpu/drm/i915/intel_pm.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_pm.c +11 -9
@@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct drm_i915_private *dev_priv) } } -static uint16_t vlv_compute_wm_level (struct intel_plane *plane, -struct intel_crtc *crtc, -const struct intel_plane_state *state, +static uint16_t vlv_compute_wm_level (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state,int level) { +struct intel_plane *plane =to_intel_plane (plane_state->base.plane);struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int clock, htotal, cpp, width, wm;if (dev_priv->wm.pri_latency[level] ==0 )return USHRT_MAX ; -if (!state->base.visible) +if (!plane_state->base.visible)return 0 ; - cpp =drm_format_plane_cpp (state->base.fb->pixel_format,0 ); - clock = crtc->config->base.adjusted_mode.crtc_clock; - htotal = crtc->config->base.adjusted_mode.crtc_htotal; - width = crtc->config->pipe_src_w; + cpp =drm_format_plane_cpp (plane_state->base.fb->pixel_format,0 ); + clock = adjusted_mode->crtc_clock; + htotal = adjusted_mode->crtc_htotal; + width = crtc_state->pipe_src_w;if (WARN_ON (htotal ==0 )) htotal =1 ;
@@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)/* normal watermarks */ for (level =0 ; level < wm_state->num_levels; level++) { -int wm =vlv_compute_wm_level (plane, crtc, state, level); +int wm =vlv_compute_wm_level (crtc->config, state, level);int max_wm = plane->wm.fifo_size;/* hack */
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 6 lines
From: Ville Syrjälä <[email protected]>
Rather than accessing
crtc->configinvlv_compute_wm_level()let's pass in the crtc state explicitly. One step closer to atomic.Signed-off-by Ville Syrjälä <[email protected]>
Yay. All users of intel_crtc->config have to die in the future, but this is temporarily a legit use for it.
For patch 13, 14 and 15
Quoted 43 lines
drivers/gpu/drm/i915/intel_pm.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/intel_pm.c +10
-8@@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct drm_i915_private *dev_priv) } } -static uint16_t vlv_compute_wm_level (struct intel_plane *plane, -struct intel_crtc *crtc, -const struct intel_plane_state *state, +static uint16_t vlv_compute_wm_level (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state,int level) { +struct intel_plane *plane =to_intel_plane (plane_state->base.plane);struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int clock, htotal, cpp, width, wm;if (dev_priv->wm.pri_latency[level] ==0 )return USHRT_MAX ; -if (!state->base.visible) +if (!plane_state->base.visible)return 0 ; - cpp =drm_format_plane_cpp (state->base.fb->pixel_format,0 ); - clock = crtc->config->base.adjusted_mode.crtc_clock; - htotal = crtc->config->base.adjusted_mode.crtc_htotal; - width = crtc->config->pipe_src_w; + cpp =drm_format_plane_cpp (plane_state->base.fb->pixel_format,0 ); + clock = adjusted_mode->crtc_clock; + htotal = adjusted_mode->crtc_htotal; + width = crtc_state->pipe_src_w;if (WARN_ON (htotal ==0 )) htotal =1 ;
drivers/gpu/drm/i915/intel_pm.c static void vlv_compute_wm(struct intel_crtc *crtc) · line 1153
Quoted 8 lines
drivers/gpu/drm/i915/intel_pm.c +1
-1@@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)/* normal watermarks */ for (level =0 ; level < wm_state->num_levels; level++) { -int wm =vlv_compute_wm_level (plane, crtc, state, level); +int wm =vlv_compute_wm_level (crtc->config, state, level);int max_wm = plane->wm.fifo_size;/* hack */
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()
Quoted 64 lines · Maarten Lankhorst
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 6 lines
From: Ville Syrjälä <[email protected]>
Rather than accessing
crtc->configinvlv_compute_wm_level()let's pass in the crtc state explicitly. One step closer to atomic.Signed-off-by Ville Syrjälä <[email protected]>Yay. All users of
intel_crtc->confighave to die in the future, but this is temporarily a legit use for it.For patch 13, 14 and 15
Reviewed-by Maarten Lankhorst <[email protected]>Quoted 51 lines
drivers/gpu/drm/i915/intel_pm.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/intel_pm.c +11
-9@@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct drm_i915_private *dev_priv) } } -static uint16_t vlv_compute_wm_level (struct intel_plane *plane, -struct intel_crtc *crtc, -const struct intel_plane_state *state, +static uint16_t vlv_compute_wm_level (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state,int level) { +struct intel_plane *plane =to_intel_plane (plane_state->base.plane);struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int clock, htotal, cpp, width, wm;if (dev_priv->wm.pri_latency[level] ==0 )return USHRT_MAX ; -if (!state->base.visible) +if (!plane_state->base.visible)return 0 ; - cpp =drm_format_plane_cpp (state->base.fb->pixel_format,0 ); - clock = crtc->config->base.adjusted_mode.crtc_clock; - htotal = crtc->config->base.adjusted_mode.crtc_htotal; - width = crtc->config->pipe_src_w; + cpp =drm_format_plane_cpp (plane_state->base.fb->pixel_format,0 ); + clock = adjusted_mode->crtc_clock; + htotal = adjusted_mode->crtc_htotal; + width = crtc_state->pipe_src_w;if (WARN_ON (htotal ==0 )) htotal =1 ;@@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)/* normal watermarks */ for (level =0 ; level < wm_state->num_levels; level++) { -int wm =vlv_compute_wm_level (plane, crtc, state, level); +int wm =vlv_compute_wm_level (crtc->config, state, level);int max_wm = plane->wm.fifo_size;/* hack */
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()
In reply to Maarten LankhorstQuoted 8 lines · Maarten Lankhorst
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 6 lines
From: Ville Syrjälä <[email protected]>
Rather than accessing
crtc->configinvlv_compute_wm_level()let's pass in the crtc state explicitly. One step closer to atomic.Signed-off-by Ville Syrjälä <[email protected]>Yay. All users of
intel_crtc->confighave to die in the future, but this is temporarily a legit use for it.
Pardon the stray reply earlier. What I wanted to say was that I was playing around with coccinelle a bit the other night, and managed to trick it into a little bit of crtc->config killing. I think I'll try to expand my efforts there a bit more before posting the stuff though.
Quoted 56 lines
For patch 13, 14 and 15
Reviewed-by Maarten Lankhorst <[email protected]>Quoted 51 lines
drivers/gpu/drm/i915/intel_pm.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)drivers/gpu/drm/i915/intel_pm.c +11
-9@@ -978,24 +978,26 @@ static void vlv_setup_wm_latency(struct drm_i915_private *dev_priv) } } -static uint16_t vlv_compute_wm_level (struct intel_plane *plane, -struct intel_crtc *crtc, -const struct intel_plane_state *state, +static uint16_t vlv_compute_wm_level (const struct intel_crtc_state *crtc_state, +const struct intel_plane_state *plane_state,int level) { +struct intel_plane *plane =to_intel_plane (plane_state->base.plane);struct drm_i915_private *dev_priv =to_i915 (plane->base.dev); +const struct drm_display_mode *adjusted_mode = + &crtc_state->base.adjusted_mode;int clock, htotal, cpp, width, wm;if (dev_priv->wm.pri_latency[level] ==0 )return USHRT_MAX ; -if (!state->base.visible) +if (!plane_state->base.visible)return 0 ; - cpp =drm_format_plane_cpp (state->base.fb->pixel_format,0 ); - clock = crtc->config->base.adjusted_mode.crtc_clock; - htotal = crtc->config->base.adjusted_mode.crtc_htotal; - width = crtc->config->pipe_src_w; + cpp =drm_format_plane_cpp (plane_state->base.fb->pixel_format,0 ); + clock = adjusted_mode->crtc_clock; + htotal = adjusted_mode->crtc_htotal; + width = crtc_state->pipe_src_w;if (WARN_ON (htotal ==0 )) htotal =1 ;@@ -1145,7 +1147,7 @@ static void vlv_compute_wm(struct intel_crtc *crtc)/* normal watermarks */ for (level =0 ; level < wm_state->num_levels; level++) { -int wm =vlv_compute_wm_level (plane, crtc, state, level); +int wm =vlv_compute_wm_level (crtc->config, state, level);int max_wm = plane->wm.fifo_size;/* hack */
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 15/15] drm/i915: Pass crtc state to vlv_compute_wm_level()
Hey,
Op 02-12-16 om 14:07 schreef Ville Syrjälä:
Quoted 7 lines · Maarten Lankhorst
Quoted 6 lines
Op 28-11-16 om 18:37 schreef [email protected]:
Quoted 5 lines
From: Ville Syrjälä <[email protected]>
Rather than accessing
crtc->configinvlv_compute_wm_level()let's pass in the crtc state explicitly. One step closer to atomic.
Quoted 7 lines
Quoted 2 lines
Quoted 1 line
Signed-off-by Ville Syrjälä <[email protected]>Yay. All users of
intel_crtc->confighave to die in the future, but this is temporarily a legit use for it.Pardon the stray reply earlier. What I wanted to say was that I was playing around with coccinelle a bit the other night, and managed to trick it into a little bit of
crtc->configkilling. I think I'll try to expand my efforts there a bit more before posting the stuff though.
Don't worry about it, most of them have to be audited to make sure that the right crtc_state passed in is used. It shouldn't blindly be used to convert to crtc->state. I did some of the more tricky conversions in my nightly branch. https://cgit.freedesktop.org/~mlankhorst/linux/log/?h=nightly
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: VLV/CHV atomic wm prep work
In reply to [email protected]== Series Details ==
== Series Details ==
Series: drm/i915: VLV/CHV atomic wm prep work
URL : https://patchwork.freedesktop.org/series/16049/
State : success
== Summary ==
Series 16049v1 drm/i915: VLV/CHV atomic wm prep work
https://patchwork.freedesktop.org/api/1.0/series/16049/revisions/1/mbox/
fi-bdw-5557u total:245 pass:230 dwarn:0 dfail:0 fail:0 skip:15 fi-bxt-t5700 total:245 pass:217 dwarn:0 dfail:0 fail:0 skip:28 fi-ilk-650 total:245 pass:192 dwarn:0 dfail:0 fail:0 skip:53 fi-skl-6260u total:245 pass:231 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:245 pass:224 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:245 pass:223 dwarn:1 dfail:0 fail:0 skip:21
477cc06f6ef4842fd63e28ff30d721462af199a6 drm-tip: 2016y-11m-28d-16h-17m-39s UTC integration manifest 88f6419 drm/i915: Pass crtc state to vlv_compute_wm_level()
1eefb43 drm/i915: Clean up vlv_program_watermarks()
64e5d5f drm/i915: Write all DDL registers in one go
eb21519 drm/i915: Zero out HOWM registers before writing new WM/HOWM register values 504910a drm/i915: Protect DSPARB registers with a spinlockbcd7ce2b drm/i915: Skip vblank wait if cxsr was already off
1f7b10b drm/i915: Protect cxsr state with wm_mutex
4a4a8e8 drm/i915: Pass around dev_priv in vlv wm functions
929c00f drm/i915: Introduce vlv_invert_wm_value()
7c0bdea drm/i915: Organize vlv/chv watermarks by plane_id
4c71fb0 drm/i915: Remove duplicated wm setup for vlv and chv
132b000 drm/i915: Clean up VLV/CHV maxfifo watermark setup
d39eaac drm/i915: Fix the level 0 max_wm hack on VLV/CHV
a96b9e0 drm/i915: Use the ilk_disable_lp_wm() return value
1116ef3 drm/i915: Drop the nop intel_update_watermarks() call from haswell_crtc_enable()
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3129/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915: VLV/CHV atomic wm prep work
In reply to [email protected]== Series Details ==
== Series Details ==
Series: drm/i915: VLV/CHV atomic wm prep work
URL : https://patchwork.freedesktop.org/series/16049/
State : success
== Summary ==
Series 16049v1 drm/i915: VLV/CHV atomic wm prep work
https://patchwork.freedesktop.org/api/1.0/series/16049/revisions/1/mbox/
fi-bdw-5557u total:245 pass:230 dwarn:0 dfail:0 fail:0 skip:15 fi-bsw-n3050 total:245 pass:205 dwarn:0 dfail:0 fail:0 skip:40 fi-byt-j1900 total:245 pass:217 dwarn:0 dfail:0 fail:0 skip:28 fi-byt-n2820 total:245 pass:213 dwarn:0 dfail:0 fail:0 skip:32 fi-hsw-4770 total:245 pass:225 dwarn:0 dfail:0 fail:0 skip:20 fi-hsw-4770r total:245 pass:225 dwarn:0 dfail:0 fail:0 skip:20 fi-ilk-650 total:245 pass:192 dwarn:0 dfail:0 fail:0 skip:53 fi-ivb-3520m total:245 pass:223 dwarn:0 dfail:0 fail:0 skip:22 fi-ivb-3770 total:245 pass:223 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-7500u total:245 pass:223 dwarn:0 dfail:0 fail:0 skip:22 fi-skl-6260u total:245 pass:231 dwarn:0 dfail:0 fail:0 skip:14 fi-skl-6700hq total:245 pass:224 dwarn:0 dfail:0 fail:0 skip:21 fi-skl-6700k total:245 pass:223 dwarn:1 dfail:0 fail:0 skip:21 fi-skl-6770hq total:245 pass:231 dwarn:0 dfail:0 fail:0 skip:14 fi-snb-2520m total:245 pass:213 dwarn:0 dfail:0 fail:0 skip:32 fi-snb-2600 total:245 pass:212 dwarn:0 dfail:0 fail:0 skip:33
bf8dfcdb45998f470c39ea7b89412a2edbd069db drm-tip: 2016y-11m-29d-09h-31m-06s UTC integration manifest c43a650 drm/i915: Pass crtc state to vlv_compute_wm_level()
cb4a7f1 drm/i915: Clean up vlv_program_watermarks()
e08c64e drm/i915: Write all DDL registers in one go
416759c drm/i915: Zero out HOWM registers before writing new WM/HOWM register values a5970d8 drm/i915: Protect DSPARB registers with a spinlock
cec33e4 drm/i915: Skip vblank wait if cxsr was already off
e8ab9b6 drm/i915: Protect cxsr state with wm_mutex
25e6b89 drm/i915: Pass around dev_priv in vlv wm functions
1371815 drm/i915: Introduce vlv_invert_wm_value()
908d4aa drm/i915: Organize vlv/chv watermarks by plane_id
4b3c888 drm/i915: Remove duplicated wm setup for vlv and chv
3560754 drm/i915: Clean up VLV/CHV maxfifo watermark setup
00f47ab drm/i915: Fix the level 0 max_wm hack on VLV/CHV
2cfcc52 drm/i915: Use the ilk_disable_lp_wm() return value
a48708a drm/i915: Drop the nop intel_update_watermarks() call from haswell_crtc_enable()
== Logs ==
For more details see: https://intel-gfx-ci.01.org/CI/Patchwork_3136/
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 18 lines · On Mon, Nov 28, 2016 at 07:37:02PM +0200, [email protected] wrote:
From: Ville Syrjälä <[email protected]>
A decent pile of prep work split off from my VLV/CHV atomic watermark work. Mostly VLV/CHV specific stuff, but there are a few small things in there that touch other platforms as well.
Entire series available here:
git://github.com/vsyrjala/linux.gitvlv_atomic_wm_prepVille Syrjälä (15):
drm/i915: Drop the nopintel_update_watermarks()call from
haswell_crtc_enable()
drm/i915: Use theilk_disable_lp_wm()return value drm/i915: Fix the level 0max_wmhack on VLV/CHV drm/i915: Clean up VLV/CHV maxfifo watermark setup drm/i915: Remove duplicated wm setup for vlv and chv drm/i915: Organize vlv/chv watermarks byplane_iddrm/i915: Introducevlv_invert_wm_value()
Quoted 8 lines
drm/i915: Pass around
dev_privin vlv wm functions drm/i915: Protect cxsr state withwm_mutex
drm/i915: Skip vblank wait if cxsr was already off drm/i915: Zero out HOWM registers before writing new WM/HOWM register
values
drm/i915: Write all DDL registers in one go
drm/i915: Clean upvlv_program_watermarks()
drm/i915: Pass crtc state tovlv_compute_wm_level()
Pushed all of the above to dinq. Thanks for the reviews.
Quoted 1 line
drm/i915: Protect DSPARB registers with a spinlock
Sent out a v2 of this one, with an amended commit msg.
Quoted 9 lines
drivers/gpu/drm/i915/i915_drv.c | 1 + drivers/gpu/drm/i915/i915_drv.h | 21 +- drivers/gpu/drm/i915/intel_display.c | 21 +- drivers/gpu/drm/i915/intel_pm.c | 394 ++++++++++++++++++----------------- 4 files changed, 218 insertions(+), 219 deletions(-)Signature · 1 line
2.7.4
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx