drm/i915/skl: Don't try to update plane watermarks if they haven't changed
Subsystems (2)
PATCH 1/1 drm/i915/skl: Don't try to update plane watermarks if they haven't changed
i915 sometimes needs to disable planes in the middle of an atomic commit, and then reenable them later in the same commit. Because of this, we can't make the assumption that the state of the plane actually changed. Since the state of the plane hasn't actually changed, neither have it's watermarks. And if the watermarks hasn't changed then we haven't populated skl_results with anything, which means we'll end up zeroing out a plane's watermarks in the middle of the atomic commit without restoring them later.
Changes since v1:
- Fix incorrect use of "it's"
during plane updates")
--- drivers/gpu/drm/i915/intel_display.c | 7 ++++++- drivers/gpu/drm/i915/intel_sprite.c | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -1
@@ -3448,7 +3448,12 @@ static void skylake_disable_primary_plane(struct drm_plane *primary,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; -skl_write_plane_wm (intel_crtc, &dev_priv->wm.skl_results,0 ); +/* +* We only populate skl_results on watermark updates, and if the +* plane's visiblity isn't actually changing neither is its watermarks. +*/ +if (!crtc->primary->state->visible) +skl_write_plane_wm (intel_crtc, &dev_priv->wm.skl_results,0 );I915_WRITE (PLANE_CTL (pipe,0 ),0 );I915_WRITE (PLANE_SURF (pipe,0 ),0 );
drivers/gpu/drm/i915/intel_sprite.c +7 -2
@@ -292,8 +292,13 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)const int pipe = intel_plane->pipe;const int plane = intel_plane->plane +1 ; -skl_write_plane_wm (to_intel_crtc (crtc), &dev_priv->wm.skl_results, - plane); +/* +* We only populate skl_results on watermark updates, and if the +* plane's visiblity isn't actually changing neither is its watermarks. +*/ +if (!dplane->state->visible) +skl_write_plane_wm (to_intel_crtc (crtc), + &dev_priv->wm.skl_results, plane);I915_WRITE (PLANE_CTL (pipe, plane),0 );
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula
maintainerQuoted 8 lines · Lyude
i915 sometimes needs to disable planes in the middle of an atomic commit, and then reenable them later in the same commit. Because of this, we can't make the assumption that the state of the plane actually changed. Since the state of the plane hasn't actually changed, neither have it's watermarks. And if the watermarks hasn't changed then we haven't populated
skl_resultswith anything, which means we'll end up zeroing out a plane's watermarks in the middle of the atomic commit without restoring them later.
I would appreciate a (brief) description of what the failure mode is in this case.
BR,
Jani.
Quoted 52 lines
Changes since v1:
- Fix incorrect use of "it's"Signed-off-by Lyude <[email protected]>Cc Maarten Lankhorst <[email protected]>Fixes 62e0fb880123 ("drm/i915/skl: Update plane watermarks atomicallyduring plane updates")
Signed-off-by Lyude <[email protected]>--- drivers/gpu/drm/i915/intel_display.c | 7 ++++++- drivers/gpu/drm/i915/intel_sprite.c | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_display.c +6
-1@@ -3448,7 +3448,12 @@ static void skylake_disable_primary_plane(struct drm_plane *primary,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; -skl_write_plane_wm (intel_crtc, &dev_priv->wm.skl_results,0 ); +/* +* We only populate skl_results on watermark updates, and if the +* plane's visiblity isn't actually changing neither is its watermarks. +*/ +if (!crtc->primary->state->visible) +skl_write_plane_wm (intel_crtc, &dev_priv->wm.skl_results,0 );I915_WRITE (PLANE_CTL (pipe,0 ),0 );I915_WRITE (PLANE_SURF (pipe,0 ),0 );drivers/gpu/drm/i915/intel_sprite.c +7
-2@@ -292,8 +292,13 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)const int pipe = intel_plane->pipe;const int plane = intel_plane->plane +1 ; -skl_write_plane_wm (to_intel_crtc (crtc), &dev_priv->wm.skl_results, - plane); +/* +* We only populate skl_results on watermark updates, and if the +* plane's visiblity isn't actually changing neither is its watermarks. +*/ +if (!dplane->state->visible) +skl_write_plane_wm (to_intel_crtc (crtc), + &dev_priv->wm.skl_results, plane);I915_WRITE (PLANE_CTL (pipe, plane),0 );
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v3 1/1 drm/i915/skl: Don't try to update plane watermarks if they haven't changed
i915 sometimes needs to disable planes in the middle of an atomic commit, and then reenable them later in the same commit. Because of this, we can't make the assumption that the state of the plane actually changed. Since the state of the plane hasn't actually changed, neither have it's watermarks. And if the watermarks hasn't changed then we haven't populated skl_results with anything, which means we'll end up zeroing out a plane's watermarks in the middle of the atomic commit without restoring them later.
Simple reproduction recipe:
- Get a SKL laptop, launch any kind of X session
- Get two extra monitors
- Keep hotplugging both displays (so that the display configuration jumps from 1 active pipe to 3 active pipes and back)
- Eventually underrun
Changes since v1:
- Fix incorrect use of "it's"
Changes since v2:
- Add reproduction recipe
during plane updates")
--- drivers/gpu/drm/i915/intel_display.c | 7 ++++++- drivers/gpu/drm/i915/intel_sprite.c | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +6 -1
@@ -3448,7 +3448,12 @@ static void skylake_disable_primary_plane(struct drm_plane *primary,struct intel_crtc *intel_crtc =to_intel_crtc (crtc);int pipe = intel_crtc->pipe; -skl_write_plane_wm (intel_crtc, &dev_priv->wm.skl_results,0 ); +/* +* We only populate skl_results on watermark updates, and if the +* plane's visiblity isn't actually changing neither is its watermarks. +*/ +if (!crtc->primary->state->visible) +skl_write_plane_wm (intel_crtc, &dev_priv->wm.skl_results,0 );I915_WRITE (PLANE_CTL (pipe,0 ),0 );I915_WRITE (PLANE_SURF (pipe,0 ),0 );
drivers/gpu/drm/i915/intel_sprite.c +7 -2
@@ -292,8 +292,13 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc)const int pipe = intel_plane->pipe;const int plane = intel_plane->plane +1 ; -skl_write_plane_wm (to_intel_crtc (crtc), &dev_priv->wm.skl_results, - plane); +/* +* We only populate skl_results on watermark updates, and if the +* plane's visiblity isn't actually changing neither is its watermarks. +*/ +if (!dplane->state->visible) +skl_write_plane_wm (to_intel_crtc (crtc), + &dev_priv->wm.skl_results, plane);I915_WRITE (PLANE_CTL (pipe, plane),0 );
Signature · 6 lines
2.7.4 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Since this patch has been on hold for a little bit, I did a bit of thinking of how we could this a little more cleanly. Unfortunately I couldn't think of a way, however I did think of an alternative solution:
I'm planning on backporting all of the skl wm fixes already, so I'm going to use this patch for that since it's very small. As for mainline, I'm going to do a whole reorganization of the skl wm/ddb structs in i915 like Matt had suggested before. Things might look a little more like this (taken from my half-complete reorganization):
struct skl_plane_ddb_allocation {
struct skl_ddb_entry plane;
struct skl_ddb_entry y_plane;
};struct skl_plane_wm_values {
struct skl_plane_ddb_allocation ddb;
uint32_t wm[8];
uint32_t trans_wm;
};struct skl_pipe_wm_values {
struct skl_ddb_entry ddb;
uint32_t linetime;
};struct skl_hw_wm_values { /* (only used for skl_get_hw_ddb and friends) */
struct skl_pipe_wm_values pipe[I915_MAX_PIPES]; struct skl_plane_wm_values plane[I915_MAX_PIPES][I915_MAX_PLANES]; };
As well, I'm also just going to completely remove the skl_results and skl_hw structs from struct drm_i915_private. This makes sense for a lot of reasons:
* This completely gets rid of the need for a global watermark lock (on Skylake at least) and will make things a lot easier for atomic support in the future
* Skylake doesn't have any actual global watermark hooks anyway, aside from skl_update_wm() which is now only used for writing watermarks for inactive pipes during haswell_crtc_enable()
* This makes passing watermarks around way less of a mess
* Saves a tiny bit of data, and so far being able to grab watermarks/ddbs right from the plane states seems to be a lot easier then messing with a large array
As for this fix, I'll probably still need someone to review it so I can get it into 4.7.y.
Let me know what you think.
Quoted 85 lines · Lyude
i915 sometimes needs to disable planes in the middle of an atomic commit, and then reenable them later in the same commit. Because of this, we can't make the assumption that the state of the plane actually
changed. Since the state of the plane hasn't actually changed, neither
have it's watermarks. And if the watermarks hasn't changed then we haven't populatedskl_resultswith anything, which means we'll end up zeroing out a plane's watermarks in the middle of the atomic commit without restoring them later.Simple reproduction recipe:
- Get a SKL laptop, launch any kind of X session
- Get two extra monitors
- Keep hotplugging both displays (so that the display configuration jumps from 1 active pipe to 3 active pipes and back)
- Eventually underrunChanges since v1:
- Fix incorrect use of "it's"
Changes since v2:
- Add reproduction recipeSigned-off-by Lyude <[email protected]>Cc Maarten Lankhorst <[email protected]>Fixes 62e0fb880123 ("drm/i915/skl: Update plane watermarksatomically
during plane updates")Signed-off-by Lyude <[email protected]>---
drivers/gpu/drm/i915/intel_display.c | 7 ++++++- drivers/gpu/drm/i915/intel_sprite.c | 9 +++++++--2 files changed, 13 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/intel_display.c +0
-0@@ -3448,7 +3448,12 @@ static void skylake_disable_primary_plane(struct drm_plane *primary, struct intel_crtc *intel_crtc = to_intel_crtc(crtc); int pipe = intel_crtc->pipe;drivers/gpu/drm/i915/intel_display.c +0
-1- skl_write_plane_wm(intel_crtc, &dev_priv->wm.skl_results,0);
drivers/gpu/drm/i915/intel_display.c +2
-0+/* +* We only populate skl_results on watermark updates, and if the
drivers/gpu/drm/i915/intel_display.c +1
-0+ * plane's visiblity isn't actually changing neither is itswatermarks.
drivers/gpu/drm/i915/intel_display.c +3
-0+*/ +if (!crtc->primary->state->visible) + skl_write_plane_wm(intel_crtc, &dev_priv-Quoted 1 line
wm.skl_results, 0);
I915_WRITE(PLANE_CTL(pipe, 0), 0);
I915_WRITE(PLANE_SURF(pipe, 0), 0);drivers/gpu/drm/i915/intel_sprite.c +0
-0@@ -292,8 +292,13 @@ skl_disable_plane(struct drm_plane *dplane, struct drm_crtc *crtc) const int pipe = intel_plane->pipe; const int plane = intel_plane->plane + 1;drivers/gpu/drm/i915/intel_sprite.c +0
-1- skl_write_plane_wm(to_intel_crtc(crtc), &dev_priv-Quoted 1 line
wm.skl_results,
drivers/gpu/drm/i915/intel_sprite.c +2
-1- plane); +/* +* We only populate skl_results on watermark updates, and if the
drivers/gpu/drm/i915/intel_sprite.c +1
-0+ * plane's visiblity isn't actually changing neither is itswatermarks.
drivers/gpu/drm/i915/intel_sprite.c +4
-0+*/ +if (!dplane->state->visible) + skl_write_plane_wm(to_intel_crtc(crtc), + &dev_priv->wm.skl_results,plane);
I915_WRITE(PLANE_CTL(pipe, plane), 0);
Signature · 2 lines
Cheers, Lyude
Patchwork
CI✗ Fi.CI.BAT: failure for drm/i915/skl: Don't try to update plane watermarks if they haven't changed (rev2)
In reply to Lyude== Series Details ==
== Series Details ==
Series: drm/i915/skl: Don't try to update plane watermarks if they haven't changed (rev2)
URL : https://patchwork.freedesktop.org/series/11654/
State : failure
== Summary ==
Series 11654v2 drm/i915/skl: Don't try to update plane watermarks if they haven't changed
http://patchwork.freedesktop.org/api/1.0/series/11654/revisions/2/mbox/
Test kms_cursor_legacy:
Subgroup basic-cursor-vs-flip-legacy:
pass -> FAIL (fi-bsw-n3050)
Test kms_pipe_crc_basic:
Subgroup suspend-read-crc-pipe-a:
incomplete -> PASS (fi-hsw-4770k)fi-bdw-5557u total:252 pass:235 dwarn:0 dfail:0 fail:2 skip:15 fi-bsw-n3050 total:252 pass:204 dwarn:0 dfail:0 fail:2 skip:46 fi-byt-n2820 total:252 pass:208 dwarn:0 dfail:0 fail:3 skip:41 fi-hsw-4770k total:252 pass:228 dwarn:0 dfail:0 fail:2 skip:22 fi-hsw-4770r total:252 pass:224 dwarn:0 dfail:0 fail:2 skip:26 fi-ivb-3520m total:252 pass:220 dwarn:0 dfail:0 fail:1 skip:31 fi-skl-6260u total:252 pass:236 dwarn:0 dfail:0 fail:2 skip:14 fi-skl-6700k total:252 pass:222 dwarn:0 dfail:0 fail:2 skip:28 fi-snb-2520m total:252 pass:207 dwarn:0 dfail:0 fail:2 skip:43 fi-snb-2600 total:252 pass:207 dwarn:0 dfail:0 fail:2 skip:43
Results at /archive/results/CI_IGT_test/Patchwork_2446/
f4f46e5544894b2198cdfd5a226ee587d9834cc4 drm-intel-nightly: 2016y-08m-29d-14h-09m-23s UTC integration manifest 9d8dab1 drm/i915/skl: Don't try to update plane watermarks if they haven't changed
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for drm/i915/skl: Don't try to update plane watermarks if they haven't changed (rev3)
In reply to Lyude== Series Details ==
== Series Details ==
Series: drm/i915/skl: Don't try to update plane watermarks if they haven't changed (rev3)
URL : https://patchwork.freedesktop.org/series/11654/
State : success
== Summary ==
Series 11654v3 drm/i915/skl: Don't try to update plane watermarks if they haven't changed
http://patchwork.freedesktop.org/api/1.0/series/11654/revisions/3/mbox/
fi-bdw-5557u total:252 pass:235 dwarn:0 dfail:0 fail:2 skip:15 fi-bsw-n3050 total:252 pass:205 dwarn:0 dfail:0 fail:1 skip:46 fi-hsw-4770k total:107 pass:91 dwarn:0 dfail:0 fail:0 skip:15 fi-hsw-4770r total:252 pass:223 dwarn:0 dfail:0 fail:2 skip:27 fi-ivb-3520m total:252 pass:220 dwarn:0 dfail:0 fail:1 skip:31 fi-skl-6260u total:252 pass:236 dwarn:0 dfail:0 fail:2 skip:14 fi-skl-6700k total:252 pass:222 dwarn:0 dfail:0 fail:2 skip:28 fi-snb-2520m total:252 pass:207 dwarn:0 dfail:0 fail:2 skip:43 fi-snb-2600 total:252 pass:207 dwarn:0 dfail:0 fail:2 skip:43
Results at /archive/results/CI_IGT_test/Patchwork_2447/
57de27e40b9741c17c6749a366e891faf8b22fcb drm-intel-nightly: 2016y-08m-29d-15h-38m-26s UTC integration manifest 6c4a762 drm/i915/skl: Don't try to update plane watermarks if they haven't changed
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx