Skip to contentSkip to conversation

drm/i915/psr: vbt change for psr

PATCH In review vathsala nagaraju 5 participants 14 messages May 14, 2018 – May 17, 2018

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

PATCH 1/1 drm/i915/psr: vbt change for psr

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check to change for all the platforms.

There is RCR inplace for GOP team to provide the version number to make generic change. Since Kabylake with bdb version 209 is having this change, limiting this change to gen9_bc and version 209+ to unblock google.

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
move the 165 version check to intel_bios.c
v3: Jani
Move the abstraction to intel_bios.
v4: Jani
Rename tp*_wakeup_time to have "us" suffix.
For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
Handle option 2 in default condition.
Print oustide range value.
For negetive values default to 2500us.
v6: Jani
Handle default first and then fall through for case 2.
v7: Rodrigo
Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>
---
 drivers/gpu/drm/i915/i915_drv.h   |  4 ++--
 drivers/gpu/drm/i915/i915_reg.h   |  8 +++----
 drivers/gpu/drm/i915/intel_bios.c | 46 +++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++----------------
 4 files changed, 70 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 57fb3aa..268b059 100644
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
 		bool require_aux_wakeup;
 		int idle_frames;
 		enum psr_lines_to_wait lines_to_wait;
-		int tp1_wakeup_time;
-		int tp2_tp3_wakeup_time;
+		int tp1_wakeup_time_us;
+		int tp2_tp3_wakeup_time_us;
 	} psr;
 
 	struct {
drivers/gpu/drm/i915/i915_reg.h +4 -4
index f11bb21..6820658 100644
@@ -4088,10 +4088,10 @@ enum {
 #define   EDP_Y_COORDINATE_ENABLE	(1<<25) /* GLK and CNL+ */
 #define   EDP_MAX_SU_DISABLE_TIME(t)	((t)<<20)
 #define   EDP_MAX_SU_DISABLE_TIME_MASK	(0x1f<<20)
-#define   EDP_PSR2_TP2_TIME_500		(0<<8)
-#define   EDP_PSR2_TP2_TIME_100		(1<<8)
-#define   EDP_PSR2_TP2_TIME_2500	(2<<8)
-#define   EDP_PSR2_TP2_TIME_50		(3<<8)
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
+#define   EDP_PSR2_TP2_TIME_100us	(1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us	(2<<8)
+#define   EDP_PSR2_TP2_TIME_50us	(3<<8)
 #define   EDP_PSR2_TP2_TIME_MASK	(3<<8)
 #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
 #define   EDP_PSR2_FRAME_BEFORE_SU_MASK	(0xf<<4)
drivers/gpu/drm/i915/intel_bios.c +44 -2

52 lines not on this page · raw message

drivers/gpu/drm/i915/intel_psr.c +20 -19
index db27f2f..d64f039 100644
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp *intel_dp)
 	if (dev_priv->psr.link_standby)
 		val |= EDP_PSR_LINK_STANDBY;
 
-	if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-		val |= EDP_PSR_TP1_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-		val |= EDP_PSR_TP1_TIME_500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP1_TIME_0us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)
 		val |= EDP_PSR_TP1_TIME_100us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP1_TIME_500us;
 	else
-		val |= EDP_PSR_TP1_TIME_0us;
+		val |= EDP_PSR_TP1_TIME_2500us;
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR_TP2_TP3_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR_TP2_TP3_TIME_500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP2_TP3_TIME_0us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
 		val |= EDP_PSR_TP2_TP3_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP2_TP3_TIME_500us;
 	else
-		val |= EDP_PSR_TP2_TP3_TIME_0us;
+		val |= EDP_PSR_TP2_TP3_TIME_2500us;
 
 	if (intel_dp_source_supports_hbr2(intel_dp) &&
 	    drm_dp_tps3_supported(intel_dp->dpcd))
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct intel_dp *intel_dp)
 
 	val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv->psr.sink_sync_latency + 1);
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR2_TP2_TIME_2500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR2_TP2_TIME_500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-		val |= EDP_PSR2_TP2_TIME_100;
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+	    dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+		val |= EDP_PSR2_TP2_TIME_50us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
+		val |= EDP_PSR2_TP2_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR2_TP2_TIME_500us;
 	else
-		val |= EDP_PSR2_TP2_TIME_50;
+		val |= EDP_PSR2_TP2_TIME_2500us;
 
 	I915_WRITE(EDP_PSR2_CTL, val);
 }
Signature · 6 lines
1.9.1

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

✗ Fi.CI.CHECKPATCH: warning for drm/i915/psr: vbt change for psr (rev7)

== Series Details ==

== Series Details ==

Series: drm/i915/psr: vbt change for psr (rev7)
URL : https://patchwork.freedesktop.org/series/41289/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
e221e68c5170 drm/i915/psr: vbt change for psr
-:71: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV)
#71: FILE: drivers/gpu/drm/i915/i915_reg.h:4091:
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
                                  	  ^

-:72: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #72: FILE: drivers/gpu/drm/i915/i915_reg.h:4092:
+#define EDP_PSR2_TP2_TIME_100us (1<<8)

                                  	  ^

-:73: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #73: FILE: drivers/gpu/drm/i915/i915_reg.h:4093:
+#define EDP_PSR2_TP2_TIME_2500us (2<<8)

                                   	  ^

-:74: CHECK:SPACING: spaces preferred around that '<<' (ctx:VxV) #74: FILE: drivers/gpu/drm/i915/i915_reg.h:4094:
+#define EDP_PSR2_TP2_TIME_50us (3<<8)

                                 	  ^

-:105: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #105: FILE: drivers/gpu/drm/i915/intel_bios.c:708:
+ DRM_DEBUG_KMS("VBT tp1 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
+ psr_table->tp1_wakeup_time);

-:123: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #123: FILE: drivers/gpu/drm/i915/intel_bios.c:726:
+ DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n",
+ psr_table->tp2_tp3_wakeup_time);

total: 0 errors, 0 warnings, 6 checks, 133 lines checked

_______________________________________________
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: vbt change for psr (rev7)

In reply to vathsala nagaraju
== Series Details ==

== Series Details ==

Series: drm/i915/psr: vbt change for psr (rev7)
URL : https://patchwork.freedesktop.org/series/41289/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4172 -> Patchwork_8991 =

== Summary - WARNING ==

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8991, 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/41289/revisions/7/mbox/

== Possible new issues ==

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

=== IGT changes ===

    ==== Warnings ====

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

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

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

    
    ==== Possible fixes ====

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

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

== Participating hosts (40 -> 37) ==

Missing (3): fi-ilk-m540 fi-byt-squawks fi-skl-6700hq

== Build changes ==

* Linux: CI_DRM_4172 -> Patchwork_8991

CI_DRM_4172: b4c14c0809e8f6dba9a4fdf1a659cea5a98750d3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4475: 35f08c12aa216d5b62a5b9984b575cee6905098f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8991: e221e68c5170be2ac071d92e0cf6a09f591e7838 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4475: 3ba0657bff4216d1ec7179935590261855f1651e @ git://anongit.freedesktop.org/piglit

== Linux commits ==

e221e68c5170 drm/i915/psr: vbt change for psr

== Logs ==

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

#3 lore raw

✗ Fi.CI.IGT: failure for drm/i915/psr: vbt change for psr (rev7)

In reply to vathsala nagaraju
== Series Details ==

== Series Details ==

Series: drm/i915/psr: vbt change for psr (rev7)
URL : https://patchwork.freedesktop.org/series/41289/
State : failure

== Summary ==

= CI Bug Log - changes from CI_DRM_4172_full -> Patchwork_8991_full =

== Summary - FAILURE ==

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_8991_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/41289/revisions/7/mbox/

== Possible new issues ==

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

=== IGT changes ===

    ==== Possible regressions ====

    igt@kms_vblank@pipe-a-ts-continuation-suspend:
      shard-kbl:          PASS -> FAIL

    
    ==== Warnings ====

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

    igt@gem_pwrite@big-cpu-random:
      shard-kbl:          PASS -> SKIP +1
      shard-apl:          SKIP -> PASS

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_eio@suspend:
      shard-kbl:          PASS -> DMESG-WARN (fdo#103558, fdo#105602) +4

    igt@kms_flip@plain-flip-ts-check-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368) +2

    igt@kms_frontbuffer_tracking@fbc-1p-primscrn-spr-indfb-fullscreen:
      shard-apl:          PASS -> FAIL (fdo#104724, fdo#103167)

    
    ==== Possible fixes ====

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

    igt@kms_atomic_transition@1x-modeset-transitions-nonblocking:
      shard-apl:          FAIL (fdo#103207, fdo#104724) -> PASS

    igt@kms_flip@blocking-absolute-wf_vblank-interruptible:
      shard-glk:          FAIL (fdo#106134) -> PASS

    igt@kms_flip@flip-vs-absolute-wf_vblank-interruptible:
      shard-glk:          FAIL (fdo#100368) -> PASS

    igt@kms_setmode@basic:
      shard-kbl:          FAIL (fdo#99912) -> PASS

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103167 https://bugs.freedesktop.org/show_bug.cgi?id=103167
fdo#103207 https://bugs.freedesktop.org/show_bug.cgi?id=103207
fdo#103558 https://bugs.freedesktop.org/show_bug.cgi?id=103558
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#104724 https://bugs.freedesktop.org/show_bug.cgi?id=104724
fdo#105602 https://bugs.freedesktop.org/show_bug.cgi?id=105602
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106134 https://bugs.freedesktop.org/show_bug.cgi?id=106134
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

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

No changes in participating hosts

== Build changes ==

* Linux: CI_DRM_4172 -> Patchwork_8991

CI_DRM_4172: b4c14c0809e8f6dba9a4fdf1a659cea5a98750d3 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4475: 35f08c12aa216d5b62a5b9984b575cee6905098f @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_8991: e221e68c5170be2ac071d92e0cf6a09f591e7838 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4475: 3ba0657bff4216d1ec7179935590261855f1651e @ git://anongit.freedesktop.org/piglit

== Logs ==

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

#4 lore raw
In reply to vathsala nagaraju
Quoted 101 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not  mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check
to change for all the platforms.

There is RCR inplace for GOP team to  provide the version number to make generic change. Since Kabylake with bdb version 209 is having this
change, limiting this change to gen9_bc and version 209+ to unblock google.

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
    move the 165 version check to intel_bios.c
v3: Jani
    Move the abstraction to intel_bios.
v4: Jani
    Rename tp*_wakeup_time to have "us" suffix.
    For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
    Handle option 2 in default condition.
    Print oustide range value.
    For negetive values default to 2500us.
v6: Jani
    Handle default first and then fall through for case 2.
v7: Rodrigo
    Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>

---
 drivers/gpu/drm/i915/i915_drv.h   |  4 ++-- drivers/gpu/drm/i915/i915_reg.h   |  8 +++---- drivers/gpu/drm/i915/intel_bios.c | 46
+++++++++++++++++++++++++++++++++++++--
 drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++----------
------

 4 files changed, 70 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 57fb3aa..268b059 100644
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
  		bool require_aux_wakeup;
  		int idle_frames;
  		enum psr_lines_to_wait lines_to_wait;
-		int tp1_wakeup_time;
-		int tp2_tp3_wakeup_time;
+		int tp1_wakeup_time_us;
+		int tp2_tp3_wakeup_time_us;
  	} psr;


  struct {

drivers/gpu/drm/i915/i915_reg.h +4 -4
index f11bb21..6820658 100644
@@ -4088,10 +4088,10 @@ enum {
  #define   EDP_Y_COORDINATE_ENABLE	(1<<25) /* GLK and CNL+ */
  #define   EDP_MAX_SU_DISABLE_TIME(t)	((t)<<20)
  #define   EDP_MAX_SU_DISABLE_TIME_MASK	(0x1f<<20)
-#define   EDP_PSR2_TP2_TIME_500		(0<<8)
-#define   EDP_PSR2_TP2_TIME_100		(1<<8)
-#define   EDP_PSR2_TP2_TIME_2500	(2<<8)
-#define   EDP_PSR2_TP2_TIME_50		(3<<8)
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
+#define   EDP_PSR2_TP2_TIME_100us	(1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us	(2<<8)
+#define   EDP_PSR2_TP2_TIME_50us	(3<<8)
  #define   EDP_PSR2_TP2_TIME_MASK	(3<<8)
  #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  #define   EDP_PSR2_FRAME_BEFORE_SU_MASK	(0xf<<4)
drivers/gpu/drm/i915/intel_bios.c +0 -0
index 54270bd..695ca73 100644
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct
 drm_i915_private *dev_priv,
  		break;
  	}

drivers/gpu/drm/i915/intel_bios.c +0 -1
-	dev_priv->vbt.psr.tp1_wakeup_time = psr_table-
Quoted 1 line

tp1_wakeup_time;

drivers/gpu/drm/i915/intel_bios.c +0 -1
-	dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table-
Quoted 1 line

tp2_tp3_wakeup_time;

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv, · line 695

Quoted 5 lines
drivers/gpu/drm/i915/intel_bios.c +5 -0
+	/*
+	 * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+	 * Old decimal value is wake up time in multiples of 100 us.
+	 */
+	if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {

Since this is the 'new' mapping, shouldn't this check be

if (version >= 209) {

}
i.e., what versions do BXT, GLK, CFL and CNL have?

Since gen-9 tables can have ambiguous interpretations, I think we can do this.

if (version >= 209 || (IS_GEN9() && wakeup_time <=3)) {
	// Read this as {0:500, 1:100, 2:2500, 3:0}
} else {
	// Read this as wakeup_time * 100
}

This is assuming all versions => 209 use the new mapping consistently.

2 and 3 are invalid values in the x*100 us scheme, so we can assume it really means 2.5 ms and 0.
1 means the same.
0 is a problem, but we can check dpcd 0071h to confirm whether the sink needs training or not. And it is safer to assume the sink needs training at interpret is as 500 us.

Quoted 13 lines
drivers/gpu/drm/i915/intel_bios.c +12 -0
+		switch (psr_table->tp1_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp1 wakeup time value %d

is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv, · line 713

Quoted 6 lines
drivers/gpu/drm/i915/intel_bios.c +6 -0
+					psr_table->tp1_wakeup_time);
+		case 2:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
+			break;
+		}
+

nit: That's an interesting order, it is neither sorted by the switch variable nor by wake up time. It is easier to read if you chose one way or the other IMO.

Quoted 97 lines
drivers/gpu/drm/i915/intel_bios.c +3 -0
+		switch (psr_table->tp2_tp3_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

100;

drivers/gpu/drm/i915/intel_bios.c +6 -0
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value

%d is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c +1 -0
+					psr_table-
Quoted 1 line

tp2_tp3_wakeup_time);

drivers/gpu/drm/i915/intel_bios.c +2 -0
+		case 2:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

2500;

drivers/gpu/drm/i915/intel_bios.c +4 -0
+		break;
+		}
+	} else {
+		dev_priv->vbt.psr.tp1_wakeup_time_us = psr_table-
Quoted 1 line

tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+		dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+	}

 }

 static void parse_dsi_backlight_ports(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_psr.c +0 -0
index db27f2f..d64f039 100644
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp
 *intel_dp)
  	if (dev_priv->psr.link_standby)
  		val |= EDP_PSR_LINK_STANDBY;

drivers/gpu/drm/i915/intel_psr.c +3 -5
-	if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-		val |= EDP_PSR_TP1_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-		val |= EDP_PSR_TP1_TIME_500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP1_TIME_0us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)

  val |= EDP_PSR_TP1_TIME_100us;

drivers/gpu/drm/i915/intel_psr.c +2 -0
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP1_TIME_500us;

  else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR_TP1_TIME_0us;
+		val |= EDP_PSR_TP1_TIME_2500us;

drivers/gpu/drm/i915/intel_psr.c +3 -5
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR_TP2_TP3_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR_TP2_TP3_TIME_500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP2_TP3_TIME_0us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)

  val |= EDP_PSR_TP2_TP3_TIME_100us;

drivers/gpu/drm/i915/intel_psr.c +2 -0
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP2_TP3_TIME_500us;

  else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR_TP2_TP3_TIME_0us;
+		val |= EDP_PSR_TP2_TP3_TIME_2500us;


  if (intel_dp_source_supports_hbr2(intel_dp) && drm_dp_tps3_supported(intel_dp->dpcd))

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


  val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv-

Quoted 1 line

psr.sink_sync_latency + 1);

drivers/gpu/drm/i915/intel_psr.c +7 -6
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR2_TP2_TIME_2500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR2_TP2_TIME_500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-		val |= EDP_PSR2_TP2_TIME_100;
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+	    dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+		val |= EDP_PSR2_TP2_TIME_50us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
+		val |= EDP_PSR2_TP2_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR2_TP2_TIME_500us;

  else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR2_TP2_TIME_50;
+		val |= EDP_PSR2_TP2_TIME_2500us;
Quoted 3 lines


  I915_WRITE(EDP_PSR2_CTL, val);
 }

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

#5 lore raw
Quoted 109 lines · Dhinakaran Pandiyan
Quoted 96 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check
to change for all the platforms.

There is RCR inplace for GOP team to provide the version number to make generic change. Since Kabylake with bdb version 209 is having this
change, limiting this change to gen9_bc and version 209+ to unblock google.

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
move the 165 version check to intel_bios.c
v3: Jani
Move the abstraction to intel_bios.
v4: Jani
Rename tp*_wakeup_time to have "us" suffix.
For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
Handle option 2 in default condition.
Print oustide range value.
For negetive values default to 2500us.
v6: Jani
Handle default first and then fall through for case 2.
v7: Rodrigo
Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>
---
  drivers/gpu/drm/i915/i915_drv.h   |  4 ++--
  drivers/gpu/drm/i915/i915_reg.h   |  8 +++----
  drivers/gpu/drm/i915/intel_bios.c | 46
+++++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++----------
------
  4 files changed, 70 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 57fb3aa..268b059 100644
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
  		bool require_aux_wakeup;
  		int idle_frames;
  		enum psr_lines_to_wait lines_to_wait;
-		int tp1_wakeup_time;
-		int tp2_tp3_wakeup_time;
+		int tp1_wakeup_time_us;
+		int tp2_tp3_wakeup_time_us;
  	} psr;
 
  	struct {
drivers/gpu/drm/i915/i915_reg.h +4 -4
index f11bb21..6820658 100644
@@ -4088,10 +4088,10 @@ enum {
  #define   EDP_Y_COORDINATE_ENABLE	(1<<25) /* GLK and CNL+ */
  #define   EDP_MAX_SU_DISABLE_TIME(t)	((t)<<20)
  #define   EDP_MAX_SU_DISABLE_TIME_MASK	(0x1f<<20)
-#define   EDP_PSR2_TP2_TIME_500		(0<<8)
-#define   EDP_PSR2_TP2_TIME_100		(1<<8)
-#define   EDP_PSR2_TP2_TIME_2500	(2<<8)
-#define   EDP_PSR2_TP2_TIME_50		(3<<8)
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
+#define   EDP_PSR2_TP2_TIME_100us	(1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us	(2<<8)
+#define   EDP_PSR2_TP2_TIME_50us	(3<<8)
  #define   EDP_PSR2_TP2_TIME_MASK	(3<<8)
  #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  #define   EDP_PSR2_FRAME_BEFORE_SU_MASK	(0xf<<4)
drivers/gpu/drm/i915/intel_bios.c +0 -0
index 54270bd..695ca73 100644
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct
 drm_i915_private *dev_priv,
  		break;
  	}

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct · line 698

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +5 -2
 
-	dev_priv->vbt.psr.tp1_wakeup_time = psr_table-
 > tp1_wakeup_time;
-	dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table-
 > tp2_tp3_wakeup_time;
+	/*
+	 * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+	 * Old decimal value is wake up time in multiples of 100 us.
+	 */
+	if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {

Since this is the 'new' mapping, shouldn't this check be

Quoted 3 lines

if (version >= 209) {

}

check is for bdb version.

Quoted 1 line

i.e., what versions do BXT, GLK, CFL and CNL have?

waiting for GOP's team confirmation on above platforms. We can add them later.

Quoted 6 lines

Since gen-9 tables can have ambiguous interpretations, I think we can do this.

if (version >= 209 || (IS_GEN9() && wakeup_time <=3)) {
	// Read this as {0:500, 1:100, 2:2500, 3:0}

With old bsf file , it's multiple of 100 ms.
if user inputs 2 , thinking that it's 200 ms , with above change we are setting this to 2500 ms.
As per old spec, it should be set to 500 ms. (>1 , set to 500)
Jani /Maulik, is it okay to make the above change?

Quoted 4 lines
} else {
	// Read this as wakeup_time * 100
}
Quoted 8 lines

This is assuming all versions => 209 use the new mapping consistently.

2 and 3 are invalid values in the x*100 us scheme, so we can assume it really means 2.5 ms and 0.
1 means the same.
0 is a problem, but we can check dpcd 0071h to confirm whether the sink needs training or not. And it is safer to assume the sink needs training at interpret is as 500 us.

+ switch (psr_table->tp1_wakeup_time) {
+ case 0:
+ dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
+ break;
+ case 1:
+ dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
+ break;
+ case 3:
+ dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+ break;
+ default:
+ DRM_DEBUG_KMS("VBT tp1 wakeup time value %d
is outside range[0-3], defaulting to max value 2500us\n",
+ psr_table->tp1_wakeup_time);
+ /*fall through*/

		case 2:

+ dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
+ break;
+ }
+

Quoted 3 lines

nit: That's an interesting order, it is neither sorted by the switch variable nor by wake up time. It is easier to read if you chose one way or the other IMO.

As per Jani's suggesttion , we need to set 2500ms for out of range[0-3]. It's a fall through. should i add comment /*fall through*/ as above?

Quoted 98 lines
Quoted 98 lines
drivers/gpu/drm/i915/intel_bios.c +3 -0
+		switch (psr_table->tp2_tp3_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

100;

drivers/gpu/drm/i915/intel_bios.c +6 -0
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value

%d is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c +1 -0
+					psr_table-
Quoted 1 line

tp2_tp3_wakeup_time);

drivers/gpu/drm/i915/intel_bios.c +2 -0
+		case 2:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

2500;

drivers/gpu/drm/i915/intel_bios.c +4 -0
+		break;
+		}
+	} else {
+		dev_priv->vbt.psr.tp1_wakeup_time_us = psr_table-
Quoted 1 line

tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+		dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+	}
  }
 
  static void parse_dsi_backlight_ports(struct drm_i915_private

*dev_priv,

drivers/gpu/drm/i915/intel_psr.c +12 -12
index db27f2f..d64f039 100644
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp
 *intel_dp)
  	if (dev_priv->psr.link_standby)
  		val |= EDP_PSR_LINK_STANDBY;
 
-	if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-		val |= EDP_PSR_TP1_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-		val |= EDP_PSR_TP1_TIME_500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP1_TIME_0us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)
  		val |= EDP_PSR_TP1_TIME_100us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP1_TIME_500us;
  	else
-		val |= EDP_PSR_TP1_TIME_0us;
+		val |= EDP_PSR_TP1_TIME_2500us;
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR_TP2_TP3_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR_TP2_TP3_TIME_500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP2_TP3_TIME_0us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
  		val |= EDP_PSR_TP2_TP3_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP2_TP3_TIME_500us;
  	else
-		val |= EDP_PSR_TP2_TP3_TIME_0us;
+		val |= EDP_PSR_TP2_TP3_TIME_2500us;
 
  	if (intel_dp_source_supports_hbr2(intel_dp) &&

drm_dp_tps3_supported(intel_dp->dpcd))

drivers/gpu/drm/i915/intel_psr.c +8 -7
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct intel_dp
 *intel_dp)
 
  	val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv-
 > psr.sink_sync_latency + 1);
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR2_TP2_TIME_2500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR2_TP2_TIME_500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-		val |= EDP_PSR2_TP2_TIME_100;
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+	    dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+		val |= EDP_PSR2_TP2_TIME_50us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
+		val |= EDP_PSR2_TP2_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR2_TP2_TIME_500us;
  	else
-		val |= EDP_PSR2_TP2_TIME_50;
+		val |= EDP_PSR2_TP2_TIME_2500us;
 
Quoted 2 lines
Quoted 2 lines
  	I915_WRITE(EDP_PSR2_CTL, val);
  }

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

maintainer
#6 lore raw
Quoted 121 lines · vathsala nagaraju
Quoted 109 lines · Dhinakaran Pandiyan
Quoted 96 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check
to change for all the platforms.

There is RCR inplace for GOP team to provide the version number to make generic change. Since Kabylake with bdb version 209 is having this
change, limiting this change to gen9_bc and version 209+ to unblock google.

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
move the 165 version check to intel_bios.c
v3: Jani
Move the abstraction to intel_bios.
v4: Jani
Rename tp*_wakeup_time to have "us" suffix.
For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
Handle option 2 in default condition.
Print oustide range value.
For negetive values default to 2500us.
v6: Jani
Handle default first and then fall through for case 2.
v7: Rodrigo
Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>
---
  drivers/gpu/drm/i915/i915_drv.h   |  4 ++--
  drivers/gpu/drm/i915/i915_reg.h   |  8 +++----
  drivers/gpu/drm/i915/intel_bios.c | 46
+++++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++----------
------
  4 files changed, 70 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 57fb3aa..268b059 100644
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
  		bool require_aux_wakeup;
  		int idle_frames;
  		enum psr_lines_to_wait lines_to_wait;
-		int tp1_wakeup_time;
-		int tp2_tp3_wakeup_time;
+		int tp1_wakeup_time_us;
+		int tp2_tp3_wakeup_time_us;
  	} psr;
 
  	struct {
drivers/gpu/drm/i915/i915_reg.h +4 -4
index f11bb21..6820658 100644
@@ -4088,10 +4088,10 @@ enum {
  #define   EDP_Y_COORDINATE_ENABLE	(1<<25) /* GLK and CNL+ */
  #define   EDP_MAX_SU_DISABLE_TIME(t)	((t)<<20)
  #define   EDP_MAX_SU_DISABLE_TIME_MASK	(0x1f<<20)
-#define   EDP_PSR2_TP2_TIME_500		(0<<8)
-#define   EDP_PSR2_TP2_TIME_100		(1<<8)
-#define   EDP_PSR2_TP2_TIME_2500	(2<<8)
-#define   EDP_PSR2_TP2_TIME_50		(3<<8)
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
+#define   EDP_PSR2_TP2_TIME_100us	(1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us	(2<<8)
+#define   EDP_PSR2_TP2_TIME_50us	(3<<8)
  #define   EDP_PSR2_TP2_TIME_MASK	(3<<8)
  #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  #define   EDP_PSR2_FRAME_BEFORE_SU_MASK	(0xf<<4)
drivers/gpu/drm/i915/intel_bios.c +0 -0
index 54270bd..695ca73 100644
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct
 drm_i915_private *dev_priv,
  		break;
  	}

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct · line 698

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +5 -2
 
-	dev_priv->vbt.psr.tp1_wakeup_time = psr_table-
 > tp1_wakeup_time;
-	dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table-
 > tp2_tp3_wakeup_time;
+	/*
+	 * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+	 * Old decimal value is wake up time in multiples of 100 us.
+	 */
+	if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {

Since this is the 'new' mapping, shouldn't this check be

Quoted 3 lines

if (version >= 209) {

}

check is for bdb version.

Quoted 1 line

i.e., what versions do BXT, GLK, CFL and CNL have?

waiting for GOP's team confirmation on above platforms. We can add them later.

Quoted 4 lines

Since gen-9 tables can have ambiguous interpretations, I think we can do this.

Quoted 7 lines
Quoted 2 lines
if (version >= 209 || (IS_GEN9() && wakeup_time <=3)) {
	// Read this as {0:500, 1:100, 2:2500, 3:0}

With old bsf file , it's multiple of 100 ms.
if user inputs 2 , thinking that it's 200 ms , with above change we are setting this to 2500 ms.
As per old spec, it should be set to 500 ms. (>1 , set to 500)
Jani /Maulik, is it okay to make the above change?

I think the patch is now the way it should be. We should not change our interpretation based on the value.

BR,
Jani.

Quoted 141 lines
Quoted 12 lines
} else {
	// Read this as wakeup_time * 100
}

This is assuming all versions => 209 use the new mapping consistently.

2 and 3 are invalid values in the x*100 us scheme, so we can assume it really means 2.5 ms and 0.
1 means the same.
0 is a problem, but we can check dpcd 0071h to confirm whether the sink needs training or not. And it is safer to assume the sink needs training at interpret is as 500 us.

drivers/gpu/drm/i915/intel_bios.c +12 -0
+		switch (psr_table->tp1_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp1 wakeup time value %d

is outside range[0-3], defaulting to max value 2500us\n",

(quoted diff) +2 -0
+					psr_table->tp1_wakeup_time);
+		/*fall through*/
		case 2:
drivers/gpu/drm/i915/intel_bios.c +4 -0
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
+			break;
+		}
+
Quoted 4 lines

nit: That's an interesting order, it is neither sorted by the switch variable nor by wake up time. It is easier to read if you chose one way or the other IMO.

As per Jani's suggesttion , we need to set 2500ms for out of range[0-3]. It's a fall through.
should i add comment /*fall through*/ as above?

Quoted 100 lines
Quoted 100 lines
drivers/gpu/drm/i915/intel_bios.c +3 -0
+		switch (psr_table->tp2_tp3_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

100;

drivers/gpu/drm/i915/intel_bios.c +6 -0
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value

%d is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c +1 -0
+					psr_table-
Quoted 1 line

tp2_tp3_wakeup_time);

drivers/gpu/drm/i915/intel_bios.c +2 -0
+		case 2:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

2500;

drivers/gpu/drm/i915/intel_bios.c +4 -0
+		break;
+		}
+	} else {
+		dev_priv->vbt.psr.tp1_wakeup_time_us = psr_table-
Quoted 1 line

tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+		dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+	}
  }
 
  static void parse_dsi_backlight_ports(struct drm_i915_private

*dev_priv,

drivers/gpu/drm/i915/intel_psr.c +12 -12
index db27f2f..d64f039 100644
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp
 *intel_dp)
  	if (dev_priv->psr.link_standby)
  		val |= EDP_PSR_LINK_STANDBY;
 
-	if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-		val |= EDP_PSR_TP1_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-		val |= EDP_PSR_TP1_TIME_500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP1_TIME_0us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)
  		val |= EDP_PSR_TP1_TIME_100us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP1_TIME_500us;
  	else
-		val |= EDP_PSR_TP1_TIME_0us;
+		val |= EDP_PSR_TP1_TIME_2500us;
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR_TP2_TP3_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR_TP2_TP3_TIME_500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP2_TP3_TIME_0us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
  		val |= EDP_PSR_TP2_TP3_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP2_TP3_TIME_500us;
  	else
-		val |= EDP_PSR_TP2_TP3_TIME_0us;
+		val |= EDP_PSR_TP2_TP3_TIME_2500us;
 
  	if (intel_dp_source_supports_hbr2(intel_dp) &&

drm_dp_tps3_supported(intel_dp->dpcd))

drivers/gpu/drm/i915/intel_psr.c +8 -7
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct intel_dp
 *intel_dp)
 
  	val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv-
 > psr.sink_sync_latency + 1);
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR2_TP2_TIME_2500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR2_TP2_TIME_500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-		val |= EDP_PSR2_TP2_TIME_100;
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+	    dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+		val |= EDP_PSR2_TP2_TIME_50us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
+		val |= EDP_PSR2_TP2_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR2_TP2_TIME_500us;
  	else
-		val |= EDP_PSR2_TP2_TIME_50;
+		val |= EDP_PSR2_TP2_TIME_2500us;
 
  	I915_WRITE(EDP_PSR2_CTL, val);
  }
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#7 lore raw
Quoted 149 lines · Jani Nikula
Quoted 139 lines · vathsala nagaraju
Quoted 123 lines · Dhinakaran Pandiyan
Quoted 117 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0- 3] for
TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt
structure. Since spec does not  mention from which VBT version this
change was added to vbt.bsf file, we cannot depend on bdb-

Quoted 1 line

version

check
to change for all the platforms.

There is RCR inplace for GOP team to  provide the version number
to make generic change. Since Kabylake with bdb version 209 is having
this
change, limiting this change to gen9_bc and version 209+ to unblock
google.

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
     move the 165 version check to intel_bios.c
v3: Jani
     Move the abstraction to intel_bios.
v4: Jani
     Rename tp*_wakeup_time to have "us" suffix.
     For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
     Handle option 2 in default condition.
     Print oustide range value.
     For negetive values default to 2500us.
v6: Jani
     Handle default first and then fall through for case 2.
v7: Rodrigo
     Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>

---
  drivers/gpu/drm/i915/i915_drv.h   |  4 ++-- drivers/gpu/drm/i915/i915_reg.h   |  8 +++---- drivers/gpu/drm/i915/intel_bios.c | 46
+++++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++-----
-----
------

  4 files changed, 70 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 57fb3aa..268b059 100644
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
   		bool require_aux_wakeup;
   		int idle_frames;
   		enum psr_lines_to_wait lines_to_wait;
-		int tp1_wakeup_time;
-		int tp2_tp3_wakeup_time;
+		int tp1_wakeup_time_us;
+		int tp2_tp3_wakeup_time_us;
   	} psr;


   struct {

drivers/gpu/drm/i915/i915_reg.h +0 -0
index f11bb21..6820658 100644
@@ -4088,10 +4088,10 @@ enum {
   #define   EDP_Y_COORDINATE_ENABLE	(1<<25) /* GLK and

CNL+ */
  #define   EDP_MAX_SU_DISABLE_TIME(t) ((t)<<20)
  #define   EDP_MAX_SU_DISABLE_TIME_MASK (0x1f<<20)

drivers/gpu/drm/i915/i915_reg.h +4 -4
-#define   EDP_PSR2_TP2_TIME_500		(0<<8)
-#define   EDP_PSR2_TP2_TIME_100		(1<<8)
-#define   EDP_PSR2_TP2_TIME_2500	(2<<8)
-#define   EDP_PSR2_TP2_TIME_50		(3<<8)
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
+#define   EDP_PSR2_TP2_TIME_100us	(1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us	(2<<8)
+#define   EDP_PSR2_TP2_TIME_50us	(3<<8)

  #define   EDP_PSR2_TP2_TIME_MASK (3<<8)
  #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  #define   EDP_PSR2_FRAME_BEFORE_SU_MASK (0xf<<4)

drivers/gpu/drm/i915/intel_bios.c +0 -0
index 54270bd..695ca73 100644
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct
 drm_i915_private *dev_priv,
   		break;
   	}

drivers/gpu/drm/i915/intel_bios.c +0 -1
-	dev_priv->vbt.psr.tp1_wakeup_time = psr_table-
Quoted 2 lines

tp1_wakeup_time;

drivers/gpu/drm/i915/intel_bios.c +0 -1
-	dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table-
Quoted 2 lines

tp2_tp3_wakeup_time;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+	/*
+	 * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+	 * Old decimal value is wake up time in multiples of

100 us.

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv, · line 695

Quoted 2 lines
drivers/gpu/drm/i915/intel_bios.c +2 -0
+	 */
+	if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {

Since this is the 'new' mapping, shouldn't this check be

Quoted 3 lines

if (version >= 209) {

}

check is for bdb version.

Quoted 2 lines

i.e., what versions do BXT, GLK, CFL and CNL have?

waiting for GOP's team confirmation on above platforms. We can add them later.

Quoted 6 lines

Since gen-9 tables can have ambiguous interpretations, I think we can
do this.

Quoted 8 lines
Quoted 2 lines
if (version >= 209 || (IS_GEN9() && wakeup_time <=3)) {
	// Read this as {0:500, 1:100, 2:2500, 3:0}

With old bsf file , it's multiple of 100 ms.
if user inputs  2  , thinking that  it's 200 ms , with above change we
are setting this to  2500 ms.
As per old spec, it should be set to 500 ms.   (>1 , set to 500) Jani /Maulik, is it okay to make the above change?

Quoted 3 lines

I think the patch is now the way it should be. We should not change our
interpretation based on the value.

Is it correct to infer, from your response, that VBT values are not always set based on hardware capability as documented in bspec?

Quoted 168 lines

BR,
Jani.

Quoted 162 lines
Quoted 17 lines

} else {
	// Read this as wakeup_time * 100
}

This is assuming all versions => 209 use the new mapping consistently.

2 and 3 are invalid values in the x*100 us scheme, so we can assume it
really means 2.5 ms and 0.
1 means the same.
0 is a problem, but we can check dpcd 0071h to confirm whether the sink
needs training or not. And it is safer to assume the sink needs training at interpret is as 500 us.

drivers/gpu/drm/i915/intel_bios.c +3 -0
+		switch (psr_table->tp1_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp1_wakeup_time_us =

500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp1_wakeup_time_us =

100;

drivers/gpu/drm/i915/intel_bios.c +6 -0
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp1 wakeup time value

%d
is outside range[0-3], defaulting to max value 2500us\n",

(quoted diff) +1 -0
+					psr_table-
Quoted 1 line

tp1_wakeup_time);

(quoted diff) +1 -0
+		/*fall through*/
		case 2:
(quoted diff) +1 -0
+			dev_priv->vbt.psr.tp1_wakeup_time_us =

2500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		}
+
Quoted 7 lines

nit: That's an interesting order, it is neither sorted by the switch
variable nor by wake up time. It is easier to read if you chose one way
or the other IMO.

As per Jani's suggesttion , we need to set 2500ms for out of range[0-3].
It's a fall through.
should i add comment /*fall through*/  as above?

Quoted 109 lines

Quoted 107 lines
drivers/gpu/drm/i915/intel_bios.c +3 -0
+		switch (psr_table->tp2_tp3_wakeup_time) {
+		case 0:
+			dev_priv-
Quoted 1 line

vbt.psr.tp2_tp3_wakeup_time_us =

500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 1:
+			dev_priv-
Quoted 1 line

vbt.psr.tp2_tp3_wakeup_time_us =

100;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us =

0;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time

value
%d is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c +1 -0
+					psr_table-
Quoted 2 lines

tp2_tp3_wakeup_time);

drivers/gpu/drm/i915/intel_bios.c +2 -0
+		case 2:
+			dev_priv-
Quoted 1 line

vbt.psr.tp2_tp3_wakeup_time_us =

2500;

drivers/gpu/drm/i915/intel_bios.c +4 -0
+		break;
+		}
+	} else {
+		dev_priv->vbt.psr.tp1_wakeup_time_us =

psr_table-

Quoted 2 lines

tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+		dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+	}

  }

  static void parse_dsi_backlight_ports(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_psr.c +0 -0
index db27f2f..d64f039 100644
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct

intel_dp
*intel_dp)
   if (dev_priv->psr.link_standby)
   val |= EDP_PSR_LINK_STANDBY;

drivers/gpu/drm/i915/intel_psr.c +3 -5
-	if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-		val |= EDP_PSR_TP1_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-		val |= EDP_PSR_TP1_TIME_500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP1_TIME_0us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)

   val |= EDP_PSR_TP1_TIME_100us;

drivers/gpu/drm/i915/intel_psr.c +2 -0
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP1_TIME_500us;

   else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR_TP1_TIME_0us;
+		val |= EDP_PSR_TP1_TIME_2500us;

drivers/gpu/drm/i915/intel_psr.c +3 -5
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR_TP2_TP3_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR_TP2_TP3_TIME_500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP2_TP3_TIME_0us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=

100)
   val |= EDP_PSR_TP2_TP3_TIME_100us;

drivers/gpu/drm/i915/intel_psr.c +1 -0
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=

500)

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

   else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR_TP2_TP3_TIME_0us;
+		val |= EDP_PSR_TP2_TP3_TIME_2500us;


   if (intel_dp_source_supports_hbr2(intel_dp) && drm_dp_tps3_supported(intel_dp->dpcd))

drivers/gpu/drm/i915/intel_psr.c +0 -0
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct

intel_dp
*intel_dp)

   val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv-

Quoted 2 lines

psr.sink_sync_latency + 1);

drivers/gpu/drm/i915/intel_psr.c +4 -6
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR2_TP2_TIME_2500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR2_TP2_TIME_500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-		val |= EDP_PSR2_TP2_TIME_100;
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+	    dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+		val |= EDP_PSR2_TP2_TIME_50us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=

100)

drivers/gpu/drm/i915/intel_psr.c +2 -0
+		val |= EDP_PSR2_TP2_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

500)

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

   else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR2_TP2_TIME_50;
+		val |= EDP_PSR2_TP2_TIME_2500us;


   I915_WRITE(EDP_PSR2_CTL, val);
  }

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

maintainer
#8 lore raw
Quoted 6 lines · Dhinakaran Pandiyan
Quoted 2 lines · Jani Nikula

I think the patch is now the way it should be. We should not change our interpretation based on the value.

Is it correct to infer, from your response, that VBT values are not always set based on hardware capability as documented in bspec?

Correct. I think it was the good intention of the VBT change to only allow values that map to valid hardware values, but I think it has caused much more trouble than it has helped.

First, the change was not universally tied to a VBT version, and I've seen VBTs in the wild with version >= 209 that still use multiples of 100 us. (And the spec is still in contradiction with itself.)

Second, regardless of mapping or multiples of 100 us we need to verify our input. Because I've seen VBTs in the wild that are bogus regardless of how they're supposed to be interpreted.

Third, we already had the code in place to map multiples of 100 us to hardware. We'll need to keep that practically forever. And now we need to have *another* mapping.

Fourth, the multiples of 100 us does not require *any* spec change when hardware changes to support different values. The new mapping requires changes throughout the stack that looks at the values. (Basically I object to any VBT specification that says anything platform dependent. It should be generic.)

Now, the patch at hand uses the best guesses we can make to translate whatever the VBT has to microseconds, in intel_bios.c. That part does not care about hardware capability. For validity, it only looks at what we think is according to VBT spec. It should be hardware agnostic, except for the IS_GEN9_BC() thing, which should probably include gen10+ too.

The code in intel_psr.c gets the microseconds as input, and maps that to hardware capability as best we can, erring towards longer delays.

Two different abstractions for two different things. One to abstract VBT, another to abstract hardware. This is in line with the direction I've tried to take intel_bios.c and VBT parsing and the VBT spec (the little I've had influence for that) for the longest time. We must not let the VBT abstractions to leak into the driver code.

BR,
Jani.

Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#9 lore raw
Quoted 50 lines · Jani Nikula
Quoted 8 lines · Dhinakaran Pandiyan
Quoted 4 lines · Jani Nikula

I think the patch is now the way it should be. We should not change
our interpretation based on the value.

Is it correct to infer, from your response, that VBT values are not always set based on hardware capability as documented in bspec?

Correct. I think it was the good intention of the VBT change to only allow values that map to valid hardware values, but I think it has caused much more trouble than it has helped.

First, the change was not universally tied to a VBT version, and I've seen VBTs in the wild with version >= 209 that still use multiples of 100 us. (And the spec is still in contradiction with itself.)

Second, regardless of mapping or multiples of 100 us we need to verify
our input. Because I've seen VBTs in the wild that are bogus regardless
of how they're supposed to be interpreted.

Third, we already had the code in place to map multiples of 100 us to hardware. We'll need to keep that practically forever. And now we need
to have *another* mapping.

Fourth, the multiples of 100 us does not require *any* spec change when
hardware changes to support different values. The new mapping requires
changes throughout the stack that looks at the values. (Basically I object to any VBT specification that says anything platform dependent. It should be generic.)

Now, the patch at hand uses the best guesses we can make to translate whatever the VBT has to microseconds, in intel_bios.c. That part does not care about hardware capability. For validity, it only looks at what
we think is according to VBT spec. It should be hardware agnostic, except for the IS_GEN9_BC() thing, which should probably include gen10+
too.

The code in intel_psr.c gets the microseconds as input, and maps that to
hardware capability as best we can, erring towards longer delays.

Quoted 5 lines

Two different abstractions for two different things. One to abstract VBT, another to abstract hardware. This is in line with the direction I've tried to take intel_bios.c and VBT parsing and the VBT spec (the little I've had influence for that) for the longest time. We must not let the VBT abstractions to leak into the driver code.

Thanks for the detailed explanation of the problem and the idea behind the design.

-DK

Quoted 4 lines

BR,
Jani.

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

maintainer
#10 lore raw
In reply to vathsala nagaraju
Quoted 110 lines · vathsala nagaraju
Quoted 109 lines · Dhinakaran Pandiyan
Quoted 96 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check
to change for all the platforms.

There is RCR inplace for GOP team to provide the version number to make generic change. Since Kabylake with bdb version 209 is having this
change, limiting this change to gen9_bc and version 209+ to unblock google.

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
move the 165 version check to intel_bios.c
v3: Jani
Move the abstraction to intel_bios.
v4: Jani
Rename tp*_wakeup_time to have "us" suffix.
For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
Handle option 2 in default condition.
Print oustide range value.
For negetive values default to 2500us.
v6: Jani
Handle default first and then fall through for case 2.
v7: Rodrigo
Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>
---
  drivers/gpu/drm/i915/i915_drv.h   |  4 ++--
  drivers/gpu/drm/i915/i915_reg.h   |  8 +++----
  drivers/gpu/drm/i915/intel_bios.c | 46
+++++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++----------
------
  4 files changed, 70 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 57fb3aa..268b059 100644
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
  		bool require_aux_wakeup;
  		int idle_frames;
  		enum psr_lines_to_wait lines_to_wait;
-		int tp1_wakeup_time;
-		int tp2_tp3_wakeup_time;
+		int tp1_wakeup_time_us;
+		int tp2_tp3_wakeup_time_us;
  	} psr;
 
  	struct {
drivers/gpu/drm/i915/i915_reg.h +4 -4
index f11bb21..6820658 100644
@@ -4088,10 +4088,10 @@ enum {
  #define   EDP_Y_COORDINATE_ENABLE	(1<<25) /* GLK and CNL+ */
  #define   EDP_MAX_SU_DISABLE_TIME(t)	((t)<<20)
  #define   EDP_MAX_SU_DISABLE_TIME_MASK	(0x1f<<20)
-#define   EDP_PSR2_TP2_TIME_500		(0<<8)
-#define   EDP_PSR2_TP2_TIME_100		(1<<8)
-#define   EDP_PSR2_TP2_TIME_2500	(2<<8)
-#define   EDP_PSR2_TP2_TIME_50		(3<<8)
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
+#define   EDP_PSR2_TP2_TIME_100us	(1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us	(2<<8)
+#define   EDP_PSR2_TP2_TIME_50us	(3<<8)
  #define   EDP_PSR2_TP2_TIME_MASK	(3<<8)
  #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  #define   EDP_PSR2_FRAME_BEFORE_SU_MASK	(0xf<<4)
drivers/gpu/drm/i915/intel_bios.c +0 -0
index 54270bd..695ca73 100644
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct
 drm_i915_private *dev_priv,
  		break;
  	}

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct · line 698

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +5 -2
 
-	dev_priv->vbt.psr.tp1_wakeup_time = psr_table-
 > tp1_wakeup_time;
-	dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table-
 > tp2_tp3_wakeup_time;
+	/*
+	 * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+	 * Old decimal value is wake up time in multiples of 100 us.
+	 */
+	if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {

Since this is the 'new' mapping, shouldn't this check be

Quoted 4 lines
Quoted 3 lines

if (version >= 209) {

}

check is for bdb version.

The reality is that this was screwed up royally. We have to include the platform checks. I hate it as much as you do.

Besides, IMO there was *never* *any* need to change the encoding to begin with. The driver has to check the values against what the hardware is capable of, so the right course of action would have been to keep it as a multiple of 100 us. It's the only sensible thing, and forward compatible for all platforms to come. Now we map the VBT crap to us, and then back to what the hardware can do. Ugh.

BR,
Jani.

Quoted 155 lines
Quoted 1 line

i.e., what versions do BXT, GLK, CFL and CNL have?

waiting for GOP's team confirmation on above platforms. We can add them later.

Quoted 6 lines

Since gen-9 tables can have ambiguous interpretations, I think we can do this.

if (version >= 209 || (IS_GEN9() && wakeup_time <=3)) {
	// Read this as {0:500, 1:100, 2:2500, 3:0}

With old bsf file , it's multiple of 100 ms.
if user inputs 2 , thinking that it's 200 ms , with above change we are setting this to 2500 ms.
As per old spec, it should be set to 500 ms. (>1 , set to 500)
Jani /Maulik, is it okay to make the above change?

Quoted 12 lines
} else {
	// Read this as wakeup_time * 100
}

This is assuming all versions => 209 use the new mapping consistently.

2 and 3 are invalid values in the x*100 us scheme, so we can assume it really means 2.5 ms and 0.
1 means the same.
0 is a problem, but we can check dpcd 0071h to confirm whether the sink needs training or not. And it is safer to assume the sink needs training at interpret is as 500 us.

drivers/gpu/drm/i915/intel_bios.c +12 -0
+		switch (psr_table->tp1_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp1 wakeup time value %d

is outside range[0-3], defaulting to max value 2500us\n",

(quoted diff) +2 -0
+					psr_table->tp1_wakeup_time);
+		/*fall through*/
		case 2:
drivers/gpu/drm/i915/intel_bios.c +4 -0
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
+			break;
+		}
+
Quoted 4 lines

nit: That's an interesting order, it is neither sorted by the switch variable nor by wake up time. It is easier to read if you chose one way or the other IMO.

As per Jani's suggesttion , we need to set 2500ms for out of range[0-3]. It's a fall through.
should i add comment /*fall through*/ as above?

Quoted 100 lines
Quoted 100 lines
drivers/gpu/drm/i915/intel_bios.c +3 -0
+		switch (psr_table->tp2_tp3_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

100;

drivers/gpu/drm/i915/intel_bios.c +6 -0
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value

%d is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c +1 -0
+					psr_table-
Quoted 1 line

tp2_tp3_wakeup_time);

drivers/gpu/drm/i915/intel_bios.c +2 -0
+		case 2:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

2500;

drivers/gpu/drm/i915/intel_bios.c +4 -0
+		break;
+		}
+	} else {
+		dev_priv->vbt.psr.tp1_wakeup_time_us = psr_table-
Quoted 1 line

tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+		dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+	}
  }
 
  static void parse_dsi_backlight_ports(struct drm_i915_private

*dev_priv,

drivers/gpu/drm/i915/intel_psr.c +12 -12
index db27f2f..d64f039 100644
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp
 *intel_dp)
  	if (dev_priv->psr.link_standby)
  		val |= EDP_PSR_LINK_STANDBY;
 
-	if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-		val |= EDP_PSR_TP1_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-		val |= EDP_PSR_TP1_TIME_500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP1_TIME_0us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)
  		val |= EDP_PSR_TP1_TIME_100us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP1_TIME_500us;
  	else
-		val |= EDP_PSR_TP1_TIME_0us;
+		val |= EDP_PSR_TP1_TIME_2500us;
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR_TP2_TP3_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR_TP2_TP3_TIME_500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP2_TP3_TIME_0us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
  		val |= EDP_PSR_TP2_TP3_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP2_TP3_TIME_500us;
  	else
-		val |= EDP_PSR_TP2_TP3_TIME_0us;
+		val |= EDP_PSR_TP2_TP3_TIME_2500us;
 
  	if (intel_dp_source_supports_hbr2(intel_dp) &&

drm_dp_tps3_supported(intel_dp->dpcd))

drivers/gpu/drm/i915/intel_psr.c +8 -7
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct intel_dp
 *intel_dp)
 
  	val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv-
 > psr.sink_sync_latency + 1);
 
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR2_TP2_TIME_2500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR2_TP2_TIME_500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-		val |= EDP_PSR2_TP2_TIME_100;
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+	    dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+		val |= EDP_PSR2_TP2_TIME_50us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
+		val |= EDP_PSR2_TP2_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+		val |= EDP_PSR2_TP2_TIME_500us;
  	else
-		val |= EDP_PSR2_TP2_TIME_50;
+		val |= EDP_PSR2_TP2_TIME_2500us;
 
  	I915_WRITE(EDP_PSR2_CTL, val);
  }
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#11 lore raw
In reply to vathsala nagaraju
Quoted 183 lines · vathsala nagaraju
Quoted 122 lines · Dhinakaran Pandiyan
Quoted 116 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0-3] for
TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt
structure. Since spec does not  mention from which VBT version this
change was added to vbt.bsf file, we cannot depend on bdb-

Quoted 1 line

version

check
to change for all the platforms.

There is RCR inplace for GOP team to  provide the version number to make generic change. Since Kabylake with bdb version 209 is having
this
change, limiting this change to gen9_bc and version 209+ to unblock
google.

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
     move the 165 version check to intel_bios.c
v3: Jani
     Move the abstraction to intel_bios.
v4: Jani
     Rename tp*_wakeup_time to have "us" suffix.
     For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
     Handle option 2 in default condition.
     Print oustide range value.
     For negetive values default to 2500us.
v6: Jani
     Handle default first and then fall through for case 2.
v7: Rodrigo
     Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>

---
  drivers/gpu/drm/i915/i915_drv.h   |  4 ++-- drivers/gpu/drm/i915/i915_reg.h   |  8 +++---- drivers/gpu/drm/i915/intel_bios.c | 46
+++++++++++++++++++++++++++++++++++++--
  drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++-------
---
------

  4 files changed, 70 insertions(+), 27 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -2
index 57fb3aa..268b059 100644
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
   		bool require_aux_wakeup;
   		int idle_frames;
   		enum psr_lines_to_wait lines_to_wait;
-		int tp1_wakeup_time;
-		int tp2_tp3_wakeup_time;
+		int tp1_wakeup_time_us;
+		int tp2_tp3_wakeup_time_us;
   	} psr;


   struct {

drivers/gpu/drm/i915/i915_reg.h +0 -0
index f11bb21..6820658 100644
@@ -4088,10 +4088,10 @@ enum {
   #define   EDP_Y_COORDINATE_ENABLE	(1<<25) /* GLK and

CNL+ */
  #define   EDP_MAX_SU_DISABLE_TIME(t) ((t)<<20)
  #define   EDP_MAX_SU_DISABLE_TIME_MASK (0x1f<<20)

drivers/gpu/drm/i915/i915_reg.h +4 -4
-#define   EDP_PSR2_TP2_TIME_500		(0<<8)
-#define   EDP_PSR2_TP2_TIME_100		(1<<8)
-#define   EDP_PSR2_TP2_TIME_2500	(2<<8)
-#define   EDP_PSR2_TP2_TIME_50		(3<<8)
+#define   EDP_PSR2_TP2_TIME_500us	(0<<8)
+#define   EDP_PSR2_TP2_TIME_100us	(1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us	(2<<8)
+#define   EDP_PSR2_TP2_TIME_50us	(3<<8)

  #define   EDP_PSR2_TP2_TIME_MASK (3<<8)
  #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  #define   EDP_PSR2_FRAME_BEFORE_SU_MASK (0xf<<4)

drivers/gpu/drm/i915/intel_bios.c +0 -0
index 54270bd..695ca73 100644
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct
 drm_i915_private *dev_priv,
   		break;
   	}

drivers/gpu/drm/i915/intel_bios.c +0 -1
-	dev_priv->vbt.psr.tp1_wakeup_time = psr_table-
Quoted 2 lines

tp1_wakeup_time;

drivers/gpu/drm/i915/intel_bios.c +0 -1
-	dev_priv->vbt.psr.tp2_tp3_wakeup_time = psr_table-
Quoted 2 lines

tp2_tp3_wakeup_time;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+	/*
+	 * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+	 * Old decimal value is wake up time in multiples of 100

us.

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv, · line 695

Quoted 2 lines
drivers/gpu/drm/i915/intel_bios.c +2 -0
+	 */
+	if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {

Since this is the 'new' mapping, shouldn't this check be

Quoted 3 lines

if (version >= 209) {

}

check is for bdb version.

Quoted 2 lines

i.e., what versions do BXT, GLK, CFL and CNL have?

waiting for GOP's team confirmation on above platforms. We can add them later.

Quoted 8 lines

Since gen-9 tables can have ambiguous interpretations, I think we can
do this.

if (version >= 209 || (IS_GEN9() && wakeup_time <=3)) {
	// Read this as {0:500, 1:100, 2:2500, 3:0}

With old bsf file , it's multiple of 100 ms.
if user inputs  2  , thinking that  it's 200 ms , with above change we
are setting this to  2500 ms.
As per old spec, it should be set to 500 ms.   (>1 , set to 500) Jani /Maulik, is it okay to make the above change?

Quoted 16 lines
} else {
	// Read this as wakeup_time * 100
}

This is assuming all versions => 209 use the new mapping consistently.

2 and 3 are invalid values in the x*100 us scheme, so we can assume it
really means 2.5 ms and 0.
1 means the same.
0 is a problem, but we can check dpcd 0071h to confirm whether the sink
needs training or not. And it is safer to assume the sink needs training at interpret is as 500 us.

drivers/gpu/drm/i915/intel_bios.c +12 -0
+		switch (psr_table->tp1_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp1 wakeup time value %d

is outside range[0-3], defaulting to max value 2500us\n",

(quoted diff) +2 -0
+					psr_table->tp1_wakeup_time);
+		/*fall through*/
		case 2:
drivers/gpu/drm/i915/intel_bios.c +4 -0
+			dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
+			break;
+		}
+
Quoted 2 lines
Quoted 7 lines
Quoted 5 lines

nit: That's an interesting order, it is neither sorted by the switch
variable nor by wake up time. It is easier to read if you chose one way
or the other IMO.

As per Jani's suggesttion , we need to set 2500ms for out of range[0- 3].

This is what I meant -
               switch (psr_table->tp1_wakeup_time) {
                case 0:
                        dev_priv->vbt.psr.tp1_wakeup_time_us = 500; break;
                case 1:
                        dev_priv->vbt.psr.tp1_wakeup_time_us = 100; break;
                default:
                        DRM_DEBUG_KMS("VBT tp1 wakeup time value %d is outside range[0-3], defaulting to max value 2500us\n", psr_table->tp1_wakeup_time); case 2:
                        dev_priv->vbt.psr.tp1_wakeup_time_us = 2500; break;

                case 3:
                        dev_priv->vbt.psr.tp1_wakeup_time_us = 0; break;
                }

Quoted 2 lines

It's a fall through.
should i add comment /*fall through*/  as above?

Yeah, no harm in adding that and iirc you get a gcc warning if the fall through isn't marked..

Quoted 109 lines
Quoted 109 lines

Quoted 107 lines
drivers/gpu/drm/i915/intel_bios.c +3 -0
+		switch (psr_table->tp2_tp3_wakeup_time) {
+		case 0:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us 

=
500;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 1:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us 

=
100;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		case 3:
+			dev_priv->vbt.psr.tp1_wakeup_time_us =

0;

drivers/gpu/drm/i915/intel_bios.c +3 -0
+			break;
+		default:
+			DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time

value
%d is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c +1 -0
+					psr_table-
Quoted 2 lines

tp2_tp3_wakeup_time);

drivers/gpu/drm/i915/intel_bios.c +2 -0
+		case 2:
+			dev_priv->vbt.psr.tp2_tp3_wakeup_time_us 

=
2500;

drivers/gpu/drm/i915/intel_bios.c +4 -0
+		break;
+		}
+	} else {
+		dev_priv->vbt.psr.tp1_wakeup_time_us =

psr_table-

Quoted 2 lines

tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+		dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c +1 -0
+	}

  }

  static void parse_dsi_backlight_ports(struct drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_psr.c +0 -0
index db27f2f..d64f039 100644
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct

intel_dp
*intel_dp)
   if (dev_priv->psr.link_standby)
   val |= EDP_PSR_LINK_STANDBY;

drivers/gpu/drm/i915/intel_psr.c +3 -5
-	if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-		val |= EDP_PSR_TP1_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-		val |= EDP_PSR_TP1_TIME_500us;
-	else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP1_TIME_0us;
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)

   val |= EDP_PSR_TP1_TIME_100us;

drivers/gpu/drm/i915/intel_psr.c +2 -0
+	else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+		val |= EDP_PSR_TP1_TIME_500us;

   else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR_TP1_TIME_0us;
+		val |= EDP_PSR_TP1_TIME_2500us;

drivers/gpu/drm/i915/intel_psr.c +3 -5
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR_TP2_TP3_TIME_2500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR_TP2_TP3_TIME_500us;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+		val |=  EDP_PSR_TP2_TP3_TIME_0us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=

100)
   val |= EDP_PSR_TP2_TP3_TIME_100us;

drivers/gpu/drm/i915/intel_psr.c +1 -0
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=

500)

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

   else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR_TP2_TP3_TIME_0us;
+		val |= EDP_PSR_TP2_TP3_TIME_2500us;


   if (intel_dp_source_supports_hbr2(intel_dp) && drm_dp_tps3_supported(intel_dp->dpcd))

drivers/gpu/drm/i915/intel_psr.c +0 -0
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct

intel_dp
*intel_dp)

   val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv-

Quoted 2 lines

psr.sink_sync_latency + 1);

drivers/gpu/drm/i915/intel_psr.c +4 -6
-	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-		val |= EDP_PSR2_TP2_TIME_2500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-		val |= EDP_PSR2_TP2_TIME_500;
-	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-		val |= EDP_PSR2_TP2_TIME_100;
+	if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+	    dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+		val |= EDP_PSR2_TP2_TIME_50us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=

100)

drivers/gpu/drm/i915/intel_psr.c +2 -0
+		val |= EDP_PSR2_TP2_TIME_100us;
+	else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <=
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

500)

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

   else

drivers/gpu/drm/i915/intel_psr.c +1 -1
-		val |= EDP_PSR2_TP2_TIME_50;
+		val |= EDP_PSR2_TP2_TIME_2500us;


   I915_WRITE(EDP_PSR2_CTL, val);
  }

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

#12 lore raw
In reply to vathsala nagaraju
Quoted 11 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>

For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check to change for all the platforms.

There is RCR inplace for GOP team to provide the version number to make generic change. Since Kabylake with bdb version 209 is having this change, limiting this change to gen9_bc and version 209+ to unblock

google.

Quoted 25 lines

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options.

bspec 20131

v2: (Jani and Rodrigo)
move the 165 version check to intel_bios.c
v3: Jani
Move the abstraction to intel_bios.
v4: Jani
Rename tp*_wakeup_time to have "us" suffix.
For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
Handle option 2 in default condition.
Print oustide range value.
For negetive values default to 2500us.
v6: Jani
Handle default first and then fall through for case 2.
v7: Rodrigo
Apply this change for IS_GEN9_BC and vbt version > 209

Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>
Quoted 6 lines
---
  drivers/gpu/drm/i915/i915_drv.h   |  4 ++--
  drivers/gpu/drm/i915/i915_reg.h   |  8 +++----
  drivers/gpu/drm/i915/intel_bios.c | 46

+++++++++++++++++++++++++++++++++++++--

Review

Quoted 4 lines
  drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++----------------
  4 files changed, 70 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h

Review

Quoted 15 lines

index 57fb3aa..268b059 100644

drivers/gpu/drm/i915/i915_drv.h +2 -2
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
                 bool require_aux_wakeup;
                 int idle_frames;
                 enum psr_lines_to_wait lines_to_wait;
-               int tp1_wakeup_time;
-               int tp2_tp3_wakeup_time;
+               int tp1_wakeup_time_us;
+               int tp2_tp3_wakeup_time_us;
         } psr;
 
         struct {
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h

Review

Quoted 19 lines

index f11bb21..6820658 100644

drivers/gpu/drm/i915/i915_reg.h +4 -4
@@ -4088,10 +4088,10 @@ enum {
  #define   EDP_Y_COORDINATE_ENABLE      (1<<25) /* GLK and CNL+ */
  #define   EDP_MAX_SU_DISABLE_TIME(t)   ((t)<<20)
  #define   EDP_MAX_SU_DISABLE_TIME_MASK (0x1f<<20)
-#define   EDP_PSR2_TP2_TIME_500                (0<<8)
-#define   EDP_PSR2_TP2_TIME_100                (1<<8)
-#define   EDP_PSR2_TP2_TIME_2500       (2<<8)
-#define   EDP_PSR2_TP2_TIME_50         (3<<8)
+#define   EDP_PSR2_TP2_TIME_500us      (0<<8)
+#define   EDP_PSR2_TP2_TIME_100us      (1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us     (2<<8)
+#define   EDP_PSR2_TP2_TIME_50us       (3<<8)
  #define   EDP_PSR2_TP2_TIME_MASK       (3<<8)
  #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
  #define   EDP_PSR2_FRAME_BEFORE_SU_MASK        (0xf<<4)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_bios.c

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct

Quoted 4 lines

index 54270bd..695ca73 100644

drivers/gpu/drm/i915/intel_bios.c +0 -0
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct

drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 5 lines
drivers/gpu/drm/i915/intel_bios.c +0 -2
                 break;
         }
 
-       dev_priv->vbt.psr.tp1_wakeup_time = psr_table->tp1_wakeup_time;
-       dev_priv->vbt.psr.tp2_tp3_wakeup_time =

psr_table->tp2_tp3_wakeup_time;

Quoted 7 lines
drivers/gpu/drm/i915/intel_bios.c +7 -0
+       /*
+        * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+        * Old decimal value is wake up time in multiples of 100 us.
+        */
+       if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {
+               switch (psr_table->tp1_wakeup_time) {
+               case 0:

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +10 -0
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
+                       break;
+               case 1:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
+                       break;
+               case 3:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+                       break;
+               default:
+                       DRM_DEBUG_KMS("VBT tp1 wakeup time value %d is

outside range[0-3], defaulting to max value 2500us\n",

Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c +8 -0
+                                       psr_table->tp1_wakeup_time);
+               case 2:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
+                       break;
+               }
+
+               switch (psr_table->tp2_tp3_wakeup_time) {
+               case 0:

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +10 -0
+                       dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 500;
+                       break;
+               case 1:
+                       dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 100;
+                       break;
+               case 3:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+                       break;
+               default:
+                       DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value %d

is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 7 lines
drivers/gpu/drm/i915/intel_bios.c +7 -0
+                                       psr_table->tp2_tp3_wakeup_time);
+               case 2:
+                       dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 2500;
+               break;
+               }
+       } else {
+               dev_priv->vbt.psr.tp1_wakeup_time_us =

psr_table->tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct · line 733

Quoted 1 line
drivers/gpu/drm/i915/intel_bios.c +1 -0
+               dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct · line 734

Quoted 1 line
drivers/gpu/drm/i915/intel_bios.c +1 -0
+       }

Quick question:
Why did you write the same thing twice instead of extract to a new function like this?

dev_priv->vbt.psr.tp1_wakeup_time_us =
vbt_psr_to_us(psr_table->tp1_wakeup_time)
dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =
vbt_psr_to_us(psr_table->tp2_tp3_wakeup_time)

static int vbt_psr_to_us(int vbt_value) {
    if (bdb->version >= 209 ...) {
       return as {0:500, 1:100, 2:2500, 3:0}
    return vbt_value * 100;
}

Review

Quoted 4 lines
drivers/gpu/drm/i915/intel_bios.c +0 -0
  }
 
  static void parse_dsi_backlight_ports(struct drm_i915_private *dev_priv,
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_psr.c

drivers/gpu/drm/i915/intel_psr.c static void hsw_activate_psr1(struct intel_dp

Quoted 4 lines

index db27f2f..d64f039 100644

drivers/gpu/drm/i915/intel_psr.c +0 -0
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp

*intel_dp)

drivers/gpu/drm/i915/intel_psr.c static void hsw_activate_psr2(struct intel_dp

Quoted 36 lines
drivers/gpu/drm/i915/intel_psr.c +12 -12
         if (dev_priv->psr.link_standby)
                 val |= EDP_PSR_LINK_STANDBY;
 
-       if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-               val |= EDP_PSR_TP1_TIME_2500us;
-       else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-               val |= EDP_PSR_TP1_TIME_500us;
-       else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+       if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+               val |=  EDP_PSR_TP1_TIME_0us;
+       else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)
                 val |= EDP_PSR_TP1_TIME_100us;
+       else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+               val |= EDP_PSR_TP1_TIME_500us;
         else
-               val |= EDP_PSR_TP1_TIME_0us;
+               val |= EDP_PSR_TP1_TIME_2500us;
 
-       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-               val |= EDP_PSR_TP2_TP3_TIME_2500us;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-               val |= EDP_PSR_TP2_TP3_TIME_500us;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+               val |=  EDP_PSR_TP2_TP3_TIME_0us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
                 val |= EDP_PSR_TP2_TP3_TIME_100us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+               val |= EDP_PSR_TP2_TP3_TIME_500us;
         else
-               val |= EDP_PSR_TP2_TP3_TIME_0us;
+               val |= EDP_PSR_TP2_TP3_TIME_2500us;
 
         if (intel_dp_source_supports_hbr2(intel_dp) &&
             drm_dp_tps3_supported(intel_dp->dpcd))
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct intel_dp

*intel_dp)

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

Quoted 1 line
drivers/gpu/drm/i915/intel_psr.c +0 -0
         val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv->psr.sink_sync_latency +

1);

Quoted 20 lines
drivers/gpu/drm/i915/intel_psr.c +8 -8
-       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-               val |= EDP_PSR2_TP2_TIME_2500;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-               val |= EDP_PSR2_TP2_TIME_500;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-               val |= EDP_PSR2_TP2_TIME_100;
+       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+           dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+               val |= EDP_PSR2_TP2_TIME_50us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
+               val |= EDP_PSR2_TP2_TIME_100us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+               val |= EDP_PSR2_TP2_TIME_500us;
         else
-               val |= EDP_PSR2_TP2_TIME_50;
+               val |= EDP_PSR2_TP2_TIME_2500us;
 
         I915_WRITE(EDP_PSR2_CTL, val);
  }
--
Quoted 1 line

1.9.1

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

#13 lore raw
Quoted 148 lines · Puthikorn Voravootivat
Quoted 9 lines · vathsala nagaraju

From: Vathsala Nagaraju <[email protected]>
For psr block #9, the vbt description has moved to options [0-3] for TP1,TP2,TP3 Wakeup time from decimal value without any change to vbt structure. Since spec does not mention from which VBT version this change was added to vbt.bsf file, we cannot depend on bdb->version check to change for all the platforms.
There is RCR inplace for GOP team to provide the version number to make generic change. Since Kabylake with bdb version 209 is having this change, limiting this change to gen9_bc and version 209+ to unblock

google.

Quoted 19 lines

Tested on skl(bdb version 203,without options) and kabylake(bdb version 209,212) having new options. bspec 20131
v2: (Jani and Rodrigo)
move the 165 version check to intel_bios.c
v3: Jani
Move the abstraction to intel_bios.
v4: Jani
Rename tp*_wakeup_time to have "us" suffix.
For values outside range[0-3],default to max 2500us. Old decimal value was wake up time in multiples of 100us.
v5: Jani and Rodrigo
Handle option 2 in default condition.
Print oustide range value.
For negetive values default to 2500us.
v6: Jani
Handle default first and then fall through for case 2.
v7: Rodrigo
Apply this change for IS_GEN9_BC and vbt version > 209

Quoted 8 lines
Cc Rodrigo Vivi <[email protected]>
CC Puthikorn Voravootivat <[email protected]>
---
   drivers/gpu/drm/i915/i915_drv.h   |  4 ++--
   drivers/gpu/drm/i915/i915_reg.h   |  8 +++----
   drivers/gpu/drm/i915/intel_bios.c | 46

+++++++++++++++++++++++++++++++++++++--

Review

Quoted 3 lines
   drivers/gpu/drm/i915/intel_psr.c  | 39 +++++++++++++++++----------------
   4 files changed, 70 insertions(+), 27 deletions(-)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_drv.h

Review

Quoted 14 lines

index 57fb3aa..268b059 100644

drivers/gpu/drm/i915/i915_drv.h +2 -2
@@ -1078,8 +1078,8 @@ struct intel_vbt_data {
                  bool require_aux_wakeup;
                  int idle_frames;
                  enum psr_lines_to_wait lines_to_wait;
-               int tp1_wakeup_time;
-               int tp2_tp3_wakeup_time;
+               int tp1_wakeup_time_us;
+               int tp2_tp3_wakeup_time_us;
          } psr;
          struct {
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_reg.h

Review

Quoted 19 lines

index f11bb21..6820658 100644

drivers/gpu/drm/i915/i915_reg.h +4 -4
@@ -4088,10 +4088,10 @@ enum {
   #define   EDP_Y_COORDINATE_ENABLE      (1<<25) /* GLK and CNL+ */
   #define   EDP_MAX_SU_DISABLE_TIME(t)   ((t)<<20)
   #define   EDP_MAX_SU_DISABLE_TIME_MASK (0x1f<<20)
-#define   EDP_PSR2_TP2_TIME_500                (0<<8)
-#define   EDP_PSR2_TP2_TIME_100                (1<<8)
-#define   EDP_PSR2_TP2_TIME_2500       (2<<8)
-#define   EDP_PSR2_TP2_TIME_50         (3<<8)
+#define   EDP_PSR2_TP2_TIME_500us      (0<<8)
+#define   EDP_PSR2_TP2_TIME_100us      (1<<8)
+#define   EDP_PSR2_TP2_TIME_2500us     (2<<8)
+#define   EDP_PSR2_TP2_TIME_50us       (3<<8)
   #define   EDP_PSR2_TP2_TIME_MASK       (3<<8)
   #define   EDP_PSR2_FRAME_BEFORE_SU_SHIFT 4
   #define   EDP_PSR2_FRAME_BEFORE_SU_MASK        (0xf<<4)
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_bios.c

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct

Quoted 4 lines

index 54270bd..695ca73 100644

drivers/gpu/drm/i915/intel_bios.c +0 -0
@@ -688,8 +688,50 @@ static int intel_bios_ssc_frequency(struct

drm_i915_private *dev_priv,

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 4 lines
drivers/gpu/drm/i915/intel_bios.c +0 -2
                  break;
          }
-       dev_priv->vbt.psr.tp1_wakeup_time = psr_table->tp1_wakeup_time;
-       dev_priv->vbt.psr.tp2_tp3_wakeup_time =

psr_table->tp2_tp3_wakeup_time;

Quoted 7 lines
drivers/gpu/drm/i915/intel_bios.c +7 -0
+       /*
+        * New psr options 0=500us, 1=100us, 2=2500us, 3=0us
+        * Old decimal value is wake up time in multiples of 100 us.
+        */
+       if (bdb->version >= 209 && IS_GEN9_BC(dev_priv)) {
+               switch (psr_table->tp1_wakeup_time) {
+               case 0:

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +10 -0
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 500;
+                       break;
+               case 1:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 100;
+                       break;
+               case 3:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+                       break;
+               default:
+                       DRM_DEBUG_KMS("VBT tp1 wakeup time value %d is

outside range[0-3], defaulting to max value 2500us\n",

Quoted 8 lines
drivers/gpu/drm/i915/intel_bios.c +8 -0
+                                       psr_table->tp1_wakeup_time);
+               case 2:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 2500;
+                       break;
+               }
+
+               switch (psr_table->tp2_tp3_wakeup_time) {
+               case 0:

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 10 lines
drivers/gpu/drm/i915/intel_bios.c +10 -0
+                       dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 500;
+                       break;
+               case 1:
+                       dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 100;
+                       break;
+               case 3:
+                       dev_priv->vbt.psr.tp1_wakeup_time_us = 0;
+                       break;
+               default:
+                       DRM_DEBUG_KMS("VBT tp2_tp3 wakeup time value %d

is outside range[0-3], defaulting to max value 2500us\n",

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct drm_i915_private *dev_priv,

Quoted 7 lines
drivers/gpu/drm/i915/intel_bios.c +7 -0
+                                       psr_table->tp2_tp3_wakeup_time);
+               case 2:
+                       dev_priv->vbt.psr.tp2_tp3_wakeup_time_us = 2500;
+               break;
+               }
+       } else {
+               dev_priv->vbt.psr.tp1_wakeup_time_us =

psr_table->tp1_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct · line 732

Quoted 1 line
drivers/gpu/drm/i915/intel_bios.c +1 -0
+               dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =

psr_table->tp2_tp3_wakeup_time * 100;

drivers/gpu/drm/i915/intel_bios.c static int intel_bios_ssc_frequency(struct · line 733

Quoted 1 line
drivers/gpu/drm/i915/intel_bios.c +1 -0
+       }

Quick question:
Why did you write the same thing twice instead of extract to a new function like this?

dev_priv->vbt.psr.tp1_wakeup_time_us =
vbt_psr_to_us(psr_table->tp1_wakeup_time)
dev_priv->vbt.psr.tp2_tp3_wakeup_time_us =
vbt_psr_to_us(psr_table->tp2_tp3_wakeup_time)

Quoted 5 lines
static int vbt_psr_to_us(int vbt_value) {
     if (bdb->version >= 209 ...) {
        return as {0:500, 1:100, 2:2500, 3:0}
     return vbt_value * 100;
}

Will make this change in next version.

Quoted 44 lines

Review

Quoted 3 lines
drivers/gpu/drm/i915/intel_bios.c +0 -0
   }
   static void parse_dsi_backlight_ports(struct drm_i915_private *dev_priv,
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/intel_psr.c

drivers/gpu/drm/i915/intel_psr.c static void hsw_activate_psr1(struct intel_dp

Quoted 4 lines

index db27f2f..d64f039 100644

drivers/gpu/drm/i915/intel_psr.c +0 -0
@@ -461,23 +461,23 @@ static void hsw_activate_psr1(struct intel_dp

*intel_dp)

drivers/gpu/drm/i915/intel_psr.c static void hsw_activate_psr2(struct intel_dp

Quoted 33 lines
drivers/gpu/drm/i915/intel_psr.c +12 -12
          if (dev_priv->psr.link_standby)
                  val |= EDP_PSR_LINK_STANDBY;
-       if (dev_priv->vbt.psr.tp1_wakeup_time > 5)
-               val |= EDP_PSR_TP1_TIME_2500us;
-       else if (dev_priv->vbt.psr.tp1_wakeup_time > 1)
-               val |= EDP_PSR_TP1_TIME_500us;
-       else if (dev_priv->vbt.psr.tp1_wakeup_time > 0)
+       if (dev_priv->vbt.psr.tp1_wakeup_time_us == 0)
+               val |=  EDP_PSR_TP1_TIME_0us;
+       else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 100)
                  val |= EDP_PSR_TP1_TIME_100us;
+       else if (dev_priv->vbt.psr.tp1_wakeup_time_us <= 500)
+               val |= EDP_PSR_TP1_TIME_500us;
          else
-               val |= EDP_PSR_TP1_TIME_0us;
+               val |= EDP_PSR_TP1_TIME_2500us;
-       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-               val |= EDP_PSR_TP2_TP3_TIME_2500us;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-               val |= EDP_PSR_TP2_TP3_TIME_500us;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
+       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us == 0)
+               val |=  EDP_PSR_TP2_TP3_TIME_0us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
                  val |= EDP_PSR_TP2_TP3_TIME_100us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+               val |= EDP_PSR_TP2_TP3_TIME_500us;
          else
-               val |= EDP_PSR_TP2_TP3_TIME_0us;
+               val |= EDP_PSR_TP2_TP3_TIME_2500us;
          if (intel_dp_source_supports_hbr2(intel_dp) &&
              drm_dp_tps3_supported(intel_dp->dpcd))
@@ -513,14 +513,15 @@ static void hsw_activate_psr2(struct intel_dp

*intel_dp)

Quoted 23 lines

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

Quoted 1 line
drivers/gpu/drm/i915/intel_psr.c +0 -0
          val |= EDP_PSR2_FRAME_BEFORE_SU(dev_priv->psr.sink_sync_latency +

1);

Quoted 20 lines
drivers/gpu/drm/i915/intel_psr.c +8 -8
-       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 5)
-               val |= EDP_PSR2_TP2_TIME_2500;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 1)
-               val |= EDP_PSR2_TP2_TIME_500;
-       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time > 0)
-               val |= EDP_PSR2_TP2_TIME_100;
+       if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us >= 0 &&
+           dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 50)
+               val |= EDP_PSR2_TP2_TIME_50us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 100)
+               val |= EDP_PSR2_TP2_TIME_100us;
+       else if (dev_priv->vbt.psr.tp2_tp3_wakeup_time_us <= 500)
+               val |= EDP_PSR2_TP2_TIME_500us;
          else
-               val |= EDP_PSR2_TP2_TIME_50;
+               val |= EDP_PSR2_TP2_TIME_2500us;
          I915_WRITE(EDP_PSR2_CTL, val);
   }
--

1.9.1

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