Skip to contentSkip to conversation

drm/i915/psr: Force PSR probe only after full initialization

PATCH In review José Roberto de Souza 3 participants 5 messages Feb 20, 2020 – Feb 21, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 drm/i915/psr: Force PSR probe only after full initialization

Commit 60c6a14b489b ("drm/i915/display: Force the state compute phase once to enable PSR") was forcing the state compute too earlier causing errors because not everything was initialized, so here moving to the end of i915_driver_modeset_probe() when the display is all initialized.

Also fixing the place where it disarm the force probe as during the atomic check phase errors could happen like the ones due locking and it would cause PSR to never be enabled if that happens. Leaving the disarm to the atomic commit phase, intel_psr_enable() or intel_psr_update() will be called even if the current state do not allow PSR to be enabled.

v2: Check if intel_dp is null in intel_psr_force_mode_changed_set()
v3: Check intel_dp before get dev_priv
v4:
- renamed intel_psr_force_mode_changed_set() to intel_psr_set_force_mode_changed()
- removed the set parameter from intel_psr_set_force_mode_changed()
- not calling intel_psr_set_force_mode_changed() from intel_psr_enable/update(), directly setting it after the same checks that intel_psr_set_force_mode_changed() does
- moved intel_psr_set_force_mode_changed() arm call to i915_driver_modeset_probe() as it is a better for a PSR call, all the functions calls happening between the old and the new function call will cause issue

Fixes 60c6a14b489b ("drm/i915/display: Force the state compute phase once to enable PSR")
Cc Gwan-gyeong Mun <[email protected]>
Cc Jani Nikula <[email protected]>
Cc Anshuman Gupta <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_psr.c | 25 ++++++++++++++++++++----
 drivers/gpu/drm/i915/display/intel_psr.h |  1 +
 drivers/gpu/drm/i915/i915_drv.c          |  3 +++
 drivers/gpu/drm/i915/i915_drv.h          |  2 +-
 4 files changed, 26 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +21 -4
index b4942b6445ae..7e754201f54d 100644
@@ -936,10 +936,12 @@ void intel_psr_enable(struct intel_dp *intel_dp,
 {
 	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
 
-	if (!crtc_state->has_psr)
+	if (!CAN_PSR(dev_priv) || dev_priv->psr.dp != intel_dp)
 		return;
 
-	if (drm_WARN_ON(&dev_priv->drm, !CAN_PSR(dev_priv)))
+	dev_priv->psr.force_mode_changed = false;
+
+	if (!crtc_state->has_psr)
 		return;
 
 	drm_WARN_ON(&dev_priv->drm, dev_priv->drrs.dp);
@@ -1099,6 +1101,8 @@ void intel_psr_update(struct intel_dp *intel_dp,
 	if (!CAN_PSR(dev_priv) || READ_ONCE(psr->dp) != intel_dp)
 		return;
 
+	dev_priv->psr.force_mode_changed = false;
+
 	mutex_lock(&dev_priv->psr.lock);
 
 	enable = crtc_state->has_psr && psr_global_enabled(dev_priv);
@@ -1629,7 +1633,7 @@ void intel_psr_atomic_check(struct drm_connector *connector,
 	struct drm_crtc_state *crtc_state;
 
 	if (!CAN_PSR(dev_priv) || !new_state->crtc ||
-	    dev_priv->psr.initially_probed)
+	    !dev_priv->psr.force_mode_changed)
 		return;
 
 	intel_connector = to_intel_connector(connector);
@@ -1640,5 +1644,18 @@ void intel_psr_atomic_check(struct drm_connector *connector,
 	crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
 						   new_state->crtc);
 	crtc_state->mode_changed = true;
-	dev_priv->psr.initially_probed = true;
+}
+
+void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!intel_dp)
+		return;
+
+	dev_priv = dp_to_i915(intel_dp);
+	if (!CAN_PSR(dev_priv) || intel_dp != dev_priv->psr.dp)
+		return;
+
+	dev_priv->psr.force_mode_changed = true;
 }
drivers/gpu/drm/i915/display/intel_psr.h +1 -0
index c58a1d438808..274fc6bb6221 100644
@@ -40,5 +40,6 @@ bool intel_psr_enabled(struct intel_dp *intel_dp);
 void intel_psr_atomic_check(struct drm_connector *connector,
 			    struct drm_connector_state *old_state,
 			    struct drm_connector_state *new_state);
+void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp);
 
 #endif /* __INTEL_PSR_H__ */
drivers/gpu/drm/i915/i915_drv.c +3 -0
index 759d333448e1..066934327345 100644
@@ -58,6 +58,7 @@
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pipe_crc.h"
+#include "display/intel_psr.h"
 #include "display/intel_sprite.h"
 #include "display/intel_vga.h"
 
@@ -264,6 +265,8 @@ static int i915_driver_modeset_probe(struct drm_i915_private *i915)
 
 	intel_init_ipc(i915);
 
+	intel_psr_set_force_mode_changed(i915->psr.dp);
+
 	return 0;
 
 cleanup_gem:
drivers/gpu/drm/i915/i915_drv.h +1 -1
index 4305ccc4c683..2b741b352ce0 100644
@@ -505,7 +505,7 @@ struct i915_psr {
 	bool dc3co_enabled;
 	u32 dc3co_exit_delay;
 	struct delayed_work dc3co_work;
-	bool initially_probed;
+	bool force_mode_changed;
 };
 
 #define QUIRK_LVDS_SSC_DISABLE (1<<1)
Signature · 6 lines
2.25.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

[Intel-gfx] ✗ Fi.CI.BAT: failure for drm/i915/psr: Force PSR probe only after full initialization (rev6)

== Series Details ==

== Series Details ==

Series: drm/i915/psr: Force PSR probe only after full initialization (rev6)
URL : https://patchwork.freedesktop.org/series/73436/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_7977 -> Patchwork_16649
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_16649 absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_16649, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/index.html

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_16649:

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live_uncore:
- fi-bwr-2160: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-bwr-2160/igt@i915_selftest@live_uncore.html
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-bwr-2160/igt@i915_selftest@live_uncore.html

Known issues
------------

Here are the changes found in Patchwork_16649 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@gem_close_race@basic-threads:
- fi-hsw-4770r: [PASS][3] -> [TIMEOUT][4] ([fdo#112271] / [i915#1084])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-hsw-4770r/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-hsw-4770r/igt@[email protected]

* igt@gem_exec_suspend@basic-s4-devices:
- fi-tgl-y: [PASS][5] -> [FAIL][6] ([CI#94])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-tgl-y/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-tgl-y/igt@[email protected]

* igt@i915_selftest@live_gtt:
- fi-kbl-7500u: [PASS][7] -> [TIMEOUT][8] ([fdo#112271])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-kbl-7500u/igt@i915_selftest@live_gtt.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-kbl-7500u/igt@i915_selftest@live_gtt.html

* igt@prime_self_import@basic-llseek-bad:
- fi-tgl-y: [PASS][9] -> [DMESG-WARN][10] ([CI#94] / [i915#402])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-tgl-y/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-tgl-y/igt@[email protected]

#### Possible fixes ####

* igt@i915_selftest@live_execlists:
- fi-tgl-y: [INCOMPLETE][11] ([CI#94] / [i915#647]) -> [PASS][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-tgl-y/igt@i915_selftest@live_execlists.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-tgl-y/igt@i915_selftest@live_execlists.html

* igt@i915_selftest@live_gem_contexts:
- fi-cml-s: [DMESG-FAIL][13] ([i915#877]) -> [PASS][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-cml-s/igt@i915_selftest@live_gem_contexts.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-cml-s/igt@i915_selftest@live_gem_contexts.html

* igt@i915_selftest@live_gtt:
- {fi-tgl-dsi}: [TIMEOUT][15] ([fdo#112126] / [fdo#112271]) -> [PASS][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-tgl-dsi/igt@i915_selftest@live_gtt.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-tgl-dsi/igt@i915_selftest@live_gtt.html

* igt@prime_self_import@basic-with_one_bo_two_files:
- fi-tgl-y: [DMESG-WARN][17] ([CI#94] / [i915#402]) -> [PASS][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_7977/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/fi-tgl-y/igt@prime_self_import@basic-with_one_bo_two_files.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[CI#94]: https://gitlab.freedesktop.org/gfx-ci/i915-infra/issues/94
[fdo#112126]: https://bugs.freedesktop.org/show_bug.cgi?id=112126
[fdo#112271]: https://bugs.freedesktop.org/show_bug.cgi?id=112271
[i915#1084]: https://gitlab.freedesktop.org/drm/intel/issues/1084
[i915#402]: https://gitlab.freedesktop.org/drm/intel/issues/402
[i915#647]: https://gitlab.freedesktop.org/drm/intel/issues/647
[i915#877]: https://gitlab.freedesktop.org/drm/intel/issues/877

Participating hosts (49 -> 45)
------------------------------

Additional (3): fi-hsw-peppy fi-byt-n2820 fi-cfl-8109u
Missing (7): fi-ehl-1 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-byt-clapper fi-bdw-samus

Build changes
-------------

* CI: CI-20190529 -> None
* Linux: CI_DRM_7977 -> Patchwork_16649

CI-20190529: 20190529
CI_DRM_7977: 055793baa45ba27e36b40f1299cfaa19388b592d @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5453: cae9a5881ed2c5be2c2518a255740b612a927f9a @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_16649: bc04baf9708060522088a9924bee1d720c495070 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

bc04baf97080 drm/i915/psr: Force PSR probe only after full initialization

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_16649/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v4 1/1
#2 lore raw
In reply to José Roberto de Souza
Quoted 50 lines · José Roberto de Souza

Commit 60c6a14b489b ("drm/i915/display: Force the state compute phase once to enable PSR") was forcing the state compute too earlier causing errors because not everything was initialized, so here moving to the end of i915_driver_modeset_probe() when the display is all initialized.

Also fixing the place where it disarm the force probe as during the atomic check phase errors could happen like the ones due locking and it would cause PSR to never be enabled if that happens. Leaving the disarm to the atomic commit phase, intel_psr_enable() or intel_psr_update() will be called even if the current state do not allow PSR to be enabled.

v2: Check if intel_dp is null in intel_psr_force_mode_changed_set()
v3: Check intel_dp before get dev_priv
v4:
- renamed intel_psr_force_mode_changed_set() to intel_psr_set_force_mode_changed()
- removed the set parameter from intel_psr_set_force_mode_changed()
- not calling intel_psr_set_force_mode_changed() from intel_psr_enable/update(), directly setting it after the same checks that intel_psr_set_force_mode_changed() does
- moved intel_psr_set_force_mode_changed() arm call to i915_driver_modeset_probe() as it is a better for a PSR call, all the functions calls happening between the old and the new function call will cause issue

Fixes 60c6a14b489b ("drm/i915/display: Force the state compute phase

once to enable PSR")

---
 drivers/gpu/drm/i915/display/intel_psr.c | 25 ++++++++++++++++++++
----
 drivers/gpu/drm/i915/display/intel_psr.h |  1 +
 drivers/gpu/drm/i915/i915_drv.c          |  3 +++
 drivers/gpu/drm/i915/i915_drv.h          |  2 +-
 4 files changed, 26 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index b4942b6445ae..7e754201f54d 100644

drivers/gpu/drm/i915/display/intel_psr.c void intel_psr_enable(struct intel_dp · line 940

Quoted 5 lines
drivers/gpu/drm/i915/display/intel_psr.c +0 -1
@@ -936,10 +936,12 @@ void intel_psr_enable(struct intel_dp
 *intel_dp,
 {
 	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
 
-	if (!crtc_state->has_psr)

Enabling of crtc_state->has_psr is handled on intel_psr_compute_config().
And the intel_psr_compute_config() checks "CAN_PSR(dev_priv) and intel_dp != dev_priv->psr.dp".
therefore if we have this line "if (!crtc_state->has_psr)", we don't need to add "if (!CAN_PSR(dev_priv) || dev_priv->psr.dp != intel_dp)"

Except that, looks good to me.

Quoted 92 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -1
+	if (!CAN_PSR(dev_priv) || dev_priv->psr.dp != intel_dp)
 		return;
 
-	if (drm_WARN_ON(&dev_priv->drm, !CAN_PSR(dev_priv)))
+	dev_priv->psr.force_mode_changed = false;
+
+	if (!crtc_state->has_psr)
 		return;
 
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
 	drm_WARN_ON(&dev_priv->drm, dev_priv->drrs.dp);
@@ -1099,6 +1101,8 @@ void intel_psr_update(struct intel_dp
 *intel_dp,
 	if (!CAN_PSR(dev_priv) || READ_ONCE(psr->dp) != intel_dp)
 		return;
 
+	dev_priv->psr.force_mode_changed = false;
+
 	mutex_lock(&dev_priv->psr.lock);
 
drivers/gpu/drm/i915/display/intel_psr.c +1 -1
 	enable = crtc_state->has_psr && psr_global_enabled(dev_priv);
@@ -1629,7 +1633,7 @@ void intel_psr_atomic_check(struct
 drm_connector *connector,
 	struct drm_crtc_state *crtc_state;
 
 	if (!CAN_PSR(dev_priv) || !new_state->crtc ||
-	    dev_priv->psr.initially_probed)
+	    !dev_priv->psr.force_mode_changed)
 		return;
 
drivers/gpu/drm/i915/display/intel_psr.c +14 -1
 	intel_connector = to_intel_connector(connector);
@@ -1640,5 +1644,18 @@ void intel_psr_atomic_check(struct
 drm_connector *connector,
 	crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
 						   new_state->crtc);
 	crtc_state->mode_changed = true;
-	dev_priv->psr.initially_probed = true;
+}
+
+void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!intel_dp)
+		return;
+
+	dev_priv = dp_to_i915(intel_dp);
+	if (!CAN_PSR(dev_priv) || intel_dp != dev_priv->psr.dp)
+		return;
+
+	dev_priv->psr.force_mode_changed = true;

}

drivers/gpu/drm/i915/display/intel_psr.h +1 -0
index c58a1d438808..274fc6bb6221 100644
@@ -40,5 +40,6 @@ bool intel_psr_enabled(struct intel_dp *intel_dp);
 void intel_psr_atomic_check(struct drm_connector *connector,
 			    struct drm_connector_state *old_state,
 			    struct drm_connector_state *new_state);
+void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp);
 
 #endif /* __INTEL_PSR_H__ */
drivers/gpu/drm/i915/i915_drv.c +3 -0
index 759d333448e1..066934327345 100644
@@ -58,6 +58,7 @@
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pipe_crc.h"
+#include "display/intel_psr.h"
 #include "display/intel_sprite.h"
 #include "display/intel_vga.h"
 
@@ -264,6 +265,8 @@ static int i915_driver_modeset_probe(struct
 drm_i915_private *i915)
 
 	intel_init_ipc(i915);
 
+	intel_psr_set_force_mode_changed(i915->psr.dp);
+
 	return 0;
 

cleanup_gem:

drivers/gpu/drm/i915/i915_drv.h +0 -0
index 4305ccc4c683..2b741b352ce0 100644

drivers/gpu/drm/i915/i915_drv.h struct i915_psr { · line 511

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.h +1 -1
@@ -505,7 +505,7 @@ struct i915_psr {
 	bool dc3co_enabled;
 	u32 dc3co_exit_delay;
 	struct delayed_work dc3co_work;
-	bool initially_probed;
+	bool force_mode_changed;
 };
 
 #define QUIRK_LVDS_SSC_DISABLE (1<<1)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#3 lore raw
Quoted 62 lines · Gwan-gyeong
Quoted 61 lines · José Roberto de Souza

Commit 60c6a14b489b ("drm/i915/display: Force the state compute phase
once to enable PSR") was forcing the state compute too earlier causing errors because not everything was initialized, so here moving to the end of i915_driver_modeset_probe() when the display is
all initialized.

Also fixing the place where it disarm the force probe as during the atomic check phase errors could happen like the ones due locking and
it would cause PSR to never be enabled if that happens. Leaving the disarm to the atomic commit phase, intel_psr_enable() or
intel_psr_update() will be called even if the current state do not allow PSR to be enabled.

v2: Check if intel_dp is null in intel_psr_force_mode_changed_set()
v3: Check intel_dp before get dev_priv
v4:
- renamed intel_psr_force_mode_changed_set() to intel_psr_set_force_mode_changed()
- removed the set parameter from intel_psr_set_force_mode_changed()
- not calling intel_psr_set_force_mode_changed() from intel_psr_enable/update(), directly setting it after the same checks
that intel_psr_set_force_mode_changed() does
- moved intel_psr_set_force_mode_changed() arm call to i915_driver_modeset_probe() as it is a better for a PSR call, all the
functions calls happening between the old and the new function call will cause issue

Fixes 60c6a14b489b ("drm/i915/display: Force the state compute

phase
once to enable PSR")

---
 drivers/gpu/drm/i915/display/intel_psr.c | 25 ++++++++++++++++++++
----
 drivers/gpu/drm/i915/display/intel_psr.h |  1 +
 drivers/gpu/drm/i915/i915_drv.c          |  3 +++
 drivers/gpu/drm/i915/i915_drv.h          |  2 +-
 4 files changed, 26 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index b4942b6445ae..7e754201f54d 100644
@@ -936,10 +936,12 @@ void intel_psr_enable(struct intel_dp
 *intel_dp,
 {
 	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
 
Quoted 7 lines

drivers/gpu/drm/i915/display/intel_psr.c void intel_psr_enable(struct intel_dp *intel_dp, · line 939

Quoted 1 line
drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	if (!crtc_state->has_psr)

Enabling of crtc_state->has_psr is handled on intel_psr_compute_config().
And the intel_psr_compute_config() checks "CAN_PSR(dev_priv) and intel_dp != dev_priv->psr.dp".
therefore if we have this line "if (!crtc_state->has_psr)", we don't need to add "if (!CAN_PSR(dev_priv) || dev_priv->psr.dp != intel_dp)"

crtc_state->has_psr will only be set to true if the state allows, we don't want to keep computing pipe configuration for every following page flip if PSR can not be enable(like PSR setup time do not fit in vblank).

That is why it is unseting force_mode_changed even if crtc_state-

Quoted 107 lines

has_psr is false.

Except that, looks good to me.

Quoted 100 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -1
+	if (!CAN_PSR(dev_priv) || dev_priv->psr.dp != intel_dp)
 		return;
 
-	if (drm_WARN_ON(&dev_priv->drm, !CAN_PSR(dev_priv)))
+	dev_priv->psr.force_mode_changed = false;
+
+	if (!crtc_state->has_psr)
 		return;
 
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
 	drm_WARN_ON(&dev_priv->drm, dev_priv->drrs.dp);
@@ -1099,6 +1101,8 @@ void intel_psr_update(struct intel_dp
 *intel_dp,
 	if (!CAN_PSR(dev_priv) || READ_ONCE(psr->dp) != intel_dp)
 		return;
 
+	dev_priv->psr.force_mode_changed = false;
+
 	mutex_lock(&dev_priv->psr.lock);
 
drivers/gpu/drm/i915/display/intel_psr.c +1 -1
 	enable = crtc_state->has_psr && psr_global_enabled(dev_priv);
@@ -1629,7 +1633,7 @@ void intel_psr_atomic_check(struct
 drm_connector *connector,
 	struct drm_crtc_state *crtc_state;
 
 	if (!CAN_PSR(dev_priv) || !new_state->crtc ||
-	    dev_priv->psr.initially_probed)
+	    !dev_priv->psr.force_mode_changed)
 		return;
 
drivers/gpu/drm/i915/display/intel_psr.c +14 -1
 	intel_connector = to_intel_connector(connector);
@@ -1640,5 +1644,18 @@ void intel_psr_atomic_check(struct
 drm_connector *connector,
 	crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
 						   new_state->crtc);
 	crtc_state->mode_changed = true;
-	dev_priv->psr.initially_probed = true;
+}
+
+void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!intel_dp)
+		return;
+
+	dev_priv = dp_to_i915(intel_dp);
+	if (!CAN_PSR(dev_priv) || intel_dp != dev_priv->psr.dp)
+		return;
+
+	dev_priv->psr.force_mode_changed = true;

}

drivers/gpu/drm/i915/display/intel_psr.h +1 -0
index c58a1d438808..274fc6bb6221 100644
@@ -40,5 +40,6 @@ bool intel_psr_enabled(struct intel_dp
 *intel_dp);
 void intel_psr_atomic_check(struct drm_connector *connector,
 			    struct drm_connector_state *old_state,
 			    struct drm_connector_state *new_state);
+void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp);
 

#endif /* __INTEL_PSR_H__ */

drivers/gpu/drm/i915/i915_drv.c +3 -0
index 759d333448e1..066934327345 100644
@@ -58,6 +58,7 @@
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pipe_crc.h"
+#include "display/intel_psr.h"
 #include "display/intel_sprite.h"
 #include "display/intel_vga.h"
 
@@ -264,6 +265,8 @@ static int i915_driver_modeset_probe(struct
 drm_i915_private *i915)
 
 	intel_init_ipc(i915);
 
+	intel_psr_set_force_mode_changed(i915->psr.dp);
+
 	return 0;
 

cleanup_gem:

drivers/gpu/drm/i915/i915_drv.h +1 -1
index 4305ccc4c683..2b741b352ce0 100644
@@ -505,7 +505,7 @@ struct i915_psr {
 	bool dc3co_enabled;
 	u32 dc3co_exit_delay;
 	struct delayed_work dc3co_work;
-	bool initially_probed;
+	bool force_mode_changed;
 };
 
Quoted 1 line

drivers/gpu/drm/i915/i915_drv.h struct i915_psr { · line 511

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define QUIRK_LVDS_SSC_DISABLE (1<<1)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#4 lore raw
Quoted 79 lines · Jose
Quoted 68 lines · Gwan-gyeong
Quoted 67 lines · José Roberto de Souza

Commit 60c6a14b489b ("drm/i915/display: Force the state compute phase
once to enable PSR") was forcing the state compute too earlier causing errors because not everything was initialized, so here moving to the end of i915_driver_modeset_probe() when the display is
all initialized.

Also fixing the place where it disarm the force probe as during the
atomic check phase errors could happen like the ones due locking and
it would cause PSR to never be enabled if that happens. Leaving the disarm to the atomic commit phase, intel_psr_enable() or
intel_psr_update() will be called even if the current state do not
allow PSR to be enabled.

v2: Check if intel_dp is null in intel_psr_force_mode_changed_set()
v3: Check intel_dp before get dev_priv
v4:
- renamed intel_psr_force_mode_changed_set() to intel_psr_set_force_mode_changed()
- removed the set parameter from intel_psr_set_force_mode_changed()
- not calling intel_psr_set_force_mode_changed() from intel_psr_enable/update(), directly setting it after the same checks
that intel_psr_set_force_mode_changed() does
- moved intel_psr_set_force_mode_changed() arm call to i915_driver_modeset_probe() as it is a better for a PSR call, all the
functions calls happening between the old and the new function call
will cause issue

Fixes 60c6a14b489b ("drm/i915/display: Force the state compute

phase
once to enable PSR")

---
 drivers/gpu/drm/i915/display/intel_psr.c | 25
++++++++++++++++++++
----
 drivers/gpu/drm/i915/display/intel_psr.h |  1 +
 drivers/gpu/drm/i915/i915_drv.c          |  3 +++
 drivers/gpu/drm/i915/i915_drv.h          |  2 +-
 4 files changed, 26 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_psr.c +0 -0
index b4942b6445ae..7e754201f54d 100644
@@ -936,10 +936,12 @@ void intel_psr_enable(struct intel_dp
 *intel_dp,
 {
 	struct drm_i915_private *dev_priv = dp_to_i915(intel_dp);
 
Quoted 9 lines

drivers/gpu/drm/i915/display/intel_psr.c void intel_psr_enable(struct intel_dp *intel_dp, · line 939

Quoted 1 line
drivers/gpu/drm/i915/display/intel_psr.c +0 -1
-	if (!crtc_state->has_psr)

Enabling of crtc_state->has_psr is handled on intel_psr_compute_config().
And the intel_psr_compute_config() checks "CAN_PSR(dev_priv) and intel_dp != dev_priv->psr.dp".
therefore if we have this line "if (!crtc_state->has_psr)", we don't
need to add "if (!CAN_PSR(dev_priv) || dev_priv->psr.dp != intel_dp)"

Quoted 5 lines

crtc_state->has_psr will only be set to true if the state allows, we don't want to keep computing pipe configuration for every following page flip if PSR can not be enable(like PSR setup time do not fit in vblank).

Yes, you are right. we also have to handle the case which can not support PSR. (I missed those cases.)

Quoted 107 lines

That is why it is unseting force_mode_changed even if crtc_state-

Quoted 106 lines

has_psr is false.
Except that, looks good to me.

Quoted 101 lines
drivers/gpu/drm/i915/display/intel_psr.c +4 -1
+	if (!CAN_PSR(dev_priv) || dev_priv->psr.dp != intel_dp)
 		return;
 
-	if (drm_WARN_ON(&dev_priv->drm, !CAN_PSR(dev_priv)))
+	dev_priv->psr.force_mode_changed = false;
+
+	if (!crtc_state->has_psr)
 		return;
 
drivers/gpu/drm/i915/display/intel_psr.c +2 -0
 	drm_WARN_ON(&dev_priv->drm, dev_priv->drrs.dp);
@@ -1099,6 +1101,8 @@ void intel_psr_update(struct intel_dp
 *intel_dp,
 	if (!CAN_PSR(dev_priv) || READ_ONCE(psr->dp) != intel_dp)
 		return;
 
+	dev_priv->psr.force_mode_changed = false;
+
 	mutex_lock(&dev_priv->psr.lock);
 
drivers/gpu/drm/i915/display/intel_psr.c +1 -1
 	enable = crtc_state->has_psr && psr_global_enabled(dev_priv);
@@ -1629,7 +1633,7 @@ void intel_psr_atomic_check(struct
 drm_connector *connector,
 	struct drm_crtc_state *crtc_state;
 
 	if (!CAN_PSR(dev_priv) || !new_state->crtc ||
-	    dev_priv->psr.initially_probed)
+	    !dev_priv->psr.force_mode_changed)
 		return;
 
drivers/gpu/drm/i915/display/intel_psr.c +14 -1
 	intel_connector = to_intel_connector(connector);
@@ -1640,5 +1644,18 @@ void intel_psr_atomic_check(struct
 drm_connector *connector,
 	crtc_state = drm_atomic_get_new_crtc_state(new_state->state,
 						   new_state->crtc);
 	crtc_state->mode_changed = true;
-	dev_priv->psr.initially_probed = true;
+}
+
+void intel_psr_set_force_mode_changed(struct intel_dp *intel_dp)
+{
+	struct drm_i915_private *dev_priv;
+
+	if (!intel_dp)
+		return;
+
+	dev_priv = dp_to_i915(intel_dp);
+	if (!CAN_PSR(dev_priv) || intel_dp != dev_priv->psr.dp)
+		return;
+
+	dev_priv->psr.force_mode_changed = true;

}

drivers/gpu/drm/i915/display/intel_psr.h +1 -0
index c58a1d438808..274fc6bb6221 100644
@@ -40,5 +40,6 @@ bool intel_psr_enabled(struct intel_dp
 *intel_dp);
 void intel_psr_atomic_check(struct drm_connector *connector,
 			    struct drm_connector_state *old_state,
 			    struct drm_connector_state *new_state);
+void intel_psr_set_force_mode_changed(struct intel_dp
 *intel_dp);

#endif /* __INTEL_PSR_H__ */

drivers/gpu/drm/i915/i915_drv.c +3 -0
index 759d333448e1..066934327345 100644
@@ -58,6 +58,7 @@
 #include "display/intel_hotplug.h"
 #include "display/intel_overlay.h"
 #include "display/intel_pipe_crc.h"
+#include "display/intel_psr.h"
 #include "display/intel_sprite.h"
 #include "display/intel_vga.h"
 
@@ -264,6 +265,8 @@ static int i915_driver_modeset_probe(struct
 drm_i915_private *i915)
 
 	intel_init_ipc(i915);
 
+	intel_psr_set_force_mode_changed(i915->psr.dp);
+
 	return 0;
 

cleanup_gem:

drivers/gpu/drm/i915/i915_drv.h +1 -1
index 4305ccc4c683..2b741b352ce0 100644
@@ -505,7 +505,7 @@ struct i915_psr {
 	bool dc3co_enabled;
 	u32 dc3co_exit_delay;
 	struct delayed_work dc3co_work;
-	bool initially_probed;
+	bool force_mode_changed;
 };
 
Quoted 1 line
Quoted 1 line

drivers/gpu/drm/i915/i915_drv.h struct i915_psr { · line 511

Quoted 1 line
drivers/gpu/drm/i915/i915_drv.h +0 -0
 #define QUIRK_LVDS_SSC_DISABLE (1<<1)

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx