Skip to contentSkip to conversation

drm/i915/psr: Set idle frame count based on sink synchronization latency

PATCH In review Dhinakaran Pandiyan 5 participants 8 messages May 25, 2018 – May 29, 2018

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

PATCH 1/1 drm/i915/psr: Set idle frame count based on sink synchronization latency

DPCD 2009h "Synchronization latency in sink" has bits that tell us the maximum number of frames sink can take to resynchronize to source timing when exiting PSR. More importantly, as per eDP 1.4b, this is the "Minimum number of frames following PSR exit that the Source device needs to wait for PSR entry."

We currently use this value only to setup the number frames to wait before PSR2 selective update. But, based on the above description it makes more sense to use this to configure idle frames for both PSR1 and and PSR2. This will ensure we wait the required number of frames before activation whether it is PSR1 or PSR2.

The minimum number of idle frames remains 6, while allowing sink synchronization latency and VBT to increase this value.

This also solves the flip-flop between sink and source frames that I noticed on my Thinkpad X260 during PSR exit. This specific panel has a value of 8h, which according to the spec means the "Source device must wait for more than eight active frames after PSR exit before initiating PSR entry. (In this case, should be provided by the panel supplier.)" VBT however has a value of 0.

Cc Jani Nikula <[email protected]>
Cc Jose Roberto de Souza <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +20 -20
index ebc483f06c6f..71dfe541740f 100644
@@ -247,6 +247,8 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		return;
 	}
 	dev_priv->psr.sink_support = true;
+	dev_priv->psr.sink_sync_latency =
+		intel_dp_get_sink_sync_latency(intel_dp);
 
 	if (INTEL_GEN(dev_priv) >= 9 &&
 	    (intel_dp->psr_dpcd[0] == DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) {
@@ -272,8 +274,6 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		if (dev_priv->psr.sink_psr2_support) {
 			dev_priv->psr.colorimetry_support =
 				intel_dp_get_colorimetry_status(intel_dp);
-			dev_priv->psr.sink_sync_latency =
-				intel_dp_get_sink_sync_latency(intel_dp);
 		}
 	}
 }
@@ -370,21 +370,21 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 max_sleep_time = 0x1f;
+	u32 val = EDP_PSR_ENABLE;
 
-	uint32_t max_sleep_time = 0x1f;
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	uint32_t val = EDP_PSR_ENABLE;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
 
-	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
+	/* sink_sync_latency of 8 means source has to wait for more than 8
+	 * frames, we'll go with 9 frames for now
+	 */
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
 	val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
 
+	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
 	if (IS_HASWELL(dev_priv))
 		val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
 
@@ -424,15 +424,15 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	u32 val;
+
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	u32 val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
+
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
+	val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
 
 	/* FIXME: selective update is probably totally broken because it doesn't
 	 * mesh at all with our frontbuffer tracking. And the hw alone isn't
Signature · 6 lines
2.14.1

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

✗ Fi.CI.SPARSE: warning for drm/i915/psr: Set idle frame count based on sink synchronization latency

== Series Details ==

== Series Details ==

Series: drm/i915/psr: Set idle frame count based on sink synchronization latency
URL : https://patchwork.freedesktop.org/series/43742/
State : warning

== Summary ==

$ dim sparse origin/drm-tip
Commit: drm/i915/psr: Set idle frame count based on sink synchronization latency
-O:drivers/gpu/drm/i915/intel_psr.c:382:32: warning: expression using sizeof(void)
-O:drivers/gpu/drm/i915/intel_psr.c:434:32: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_psr.c:379:27: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_psr.c:384:23: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_psr.c:384:23: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_psr.c:432:27: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_psr.c:434:23: warning: expression using sizeof(void)
+drivers/gpu/drm/i915/intel_psr.c:434:23: warning: expression using sizeof(void)

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

#2 lore raw

✓ Fi.CI.BAT: success for drm/i915/psr: Set idle frame count based on sink synchronization latency

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: drm/i915/psr: Set idle frame count based on sink synchronization latency
URL : https://patchwork.freedesktop.org/series/43742/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4236 -> Patchwork_9113 =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_9113 need to be verified manually.

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

External URL: https://patchwork.freedesktop.org/api/1.0/series/43742/revisions/1/mbox/

== Possible new issues ==

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

=== IGT changes ===

    ==== Warnings ====

    igt@gem_exec_gttfill@basic:
      fi-pnv-d510:        PASS -> SKIP

== Known issues ==

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

=== IGT changes ===

    ==== Possible fixes ====

    igt@gem_mmap_gtt@basic-small-bo-tiledx:
      fi-gdg-551:         FAIL (fdo#102575) -> PASS

    igt@kms_frontbuffer_tracking@basic:
      fi-hsw-4200u:       DMESG-FAIL (fdo#106103, fdo#102614) -> PASS

    igt@prime_vgem@basic-fence-flip:
      fi-ilk-650:         FAIL (fdo#104008) -> PASS

fdo#102575 https://bugs.freedesktop.org/show_bug.cgi?id=102575
fdo#102614 https://bugs.freedesktop.org/show_bug.cgi?id=102614
fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#106103 https://bugs.freedesktop.org/show_bug.cgi?id=106103

== Participating hosts (43 -> 39) ==

Additional (1): fi-snb-2520m
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4236 -> Patchwork_9113

CI_DRM_4236: 39b54b1e366012ce58e6a0cc175612577480992f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4498: f9ecb79ad8b02278cfdb5b82495df47061c04f8f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9113: 9601f363642d91c8ff0fa582fd2c6198e00feb46 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

9601f363642d drm/i915/psr: Set idle frame count based on sink synchronization latency

== Logs ==

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

#3 lore raw

✓ Fi.CI.IGT: success for drm/i915/psr: Set idle frame count based on sink synchronization latency

In reply to Dhinakaran Pandiyan
== Series Details ==

== Series Details ==

Series: drm/i915/psr: Set idle frame count based on sink synchronization latency
URL : https://patchwork.freedesktop.org/series/43742/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4236_full -> Patchwork_9113_full =

== Summary - WARNING ==

Minor unknown changes coming with Patchwork_9113_full need to be verified manually.

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

External URL: https://patchwork.freedesktop.org/api/1.0/series/43742/revisions/1/mbox/

== Possible new issues ==

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

=== IGT changes ===

    ==== Warnings ====

    igt@drv_selftest@live_gtt:
      shard-glk:          INCOMPLETE (fdo#103359, k.org#198133) -> FAIL

    igt@gem_mocs_settings@mocs-rc6-bsd2:
      shard-kbl:          PASS -> SKIP

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@drv_selftest@live_gtt:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@gem_exec_await@wide-contexts:
      shard-glk:          PASS -> FAIL (fdo#105900)

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking:
      shard-glk:          PASS -> FAIL (fdo#105703)

    
    ==== Possible fixes ====

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          INCOMPLETE (fdo#103665, fdo#106023) -> PASS

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking-fencing:
      shard-glk:          FAIL (fdo#105703) -> PASS

    igt@kms_flip@2x-flip-vs-expired-vblank:
      shard-glk:          FAIL (fdo#105363) -> PASS

    igt@kms_flip@plain-flip-fb-recreate:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_flip_tiling@flip-x-tiled:
      shard-glk:          FAIL (fdo#104724, fdo#103822) -> PASS

    igt@kms_frontbuffer_tracking@fbc-2p-primscrn-cur-indfb-draw-mmap-gtt:
      shard-hsw:          DMESG-FAIL (fdo#104724, fdo#103167) -> PASS

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103359 https://bugs.freedesktop.org/show_bug.cgi?id=103359
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103822 https://bugs.freedesktop.org/show_bug.cgi?id=103822
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105703 https://bugs.freedesktop.org/show_bug.cgi?id=105703
fdo#105900 https://bugs.freedesktop.org/show_bug.cgi?id=105900
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
k.org#198133 https://bugzilla.kernel.org/show_bug.cgi?id=198133

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4236 -> Patchwork_9113

CI_DRM_4236: 39b54b1e366012ce58e6a0cc175612577480992f @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4498: f9ecb79ad8b02278cfdb5b82495df47061c04f8f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9113: 9601f363642d91c8ff0fa582fd2c6198e00feb46 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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

#4 lore raw
In reply to Dhinakaran Pandiyan
Quoted 22 lines · Dhinakaran Pandiyan

DPCD 2009h "Synchronization latency in sink" has bits that tell us the maximum number of frames sink can take to resynchronize to source timing when exiting PSR. More importantly, as per eDP 1.4b, this is the "Minimum number of frames following PSR exit that the Source device needs to wait for PSR entry."

We currently use this value only to setup the number frames to wait before PSR2 selective update. But, based on the above description it makes more sense to use this to configure idle frames for both PSR1 and and PSR2. This will ensure we wait the required number of frames before activation whether it is PSR1 or PSR2.

The minimum number of idle frames remains 6, while allowing sink synchronization latency and VBT to increase this value.

This also solves the flip-flop between sink and source frames that I noticed on my Thinkpad X260 during PSR exit. This specific panel has a value of 8h, which according to the spec means the "Source device must wait for more than eight active frames after PSR exit before initiating PSR entry. (In this case, should be provided by the panel supplier.)" VBT however has a value of 0.

Quoted 4 lines
Cc Jani Nikula <[email protected]>
Cc Jose Roberto de Souza <[email protected]>
Cc Rodrigo Vivi <[email protected]>

How badly does this depend on the last psr series that was just merged? I.e. does cc: stable make any sense?

BR,
Jani.

Quoted 82 lines
---
 drivers/gpu/drm/i915/intel_psr.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +20 -20
index ebc483f06c6f..71dfe541740f 100644
@@ -247,6 +247,8 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		return;
 	}
 	dev_priv->psr.sink_support = true;
+	dev_priv->psr.sink_sync_latency =
+		intel_dp_get_sink_sync_latency(intel_dp);
 
 	if (INTEL_GEN(dev_priv) >= 9 &&
 	    (intel_dp->psr_dpcd[0] == DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) {
@@ -272,8 +274,6 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		if (dev_priv->psr.sink_psr2_support) {
 			dev_priv->psr.colorimetry_support =
 				intel_dp_get_colorimetry_status(intel_dp);
-			dev_priv->psr.sink_sync_latency =
-				intel_dp_get_sink_sync_latency(intel_dp);
 		}
 	}
 }
@@ -370,21 +370,21 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 max_sleep_time = 0x1f;
+	u32 val = EDP_PSR_ENABLE;
 
-	uint32_t max_sleep_time = 0x1f;
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	uint32_t val = EDP_PSR_ENABLE;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
 
-	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
+	/* sink_sync_latency of 8 means source has to wait for more than 8
+	 * frames, we'll go with 9 frames for now
+	 */
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
 	val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
 
+	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
 	if (IS_HASWELL(dev_priv))
 		val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
 
@@ -424,15 +424,15 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	u32 val;
+
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	u32 val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
+
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
+	val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
 
 	/* FIXME: selective update is probably totally broken because it doesn't
 	 * mesh at all with our frontbuffer tracking. And the hw alone isn't
Signature · 5 lines
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
maintainer Reviewed-by on v1 1/1
#5 lore raw
In reply to Dhinakaran Pandiyan
Quoted 95 lines · Dhinakaran Pandiyan

DPCD 2009h "Synchronization latency in sink" has bits that tell us the maximum number of frames sink can take to resynchronize to source timing when exiting PSR. More importantly, as per eDP 1.4b, this is the "Minimum number of frames following PSR exit that the Source device needs to wait for PSR entry."

We currently use this value only to setup the number frames to wait before PSR2 selective update. But, based on the above description it makes more sense to use this to configure idle frames for both PSR1 and and PSR2. This will ensure we wait the required number of frames before activation whether it is PSR1 or PSR2.

The minimum number of idle frames remains 6, while allowing sink synchronization latency and VBT to increase this value.

This also solves the flip-flop between sink and source frames that I noticed on my Thinkpad X260 during PSR exit. This specific panel has a value of 8h, which according to the spec means the "Source device must wait for more than eight active frames after PSR exit before initiating PSR entry. (In this case, should be provided by the panel supplier.)" VBT however has a value of 0.

Cc Jani Nikula <[email protected]>
Cc Jose Roberto de Souza <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +13 -18
index ebc483f06c6f..71dfe541740f 100644
@@ -247,6 +247,8 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		return;
 	}
 	dev_priv->psr.sink_support = true;
+	dev_priv->psr.sink_sync_latency =
+		intel_dp_get_sink_sync_latency(intel_dp);
 
 	if (INTEL_GEN(dev_priv) >= 9 &&
 	    (intel_dp->psr_dpcd[0] == DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) {
@@ -272,8 +274,6 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		if (dev_priv->psr.sink_psr2_support) {
 			dev_priv->psr.colorimetry_support =
 				intel_dp_get_colorimetry_status(intel_dp);
-			dev_priv->psr.sink_sync_latency =
-				intel_dp_get_sink_sync_latency(intel_dp);
 		}
 	}
 }
@@ -370,21 +370,21 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 max_sleep_time = 0x1f;
+	u32 val = EDP_PSR_ENABLE;
 
-	uint32_t max_sleep_time = 0x1f;
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	uint32_t val = EDP_PSR_ENABLE;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
 
-	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
+	/* sink_sync_latency of 8 means source has to wait for more than 8
+	 * frames, we'll go with 9 frames for now
+	 */
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
 	val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
 
+	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
 	if (IS_HASWELL(dev_priv))
 		val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
 
@@ -424,15 +424,15 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	u32 val;

drivers/gpu/drm/i915/intel_psr.c static void hsw_activate_psr2(struct intel_dp *intel_dp) · line 435

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +7 -2
+
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	u32 val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
+
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
+	val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;

I wonder if we should consolidate all this login in a single function since they are identical and only the shift is different...

But the logic is correct. I checked eDP 1.3 and 1.4 specs and I believe we need to move forward with this change and do clean-ups on follow-ups.

Also I don't believe that we need cc:stable because we never enabled it anywhere anyway besides the fact that it wont be a clean backport.

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +0 -0
 	/* FIXME: selective update is probably totally broken because it doesn't
 	 * mesh at all with our frontbuffer tracking. And the hw alone isn't
Signature · 6 lines
2.14.1

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

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

maintainer
#6 lore raw
Quoted 110 lines · Rodrigo Vivi
Quoted 95 lines · Dhinakaran Pandiyan

DPCD 2009h "Synchronization latency in sink" has bits that tell us the maximum number of frames sink can take to resynchronize to source timing when exiting PSR. More importantly, as per eDP 1.4b, this is the "Minimum number of frames following PSR exit that the Source device needs to wait for PSR entry."

We currently use this value only to setup the number frames to wait before PSR2 selective update. But, based on the above description it makes more sense to use this to configure idle frames for both PSR1 and and PSR2. This will ensure we wait the required number of frames before activation whether it is PSR1 or PSR2.

The minimum number of idle frames remains 6, while allowing sink synchronization latency and VBT to increase this value.

This also solves the flip-flop between sink and source frames that I noticed on my Thinkpad X260 during PSR exit. This specific panel has a value of 8h, which according to the spec means the "Source device must wait for more than eight active frames after PSR exit before initiating PSR entry. (In this case, should be provided by the panel supplier.)" VBT however has a value of 0.

Cc Jani Nikula <[email protected]>
Cc Jose Roberto de Souza <[email protected]>
Cc Rodrigo Vivi <[email protected]>
---
 drivers/gpu/drm/i915/intel_psr.c | 40 ++++++++++++++++++++--------------------
 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +13 -18
index ebc483f06c6f..71dfe541740f 100644
@@ -247,6 +247,8 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		return;
 	}
 	dev_priv->psr.sink_support = true;
+	dev_priv->psr.sink_sync_latency =
+		intel_dp_get_sink_sync_latency(intel_dp);
 
 	if (INTEL_GEN(dev_priv) >= 9 &&
 	    (intel_dp->psr_dpcd[0] == DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) {
@@ -272,8 +274,6 @@ void intel_psr_init_dpcd(struct intel_dp *intel_dp)
 		if (dev_priv->psr.sink_psr2_support) {
 			dev_priv->psr.colorimetry_support =
 				intel_dp_get_colorimetry_status(intel_dp);
-			dev_priv->psr.sink_sync_latency =
-				intel_dp_get_sink_sync_latency(intel_dp);
 		}
 	}
 }
@@ -370,21 +370,21 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
+	u32 max_sleep_time = 0x1f;
+	u32 val = EDP_PSR_ENABLE;
 
-	uint32_t max_sleep_time = 0x1f;
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	uint32_t val = EDP_PSR_ENABLE;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
 
-	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
+	/* sink_sync_latency of 8 means source has to wait for more than 8
+	 * frames, we'll go with 9 frames for now
+	 */
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
 	val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;
 
+	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
 	if (IS_HASWELL(dev_priv))
 		val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;
 
@@ -424,15 +424,15 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
 	struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
 	struct drm_device *dev = dig_port->base.base.dev;
 	struct drm_i915_private *dev_priv = to_i915(dev);
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame value.
-	 * Let's use 6 as the minimum to cover all known cases including
-	 * the off-by-one issue that HW has in some cases. Also there are
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	u32 val;

drivers/gpu/drm/i915/intel_psr.c static void hsw_activate_psr2(struct intel_dp *intel_dp) · line 435

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +7 -2
+
+	/* Let's use 6 as the minimum to cover all known cases including the
+	 * off-by-one issue that HW has in some cases.
 	 */
-	uint32_t idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
-	u32 val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
+
+	idle_frames = max(idle_frames, dev_priv->psr.sink_sync_latency + 1);
+	val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;

I wonder if we should consolidate all this login in a single function since they are identical and only the shift is different...

Quoted 5 lines

But the logic is correct. I checked eDP 1.3 and 1.4 specs and I believe we need to move forward with this change and do clean-ups on follow-ups.

and pushed to dinq. thanks

Quoted 14 lines

Also I don't believe that we need cc:stable because we never enabled it anywhere anyway besides the fact that it wont be a clean backport.

Quoted 10 lines
drivers/gpu/drm/i915/intel_psr.c +0 -0
 	/* FIXME: selective update is probably totally broken because it doesn't
 	 * mesh at all with our frontbuffer tracking. And the hw alone isn't
Signature · 6 lines
2.14.1

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

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

#7 lore raw
In reply to Rodrigo Vivi
Quoted 151 lines · Rodrigo Vivi
Quoted 140 lines · Dhinakaran Pandiyan

DPCD 2009h "Synchronization latency in sink" has bits that tell us the
maximum number of frames sink can take to resynchronize to source timing
when exiting PSR. More importantly, as per eDP 1.4b, this is the "Minimum
number of frames following PSR exit that the Source device needs to wait for PSR entry."

We currently use this value only to setup the number frames to wait before
PSR2 selective update. But, based on the above description it makes more
sense to use this to configure idle frames for both PSR1 and and PSR2. This
will ensure we wait the required number of frames before activation whether it is PSR1 or PSR2.

The minimum number of idle frames remains 6, while allowing sink synchronization latency and VBT to increase this value.

This also solves the flip-flop between sink and source frames that I
noticed on my Thinkpad X260 during PSR exit. This specific panel has a
value of 8h, which according to the spec means the "Source device must
wait for more than eight active frames after PSR exit before initiating PSR
entry. (In this case, should be provided by the panel supplier.)" VBT
however has a value of 0.

Cc Jani Nikula <[email protected]>
Cc Jose Roberto de Souza <[email protected]>
Cc Rodrigo Vivi <[email protected]>

---
 drivers/gpu/drm/i915/intel_psr.c | 40 ++++++++++++++++++++------
--------------

 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/i915/intel_psr.c +2 -0
index ebc483f06c6f..71dfe541740f 100644
@@ -247,6 +247,8 @@ void intel_psr_init_dpcd(struct intel_dp
 *intel_dp)
  		return;
  	}
  	dev_priv->psr.sink_support = true;
+	dev_priv->psr.sink_sync_latency =
+		intel_dp_get_sink_sync_latency(intel_dp);


  if (INTEL_GEN(dev_priv) >= 9 &&
      (intel_dp->psr_dpcd[0] ==
DP_PSR2_WITH_Y_COORD_IS_SUPPORTED)) {

drivers/gpu/drm/i915/intel_psr.c +0 -0
@@ -272,8 +274,6 @@ void intel_psr_init_dpcd(struct intel_dp
 *intel_dp)
  		if (dev_priv->psr.sink_psr2_support) {

  dev_priv->psr.colorimetry_support = intel_dp_get_colorimetry_status(in tel_dp);

drivers/gpu/drm/i915/intel_psr.c +0 -2
-			dev_priv->psr.sink_sync_latency =
-				intel_dp_get_sink_sync_latency(int

el_dp);
  }
  }
 }

drivers/gpu/drm/i915/intel_psr.c +0 -0
@@ -370,21 +370,21 @@ static void hsw_activate_psr1(struct intel_dp
 *intel_dp)

  struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
  struct drm_device *dev = dig_port->base.base.dev; struct drm_i915_private *dev_priv = to_i915(dev);

drivers/gpu/drm/i915/intel_psr.c +2 -0
+	u32 max_sleep_time = 0x1f;
+	u32 val = EDP_PSR_ENABLE;

drivers/gpu/drm/i915/intel_psr.c +0 -3
-	uint32_t max_sleep_time = 0x1f;
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame

value.

drivers/gpu/drm/i915/intel_psr.c +0 -1
-	 * Let's use 6 as the minimum to cover all known cases

including

drivers/gpu/drm/i915/intel_psr.c +0 -1
-	 * the off-by-one issue that HW has in some cases. Also

there are

drivers/gpu/drm/i915/intel_psr.c +1 -2
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	/* Let's use 6 as the minimum to cover all known cases

including the

drivers/gpu/drm/i915/intel_psr.c +1 -0
+	 * off-by-one issue that HW has in some cases.

   */

drivers/gpu/drm/i915/intel_psr.c +0 -1
-	uint32_t idle_frames = max(6, dev_priv-
Quoted 1 line

vbt.psr.idle_frames);

drivers/gpu/drm/i915/intel_psr.c +1 -1
-	uint32_t val = EDP_PSR_ENABLE;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);

drivers/gpu/drm/i915/intel_psr.c +1 -1
-	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;
+	/* sink_sync_latency of 8 means source has to wait for

more than 8

drivers/gpu/drm/i915/intel_psr.c +3 -0
+	 * frames, we'll go with 9 frames for now
+	 */
+	idle_frames = max(idle_frames, dev_priv-
Quoted 1 line

psr.sink_sync_latency + 1);

  val |= idle_frames << EDP_PSR_IDLE_FRAME_SHIFT;

drivers/gpu/drm/i915/intel_psr.c +1 -0
+	val |= max_sleep_time << EDP_PSR_MAX_SLEEP_TIME_SHIFT;

  if (IS_HASWELL(dev_priv))
  val |= EDP_PSR_MIN_LINK_ENTRY_TIME_8_LINES;

drivers/gpu/drm/i915/intel_psr.c +0 -0
@@ -424,15 +424,15 @@ static void hsw_activate_psr2(struct intel_dp
 *intel_dp)

  struct intel_digital_port *dig_port = dp_to_dig_port(intel_dp);
  struct drm_device *dev = dig_port->base.base.dev; struct drm_i915_private *dev_priv = to_i915(dev);

drivers/gpu/drm/i915/intel_psr.c +0 -2
-	/*
-	 * Let's respect VBT in case VBT asks a higher idle_frame

value.

drivers/gpu/drm/i915/intel_psr.c +0 -1
-	 * Let's use 6 as the minimum to cover all known cases

including

drivers/gpu/drm/i915/intel_psr.c +0 -1
-	 * the off-by-one issue that HW has in some cases. Also

there are

drivers/gpu/drm/i915/intel_psr.c +3 -2
-	 * cases where sink should be able to train
-	 * with the 5 or 6 idle patterns.
+	u32 val;
+
+	/* Let's use 6 as the minimum to cover all known cases

including the

drivers/gpu/drm/i915/intel_psr.c +1 -0
+	 * off-by-one issue that HW has in some cases.

   */

drivers/gpu/drm/i915/intel_psr.c +0 -1
-	uint32_t idle_frames = max(6, dev_priv-
Quoted 1 line

vbt.psr.idle_frames);

drivers/gpu/drm/i915/intel_psr.c +3 -1
-	u32 val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;
+	int idle_frames = max(6, dev_priv->vbt.psr.idle_frames);
+
+	idle_frames = max(idle_frames, dev_priv-
Quoted 1 line

psr.sink_sync_latency + 1);

drivers/gpu/drm/i915/intel_psr.c static void hsw_activate_psr2(struct intel_dp *intel_dp) · line 435

Quoted 1 line
drivers/gpu/drm/i915/intel_psr.c +1 -0
+	val = idle_frames << EDP_PSR2_IDLE_FRAME_SHIFT;

I wonder if we should consolidate all this login in a single function since they
are identical and only the shift is different...

But the logic is correct. I checked eDP 1.3 and 1.4 specs and I believe we
need to move forward with this change and do clean-ups on follow-ups.

Quoted 5 lines

Also I don't believe that we need cc:stable because we never enabled it anywhere
anyway besides the fact that it wont be a clean backport.

Yeah, we've had a couple of commits that touch this code, won't be a clean back port.

Thanks for reviewing and merging this patch.

Quoted 7 lines
Quoted 7 lines


  /* FIXME: selective update is probably totally broken because it doesn't
   * mesh at all with our frontbuffer tracking. And the hw alone isn't

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