Skip to contentSkip to conversation

drm/i915/vbt: Fix VBT parsing for the PSR section

PATCH In review Dhinakaran Pandiyan 6 participants 9 messages Jul 16, 2019 – Jul 17, 2019

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

PATCH 1/1 drm/i915/vbt: Fix VBT parsing for the PSR section

A single 32-bit PSR2 training pattern field follows the sixteen element array of PSR table entries in the VBT spec. But, we incorrectly define this PSR2 field for each of the PSR table entries. As a result, the PSR1 training pattern duration for any panel_type != 0 will be parsed incorrectly. Secondly, PSR2 training pattern durations for VBTs with bdb version >= 226 will also be wrong.

Cc Rodrigo Vivi <[email protected]>
Cc José Roberto de Souza <[email protected]>
Fixes 88a0d9606aff ("drm/i915/vbt: Parse and use the new field with PSR2 TP2/3 wakeup time")
---
 drivers/gpu/drm/i915/display/intel_bios.c     | 2 +-
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +1 -1
index 21501d565327..b416b394b641 100644
@@ -766,7 +766,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 	}
 
 	if (bdb->version >= 226) {
-		u32 wakeup_time = psr_table->psr2_tp2_tp3_wakeup_time;
+		u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time;
 
 		wakeup_time = (wakeup_time >> (2 * panel_type)) & 0x3;
 		switch (wakeup_time) {
drivers/gpu/drm/i915/display/intel_vbt_defs.h +3 -3
index 93f5c9d204d6..09cd37fb0b1c 100644
@@ -481,13 +481,13 @@ struct psr_table {
 	/* TP wake up time in multiple of 100 */
 	u16 tp1_wakeup_time;
 	u16 tp2_tp3_wakeup_time;
-
-	/* PSR2 TP2/TP3 wakeup time for 16 panels */
-	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 struct bdb_psr {
 	struct psr_table psr_table[16];
+
+	/* PSR2 TP2/TP3 wakeup time for 16 panels */
+	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 /*
Signature · 6 lines
2.17.1

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

A single 32-bit PSR2 training pattern field follows the sixteen element array of PSR table entries in the VBT spec. But, we incorrectly define this PSR2 field for each of the PSR table entries. As a result, the PSR1 training pattern duration for any panel_type != 0 will be parsed incorrectly. Secondly, PSR2 training pattern durations for VBTs with bdb version >= 226 will also be wrong.

This was reported and bisected by
Aliaksei Urbanski here - https://bugzilla.kernel.org/show_bug.cgi?id=204183

I'll add Bugzilla after the fix is confirmed.

Cc Rodrigo Vivi <[email protected]>
Cc José Roberto de Souza <[email protected]>
Fixes 88a0d9606aff ("drm/i915/vbt: Parse and use the new field with PSR2 TP2/3 wakeup time")z
---
 drivers/gpu/drm/i915/display/intel_bios.c     | 2 +-
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +1 -1
index 21501d565327..b416b394b641 100644
@@ -766,7 +766,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 	}
 
 	if (bdb->version >= 226) {
-		u32 wakeup_time = psr_table->psr2_tp2_tp3_wakeup_time;
+		u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time;
 
 		wakeup_time = (wakeup_time >> (2 * panel_type)) & 0x3;
 		switch (wakeup_time) {
(quoted diff) +0 -0

b/drivers/gpu/drm/i915/display/intel_vbt_defs.h
index 93f5c9d204d6..09cd37fb0b1c 100644

drivers/gpu/drm/i915/display/intel_vbt_defs.h +3 -3
@@ -481,13 +481,13 @@ struct psr_table {
 	/* TP wake up time in multiple of 100 */
 	u16 tp1_wakeup_time;
 	u16 tp2_tp3_wakeup_time;
-
-	/* PSR2 TP2/TP3 wakeup time for 16 panels */
-	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 struct bdb_psr {
 	struct psr_table psr_table[16];
+
+	/* PSR2 TP2/TP3 wakeup time for 16 panels */
+	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 /*

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

Reviewed-by
#2 lore raw
Quoted 12 lines · Dhinakaran
Quoted 10 lines · Dhinakaran Pandiyan

A single 32-bit PSR2 training pattern field follows the sixteen element
array of PSR table entries in the VBT spec. But, we incorrectly define
this PSR2 field for each of the PSR table entries. As a result, the PSR1
training pattern duration for any panel_type != 0 will be parsed incorrectly. Secondly, PSR2 training pattern durations for VBTs with bdb
version >= 226 will also be wrong.

Quoted 6 lines

This was reported and bisected by
Aliaksei Urbanski here -
https://bugzilla.kernel.org/show_bug.cgi?id=204183

I'll add Bugzilla after the fix is confirmed.

Oohh it makes sense, thanks for spotting it.

And 2 users reported that it works:
https://bugzilla.kernel.org/show_bug.cgi?id=204183
https://bugs.freedesktop.org/show_bug.cgi?id=111088

Can you also CC kernel stable so the fix is cherry-picked?

Quoted 37 lines
Cc Rodrigo Vivi <[email protected]>
Cc José Roberto de Souza <[email protected]>
Fixes 88a0d9606aff ("drm/i915/vbt: Parse and use the new field with

PSR2 TP2/3 wakeup time")z

---
 drivers/gpu/drm/i915/display/intel_bios.c     | 2 +-
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +1 -1
index 21501d565327..b416b394b641 100644
@@ -766,7 +766,7 @@ parse_psr(struct drm_i915_private *dev_priv,
 const struct bdb_header *bdb)
 	}
 
 	if (bdb->version >= 226) {
-		u32 wakeup_time = psr_table->psr2_tp2_tp3_wakeup_time;
+		u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time;
 
 		wakeup_time = (wakeup_time >> (2 * panel_type)) & 0x3;
drivers/gpu/drm/i915/display/intel_bios.c +0 -0
 		switch (wakeup_time) {
drivers/gpu/drm/i915/display/intel_vbt_defs.h +0 -3
index 93f5c9d204d6..09cd37fb0b1c 100644
@@ -481,13 +481,13 @@ struct psr_table {
 	/* TP wake up time in multiple of 100 */
 	u16 tp1_wakeup_time;
 	u16 tp2_tp3_wakeup_time;
-
-	/* PSR2 TP2/TP3 wakeup time for 16 panels */
-	u32 psr2_tp2_tp3_wakeup_time;

drivers/gpu/drm/i915/display/intel_vbt_defs.h struct psr_table { · line 493

Quoted 10 lines
drivers/gpu/drm/i915/display/intel_vbt_defs.h +3 -0
 } __packed;
 
 struct bdb_psr {
 	struct psr_table psr_table[16];
+
+	/* PSR2 TP2/TP3 wakeup time for 16 panels */
+	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 /*

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

maintainer Acked-by
#3 lore raw
Quoted 17 lines · Jose
Quoted 16 lines · Dhinakaran
Quoted 10 lines · Dhinakaran Pandiyan

A single 32-bit PSR2 training pattern field follows the sixteen element
array of PSR table entries in the VBT spec. But, we incorrectly define
this PSR2 field for each of the PSR table entries. As a result, the PSR1
training pattern duration for any panel_type != 0 will be parsed incorrectly. Secondly, PSR2 training pattern durations for VBTs with bdb
version >= 226 will also be wrong.

This was reported and bisected by
Aliaksei Urbanski here -
https://bugzilla.kernel.org/show_bug.cgi?id=204183

Quoted 8 lines
Quoted 2 lines

I'll add Bugzilla after the fix is confirmed.

Oohh it makes sense, thanks for spotting it.

And 2 users reported that it works:
https://bugzilla.kernel.org/show_bug.cgi?id=204183
https://bugs.freedesktop.org/show_bug.cgi?id=111088

Please add this before merging:

Reference: https://bugzilla.kernel.org/show_bug.cgi?id=204183
Reference: https://bugs.freedesktop.org/show_bug.cgi?id=111088

Quoted 2 lines

Can you also CC kernel stable so the fix is cherry-picked?

and this:

Quoted 2 lines
Quoted 41 lines
Quoted 41 lines
Cc Rodrigo Vivi <[email protected]>
Cc José Roberto de Souza <[email protected]>
Fixes 88a0d9606aff ("drm/i915/vbt: Parse and use the new field with

PSR2 TP2/3 wakeup time")z

---
 drivers/gpu/drm/i915/display/intel_bios.c     | 2 +-
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +1 -1
index 21501d565327..b416b394b641 100644
@@ -766,7 +766,7 @@ parse_psr(struct drm_i915_private *dev_priv,
 const struct bdb_header *bdb)
 	}
 
 	if (bdb->version >= 226) {
-		u32 wakeup_time = psr_table->psr2_tp2_tp3_wakeup_time;
+		u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time;
 
 		wakeup_time = (wakeup_time >> (2 * panel_type)) & 0x3;
drivers/gpu/drm/i915/display/intel_bios.c +0 -0
 		switch (wakeup_time) {
drivers/gpu/drm/i915/display/intel_vbt_defs.h +0 -3
index 93f5c9d204d6..09cd37fb0b1c 100644
@@ -481,13 +481,13 @@ struct psr_table {
 	/* TP wake up time in multiple of 100 */
 	u16 tp1_wakeup_time;
 	u16 tp2_tp3_wakeup_time;
-
-	/* PSR2 TP2/TP3 wakeup time for 16 panels */
-	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
Quoted 8 lines

drivers/gpu/drm/i915/display/intel_vbt_defs.h struct psr_table { · line 493

Quoted 8 lines
drivers/gpu/drm/i915/display/intel_vbt_defs.h +3 -0
 struct bdb_psr {
 	struct psr_table psr_table[16];
+
+	/* PSR2 TP2/TP3 wakeup time for 16 panels */
+	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 /*

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

Reviewed-by on v1 1/1
#5 lore raw
In reply to Dhinakaran Pandiyan
Quoted 11 lines · Dhinakaran Pandiyan

A single 32-bit PSR2 training pattern field follows the sixteen element array of PSR table entries in the VBT spec. But, we incorrectly define this PSR2 field for each of the PSR table entries. As a result, the PSR1 training pattern duration for any panel_type != 0 will be parsed incorrectly. Secondly, PSR2 training pattern durations for VBTs with bdb version >= 226 will also be wrong.

Cc Rodrigo Vivi <[email protected]>
Cc José Roberto de Souza <[email protected]>
Fixes 88a0d9606aff ("drm/i915/vbt: Parse and use the new field with PSR2 TP2/3 wakeup time")

Please sync the igt copy after landing this.

Quoted 46 lines
---
 drivers/gpu/drm/i915/display/intel_bios.c     | 2 +-
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +1 -1
index 21501d565327..b416b394b641 100644
@@ -766,7 +766,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 	}
 
 	if (bdb->version >= 226) {
-		u32 wakeup_time = psr_table->psr2_tp2_tp3_wakeup_time;
+		u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time;
 
 		wakeup_time = (wakeup_time >> (2 * panel_type)) & 0x3;
 		switch (wakeup_time) {
drivers/gpu/drm/i915/display/intel_vbt_defs.h +3 -3
index 93f5c9d204d6..09cd37fb0b1c 100644
@@ -481,13 +481,13 @@ struct psr_table {
 	/* TP wake up time in multiple of 100 */
 	u16 tp1_wakeup_time;
 	u16 tp2_tp3_wakeup_time;
-
-	/* PSR2 TP2/TP3 wakeup time for 16 panels */
-	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 struct bdb_psr {
 	struct psr_table psr_table[16];
+
+	/* PSR2 TP2/TP3 wakeup time for 16 panels */
+	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 /*
Signature · 6 lines
2.17.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä
Intel
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 8 lines · Ville Syrjälä
Quoted 7 lines · Dhinakaran Pandiyan

A single 32-bit PSR2 training pattern field follows the sixteen element array of PSR table entries in the VBT spec. But, we incorrectly define this PSR2 field for each of the PSR table entries. As a result, the PSR1 training pattern duration for any panel_type != 0 will be parsed incorrectly. Secondly, PSR2 training pattern durations for VBTs with bdb version >= 226 will also be wrong.

Quoted 8 lines
Quoted 4 lines
Cc Rodrigo Vivi <[email protected]>
Cc José Roberto de Souza <[email protected]>
Fixes 88a0d9606aff ("drm/i915/vbt: Parse and use the new field with PSR2 TP2/3 wakeup time")

Please sync the igt copy after landing this.

Will do, thanks!

-DK

Quoted 41 lines
Quoted 41 lines
---
 drivers/gpu/drm/i915/display/intel_bios.c     | 2 +-
 drivers/gpu/drm/i915/display/intel_vbt_defs.h | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_bios.c +1 -1
index 21501d565327..b416b394b641 100644
@@ -766,7 +766,7 @@ parse_psr(struct drm_i915_private *dev_priv, const struct bdb_header *bdb)
 	}
 
 	if (bdb->version >= 226) {
-		u32 wakeup_time = psr_table->psr2_tp2_tp3_wakeup_time;
+		u32 wakeup_time = psr->psr2_tp2_tp3_wakeup_time;
 
 		wakeup_time = (wakeup_time >> (2 * panel_type)) & 0x3;
 		switch (wakeup_time) {
drivers/gpu/drm/i915/display/intel_vbt_defs.h +3 -3
index 93f5c9d204d6..09cd37fb0b1c 100644
@@ -481,13 +481,13 @@ struct psr_table {
 	/* TP wake up time in multiple of 100 */
 	u16 tp1_wakeup_time;
 	u16 tp2_tp3_wakeup_time;
-
-	/* PSR2 TP2/TP3 wakeup time for 16 panels */
-	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
 struct bdb_psr {
 	struct psr_table psr_table[16];
+
+	/* PSR2 TP2/TP3 wakeup time for 16 panels */
+	u32 psr2_tp2_tp3_wakeup_time;
 } __packed;
 
Quoted 10 lines
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_vbt_defs.h +0 -0
 /*
Signature · 6 lines
2.17.1

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

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